diff options
| author | Thomas Vigouroux <tomvig38@gmail.com> | 2020-07-06 23:01:46 +0200 |
|---|---|---|
| committer | Stephan Seitz <stephan.lauf@yahoo.de> | 2020-07-09 14:48:39 +0200 |
| commit | 7bb0d7548d2ce36ab25a041b1a13ff277b4c4cd2 (patch) | |
| tree | f92935294505e40793eb8b4994021d701d9ca723 /queries | |
| parent | Python locals: with_statement can define variables (diff) | |
| download | nvim-treesitter-7bb0d7548d2ce36ab25a041b1a13ff277b4c4cd2.tar nvim-treesitter-7bb0d7548d2ce36ab25a041b1a13ff277b4c4cd2.tar.gz nvim-treesitter-7bb0d7548d2ce36ab25a041b1a13ff277b4c4cd2.tar.bz2 nvim-treesitter-7bb0d7548d2ce36ab25a041b1a13ff277b4c4cd2.tar.lz nvim-treesitter-7bb0d7548d2ce36ab25a041b1a13ff277b4c4cd2.tar.xz nvim-treesitter-7bb0d7548d2ce36ab25a041b1a13ff277b4c4cd2.tar.zst nvim-treesitter-7bb0d7548d2ce36ab25a041b1a13ff277b4c4cd2.zip | |
highlight(c): fix booleans and types
Diffstat (limited to 'queries')
| -rw-r--r-- | queries/c/highlights.scm | 57 | ||||
| -rw-r--r-- | queries/cpp/highlights.scm | 4 |
2 files changed, 41 insertions, 20 deletions
diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index 3fbf4ffa9..a9693d66c 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -13,7 +13,7 @@ "volatile" ] @keyword -[ +[ "while" "for" "do" @@ -25,11 +25,9 @@ "if" "else" "case" - "switch" + "switch" ] @conditional -(conditional_expression [ "?" ":" ] @conditional) - "#define" @constant.macro [ "#if" @@ -43,24 +41,30 @@ ] @keyword [ - "--" + "=" + "-" - "->" - "!=" "*" "/" - "&" - "&&" "+" - "++" + + "~" + "|" + "&" + "<<" + ">>" + + "->" + "<" "<=" - "==" - "=" - "~" - ">" ">=" + ">" + "==" + "!=" + "!" + "&&" "||" "-=" @@ -69,10 +73,20 @@ "/=" "|=" "&=" + "--" + "++" ] @operator +[ + (true) + (false) +] @boolean + [ "." ";" ":" "," ] @punctuation.delimiter +(conditional_expression [ "?" ":" ] @conditional) + + [ "(" ")" "[" "]" "{" "}"] @punctuation.bracket (string_literal) @string @@ -96,12 +110,17 @@ (field_identifier) @property (statement_identifier) @label -(type_identifier) @type -(primitive_type) @type -(sized_type_specifier) @type -((identifier) @type - (#match? @type "^[A-Z]")) +[ +(type_identifier) +(primitive_type) +(sized_type_specifier) +(type_descriptor) + ] @type + +(declaration type: [(identifier) (type_identifier)] @type) +(cast_expression type: [(identifier) (type_identifier)] @type) +(sizeof_expression value: (parenthesized_expression (identifier) @type)) ((identifier) @constant (#match? @constant "^[A-Z][A-Z0-9_]+$")) diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index 49382bdf7..c0a76c137 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -20,6 +20,8 @@ (namespace_identifier) @constant +((identifier) @type (#match? @type "^[A-Z]")) + ((namespace_identifier) @type (#match? @type "^[A-Z]")) ((namespace_identifier) @constant @@ -77,7 +79,7 @@ "noexcept" "throw" ] @exception - + [ "class" |
