mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-17 19:00:02 -04:00
Add OpenFOAM parser
This commit is contained in:
parent
50fee51d35
commit
16e77495c4
9 changed files with 131 additions and 0 deletions
61
queries/foam/highlights.scm
Normal file
61
queries/foam/highlights.scm
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
;; Comments
|
||||
(comment) @comment
|
||||
|
||||
;; Generic Key-value pairs and dictionary keywords
|
||||
(key_value
|
||||
keyword: (identifier) @function
|
||||
)
|
||||
(dict
|
||||
key: (identifier) @type
|
||||
)
|
||||
|
||||
;; Macros
|
||||
(macro
|
||||
"$" @conditional
|
||||
(prev_scope)* @conditional
|
||||
(identifier)* @namespace
|
||||
)
|
||||
|
||||
|
||||
;; Directives
|
||||
"#" @conditional
|
||||
(preproc_call
|
||||
directive: (identifier)* @conditional
|
||||
argument: (identifier)* @namespace
|
||||
)
|
||||
(
|
||||
(preproc_call
|
||||
argument: (identifier)* @namespace
|
||||
) @conditional
|
||||
(#match? @conditional "ifeq")
|
||||
)
|
||||
(
|
||||
(preproc_call) @conditional
|
||||
(#match? @conditional "(else|endif)")
|
||||
)
|
||||
|
||||
;; Literal numbers and strings
|
||||
(number_literal) @float
|
||||
(string_literal) @string
|
||||
(escape_sequence) @escape
|
||||
|
||||
;; Treat [m^2 s^-2] the same as if it was put in numbers format
|
||||
(dimensions dimension: (identifier) @float)
|
||||
|
||||
;; Punctuation
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"#{"
|
||||
"#}"
|
||||
";"
|
||||
] @punctuation
|
||||
|
||||
;; Special identifiers
|
||||
([(identifier) "on" "off" "true" "false" "yes" "no"] @attribute
|
||||
(#match? @attribute "^(uniform|non-uniform|and|or|on|off|true|false|yes|no)$")
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue