feat!: align standard captures with upstream

Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.

Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.

Specifically:

* tree-sitter "standard capture names"
  (3f44b89685/highlight/src/lib.rs (L20-L72)):

  - `@parameter` -> `@variable.parameter`
  - `@field` -> `@variable.member`
  - `@namespace` -> `@module`
  - `@float` -> `@number.float`
  - `@symbol` -> `@string.special.symbol`
  - `@string.regex` -> `@string.regexp`
  - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
  - `@text.title` -> `@markup.heading`
  - `@text.literal` -> `@markup.raw`
  - `@text.reference` -> `@markup.link`
  - `@text.uri` -> `@markup.link.url` (in markup links)
  - `@string.special` -> `@markup.link.label` (non-url links)
  - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)

* Helix captures
  (https://docs.helix-editor.com/master/themes.html#syntax-highlighting):

  - `@method` -> `@function.method`
  - `@method.call` -> `@function.method.call`
  - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
  - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
  - `@text.uri` -> `@string.special.url` (outside markup)
  - `@preproc` -> `@keyword.directive`
  - `@define` -> `@keyword.directive`(`.define`?)
  - `@storageclass` -> `@keyword.storage`
  - `@conditional` -> `@keyword.conditional`
  - `@debug` -> `@keyword.debug`
  - `@exception` -> `@keyword.exception`
  - `@include` -> `@keyword.import`
  - `@repeat` -> `@keyword.repeat`

* cleanup

  - remove some redundant `@conceal` (but still allow it for conceal-only patterns)
  - remove obsolete `@error` (syntax linting is out of scope for this repo)
  - sort, cleanup capture list in `CONTRIBUTING.md`
This commit is contained in:
Christian Clason 2023-12-24 10:00:20 +01:00
parent 10dd49958c
commit 1ae9b0e455
263 changed files with 2356 additions and 2337 deletions

View file

@ -84,16 +84,88 @@ you can mark the language as optional (by putting it between parenthesis).
As languages differ quite a lot, here is a set of captures available to you when building a `highlights.scm` query. Note that your colorscheme needs to define (or link) these captures as highlight groups.
#### Misc
#### Identifiers
```scheme
@comment ; line and block comments
@comment.documentation ; comments documenting code
@error ; syntax/parser errors
@none ; completely disable the highlight
@preproc ; various preprocessor directives & shebangs
@define ; preprocessor definition directives
@operator ; symbolic operators (e.g. `+` / `*`)
```query
@variable ; various variable names
@variable.builtin ; built-in variable names (e.g. `this`)
@variable.parameter ; parameters of a function
@variable.member ; object and struct fields
@constant ; constant identifiers
@constant.builtin ; built-in constant values
@constant.macro ; constants defined by the preprocessor
@module ; modules or namespaces
@module.builtin ; built-in modules or namespaces
@label ; GOTO and other labels (e.g. `label:` in C), including heredoc labels
```
#### Literals
```query
@string ; string literals
@string.documentation ; string documenting code (e.g. Python docstrings)
@string.regexp ; regular expressions
@string.escape ; escape sequences
@string.special ; other special strings (e.g. dates)
@string.special.symbol ; symbols or atoms
@string.special.url ; URIs (e.g. hyperlinks)
@string.special.path ; filenames
@character ; character literals
@character.special ; special characters (e.g. wildcards)
@boolean ; boolean literals
@number ; numeric literals
@number.float ; floating-point number literals
```
#### Types
```query
@type ; type or class definitions and annotations
@type.builtin ; built-in types
@type.definition ; identifiers in type definitions (e.g. `typedef <type> <identifier>` in C)
@type.qualifier ; type qualifiers (e.g. `const`)
@attribute ; attribute annotations (e.g. Python decorators)
@property ; the key in key/value pairs
```
#### Functions
```query
@function ; function definitions
@function.builtin ; built-in functions
@function.call ; function calls
@function.macro ; preprocessor macros
@function.method ; method definitions
@function.method.call ; method calls
@constructor ; constructor calls and definitions
@operator ; symbolic operators (e.g. `+` / `*`)
```
#### Keywords
```query
@keyword ; keywords not fitting into specific categories
@keyword.coroutine ; keywords related to coroutines (e.g. `go` in Go, `async/await` in Python)
@keyword.function ; keywords that define a function (e.g. `func` in Go, `def` in Python)
@keyword.operator ; operators that are English words (e.g. `and` / `or`)
@keyword.import ; keywords for including modules (e.g. `import` / `from` in Python)
@keyword.storage ; modifiers that affect storage in memory or life-time
@keyword.repeat ; keywords related to loops (e.g. `for` / `while`)
@keyword.return ; keywords like `return` and `yield`
@keyword.debug ; keywords related to debugging
@keyword.exception ; keywords related to exceptions (e.g. `throw` / `catch`)
@keyword.conditional ; keywords related to conditionals (e.g. `if` / `else`)
@keyword.conditional.ternary ; ternary operator (e.g. `?` / `:`)
@keyword.directive ; various preprocessor directives & shebangs
@keyword.directive.define ; preprocessor definition directives
```
#### Punctuation
@ -104,119 +176,53 @@ As languages differ quite a lot, here is a set of captures available to you when
@punctuation.special ; special symbols (e.g. `{}` in string interpolation)
```
#### Literals
#### Comments
```scheme
@string ; string literals
@string.documentation ; string documenting code (e.g. Python docstrings)
@string.regex ; regular expressions
@string.escape ; escape sequences
@string.special ; other special strings (e.g. dates)
```query
@comment ; line and block comments
@comment.documentation ; comments documenting code
@character ; character literals
@character.special ; special characters (e.g. wildcards)
@boolean ; boolean literals
@number ; numeric literals
@float ; floating-point number literals
@comment.error ; error-type comments (e.g., `DEPRECATED:`)
@comment.warning ; warning-type comments (e.g., `WARNING:`, `FIX:`)
@comment.hint ; note-type comments (e.g., `NOTE:`)
@comment.info ; info-type comments
@comment.todo ; todo-type comments (e.g-, `TODO:`, `WIP:`)
```
#### Functions
```scheme
@function ; function definitions
@function.builtin ; built-in functions
@function.call ; function calls
@function.macro ; preprocessor macros
@method ; method definitions
@method.call ; method calls
@constructor ; constructor calls and definitions
@parameter ; parameters of a function
```
#### Keywords
```scheme
@keyword ; various keywords
@keyword.coroutine ; keywords related to coroutines (e.g. `go` in Go, `async/await` in Python)
@keyword.function ; keywords that define a function (e.g. `func` in Go, `def` in Python)
@keyword.operator ; operators that are English words (e.g. `and` / `or`)
@keyword.return ; keywords like `return` and `yield`
@conditional ; keywords related to conditionals (e.g. `if` / `else`)
@conditional.ternary ; ternary operator (e.g. `?` / `:`)
@repeat ; keywords related to loops (e.g. `for` / `while`)
@debug ; keywords related to debugging
@label ; GOTO and other labels (e.g. `label:` in C)
@include ; keywords for including modules (e.g. `import` / `from` in Python)
@exception ; keywords related to exceptions (e.g. `throw` / `catch`)
```
#### Types
```scheme
@type ; type or class definitions and annotations
@type.builtin ; built-in types
@type.definition ; identifiers in type definitions (e.g. `typedef <type> <identifier>` in C)
@type.qualifier ; type qualifiers (e.g. `const`)
@storageclass ; modifiers that affect storage in memory or life-time
@attribute ; attribute annotations (e.g. Python decorators)
@field ; object and struct fields
@property ; similar to `@field`
```
#### Identifiers
```scheme
@variable ; various variable names
@variable.builtin ; built-in variable names (e.g. `this`)
@constant ; constant identifiers
@constant.builtin ; built-in constant values
@constant.macro ; constants defined by the preprocessor
@namespace ; modules or namespaces
@symbol ; symbols or atoms
```
#### Text
#### Markup
Mainly for markup languages.
```scheme
@text ; non-structured text
@text.strong ; bold text
@text.emphasis ; text with emphasis
@text.underline ; underlined text
@text.strike ; strikethrough text
@text.title ; text that is part of a title
@text.quote ; text quotations
@text.uri ; URIs (e.g. hyperlinks)
@text.math ; math environments (e.g. `$ ... $` in LaTeX)
@text.environment ; text environments of markup languages
@text.environment.name ; text indicating the type of an environment
@text.reference ; text references, footnotes, citations, etc.
```query
@markup.strong ; bold text
@markup.italic ; text with emphasis
@markup.strikethrough ; strikethrough text
@markup.underline ; underlined text (only for literal underline markup!)
@text.literal ; literal or verbatim text (e.g., inline code)
@text.literal.block ; literal or verbatim text as a stand-alone block
@markup.heading ; headings, titles (including markers)
@markup.quote ; block quotes
@markup.math ; math environments (e.g. `$ ... $` in LaTeX)
@markup.environment ; environments (e.g. in LaTeX)
@markup.link ; text references, footnotes, citations, etc.
@markup.link.label ; link, reference descriptions
@markup.link.url ; URL-style links
@markup.raw ; literal or verbatim text (e.g., inline code)
@markup.raw.block ; literal or verbatim text as a stand-alone block
; (use priority 90 for blocks with injections)
@text.todo ; todo notes
@text.note ; info notes
@text.warning ; warning notes
@text.danger ; danger/error notes
@text.diff.add ; added text (for diff files)
@text.diff.delete ; deleted text (for diff files)
@markup.list ; list markers
@markup.list.checked ; checked todo-style list markers
@markup.list.unchecked ; unchecked todo-style list markers
```
#### Tags
Used for XML-like tags.
```query
@diff.plus ; added text (for diff files)
@diff.minus ; deleted text (for diff files)
@diff.delta ; changed text (for diff files)
```
```scheme
@tag ; XML tag names
@ -224,17 +230,14 @@ Used for XML-like tags.
@tag.delimiter ; XML tag delimiters
```
#### Conceal
#### Non-highlighting captures
```scheme
@conceal ; for captures that are only used for concealing
```query
@none ; completely disable the highlight
@conceal ; captures that are only meant to be concealed
```
`@conceal` must be followed by `(#set! conceal "")`.
#### Spell
```scheme
```query
@spell ; for defining regions to be spellchecked
@nospell ; for defining regions that should NOT be spellchecked
```
@ -243,6 +246,25 @@ The main types of nodes which are spell checked are:
- Comments
- Strings; where it makes sense. Strings that have interpolation or are typically used for non text purposes are not spell checked (e.g. bash).
#### Predicates
Captures can be restricted according to node contents using [predicates](https://neovim.io/doc/user/treesitter.html#treesitter-predicates). For performance reasons, prefer earlier predicates in this list:
1. `#eq?` (literal match)
2. `#any-of?` (one of several literal matches)
3. `#lua-match?` (match against a [Lua pattern](https://neovim.io/doc/user/luaref.html#lua-pattern))
4. `#match?`/`#vim-match?` (match against a [Vim regular expression](https://neovim.io/doc/user/pattern.html#regexp)
#### Conceal
Captures can be concealed by setting the [`conceal` metadata](https://neovim.io/doc/user/treesitter.html#treesitter-highlight-conceal), e.g..,
```query
(fenced_code_block_delimiter @markup.raw.block (#set! conceal ""))
```
The capture should be meaningful to allow proper highlighting when `set conceallevel=0`. If the unconcealed capture should not be highlighted (e.g., because an earlier pattern handles this), you can use `@conceal`.
A conceal can be restricted to part of the capture via the [`#offset!` directive](https://neovim.io/doc/user/treesitter.html#treesitter-directive-offset%21).
#### Priority
Captures can be assigned a priority to control precedence of highlights via the

View file

@ -44,7 +44,7 @@
"aliased"
"constant"
"renames"
] @storageclass
] @keyword.storage
[
"mod"
"new"
@ -56,7 +56,7 @@
[
"with"
"use"
] @include
] @keyword.import
[
"body"
"function"
@ -79,7 +79,7 @@
"parallel"
"reverse"
"some"
] @repeat
] @keyword.repeat
[
"return"
] @keyword.return
@ -90,11 +90,11 @@
"then"
"elsif"
"select"
] @conditional
] @keyword.conditional
[
"exception"
"raise"
] @exception
] @keyword.exception
(comment) @comment @spell
(string_literal) @string
(character_literal) @string
@ -109,24 +109,24 @@
(entry_declaration . (identifier) @function)
;; Some keywords should take different categories depending on the context
(use_clause "use" @include "type" @include)
(with_clause "private" @include)
(with_clause "limited" @include)
(use_clause (_) @namespace)
(with_clause (_) @namespace)
(use_clause "use" @keyword.import "type" @keyword.import)
(with_clause "private" @keyword.import)
(with_clause "limited" @keyword.import)
(use_clause (_) @module)
(with_clause (_) @module)
(loop_statement "end" @keyword.repeat)
(if_statement "end" @conditional)
(if_statement "end" @keyword.conditional)
(loop_parameter_specification "in" @keyword.repeat)
(loop_parameter_specification "in" @keyword.repeat)
(iterator_specification ["in" "of"] @keyword.repeat)
(range_attribute_designator "range" @keyword.repeat)
(raise_statement "with" @exception)
(raise_statement "with" @keyword.exception)
(gnatprep_declarative_if_statement) @preproc
(gnatprep_if_statement) @preproc
(gnatprep_identifier) @preproc
(gnatprep_declarative_if_statement) @keyword.directive
(gnatprep_if_statement) @keyword.directive
(gnatprep_identifier) @keyword.directive
(subprogram_declaration "is" @keyword.function "abstract" @keyword.function)
(aspect_specification "with" @keyword.function)

View file

@ -27,13 +27,13 @@
;; Imports and Module Declarations
"import" @include
"import" @keyword.import
(module_name) @namespace
(module_name) @module
;; Pragmas and comments
(pragma) @preproc
(pragma) @keyword.directive
(comment) @comment @spell

View file

@ -6,7 +6,7 @@
name: (identifier) @function)
(pipe_call
arguments: (pipe_arguments
(identifier) @parameter))
(identifier) @variable.parameter))
(structural_assignment
operator: (identifier) @keyword)

View file

@ -28,10 +28,10 @@
;; Methods
(method_declaration
name: (identifier) @method)
name: (identifier) @function.method)
(method_invocation
name: (identifier) @method.call)
name: (identifier) @function.method.call)
(super) @function.builtin
@ -77,7 +77,7 @@
(method_declaration
(formal_parameters
(formal_parameter
name: (identifier) @parameter)))
name: (identifier) @variable.parameter)))
(constructor_declaration
name: (identifier) @constructor)
@ -142,10 +142,10 @@
(field_declaration
declarator: (variable_declarator
name: (identifier) @field))
name: (identifier) @variable.member))
(field_access
field: (identifier) @field)
field: (identifier) @variable.member)
; Variables
@ -194,14 +194,14 @@
"if"
"else"
"switch"
] @conditional
] @keyword.conditional
[
"for"
"while"
"do"
"break"
] @repeat
] @keyword.repeat
[
"return"
@ -212,7 +212,7 @@
"finally"
"try"
"catch"
] @exception
] @keyword.exception
"new" @keyword.operator

View file

@ -47,21 +47,21 @@
(number) @number
(string) @string
(regex) @string.regex
(regex) @string.regexp
(escape_sequence) @string.escape
(comment) @comment @spell
((program . (comment) @preproc)
(#lua-match? @preproc "^#!/"))
((program . (comment) @keyword.directive)
(#lua-match? @keyword.directive "^#!/"))
(ns_qualified_name (namespace) @namespace)
(ns_qualified_name (namespace) @module)
(ns_qualified_name "::" @punctuation.delimiter)
(func_def name: (_ (identifier) @function) @function)
(func_call name: (_ (identifier) @function) @function)
(func_def (param_list (identifier) @parameter))
(func_def (param_list (identifier) @variable.parameter))
[
"print"
@ -92,7 +92,7 @@
"while"
"for"
"in"
] @repeat
] @keyword.repeat
[
"if"
@ -100,14 +100,14 @@
"switch"
"case"
"default"
] @conditional
] @keyword.conditional
[
"@include"
"@load"
] @include
] @keyword.import
"@namespace" @preproc
"@namespace" @keyword.directive
[
"BEGIN"
@ -156,7 +156,7 @@
(ternary_exp [
"?"
":"
] @conditional.ternary)
] @keyword.conditional.ternary)
(update_exp [
"++"

View file

@ -70,7 +70,7 @@
"case"
"in"
"esac"
] @conditional
] @keyword.conditional
[
"for"
@ -79,7 +79,7 @@
"select"
"until"
"while"
] @repeat
] @keyword.repeat
[
"declare"
@ -115,7 +115,7 @@
(arithmetic_expansion "," @punctuation.delimiter)
(ternary_expression [ "?" ":" ] @conditional.ternary)
(ternary_expression [ "?" ":" ] @keyword.conditional.ternary)
(binary_expression operator: _ @operator)
(unary_expression operator: _ @operator)
@ -140,8 +140,8 @@
(command
argument: [
(word) @parameter
(concatenation (word) @parameter)
(word) @variable.parameter
(concatenation (word) @variable.parameter)
])
(number) @number
@ -149,7 +149,7 @@
(#lua-match? @number "^[0-9]+$"))
(file_redirect
destination: (word) @parameter)
destination: (word) @variable.parameter)
(file_descriptor) @operator
@ -175,12 +175,12 @@
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
(case_item
value: (word) @parameter)
value: (word) @variable.parameter)
[
(regex)
(extglob_pattern)
] @string.regex
] @string.regexp
((program . (comment) @preproc)
(#lua-match? @preproc "^#!/"))
((program . (comment) @keyword.directive)
(#lua-match? @keyword.directive "^#!/"))

View file

@ -21,13 +21,13 @@
;; Namespaces
(symbind
(symbol) @namespace
(symbol) @module
. (keyword))
;; Includes
((symbol) @include
(#any-of? @include "use" "import" "load"))
((symbol) @keyword.import
(#any-of? @keyword.import "use" "import" "load"))
;; Keywords
@ -43,13 +43,13 @@
((list
. (symbol) @keyword.function
. (symbol) @function
(symbol)? @parameter)
(symbol)? @variable.parameter)
(#any-of? @keyword.function "def" "defop" "defn" "fn"))
((cons
. (symbol) @keyword.function
. (symbol) @function
(symbol)? @parameter)
(symbol)? @variable.parameter)
(#any-of? @keyword.function "def" "defop" "defn" "fn"))
((symbol) @function.builtin
@ -60,13 +60,13 @@
;; Conditionals
((symbol) @conditional
(#any-of? @conditional "if" "case" "cond" "when"))
((symbol) @keyword.conditional
(#any-of? @keyword.conditional "if" "case" "cond" "when"))
;; Repeats
((symbol) @repeat
(#any-of? @repeat "each"))
((symbol) @keyword.repeat
(#any-of? @keyword.repeat "each"))
;; Operators
@ -89,7 +89,7 @@
(escape_sequence) @string.escape
(path) @text.uri @string.special
(path) @string.special.url
(number) @number

View file

@ -1,4 +1,4 @@
(date) @field
(date) @variable.member
(txn) @attribute
(account) @type
(amount) @number

View file

@ -23,10 +23,10 @@
(number) @number
(field
name: (identifier) @field)
name: (identifier) @variable.member)
(token
(identifier) @parameter)
(identifier) @variable.parameter)
[
(brace_word)
@ -36,7 +36,7 @@
[
(key_brace)
(key_paren)
] @symbol
] @string.special.symbol
(string
name: (identifier) @constant)

View file

@ -1,16 +1,16 @@
; Includes
(import_statement
"import" @include)
"import" @keyword.import)
(import_with_statement
"import" @include
"with" @include)
"import" @keyword.import
"with" @keyword.import)
; Namespaces
(module_declaration
(identifier) @namespace)
(identifier) @module)
; Builtins
@ -80,16 +80,16 @@
; Parameters
(parameter_declaration
(identifier) @parameter
(identifier) @variable.parameter
(_))
(call_expression
function: (_)
(arguments (identifier) @parameter))
(arguments (identifier) @variable.parameter))
(call_expression
function: (_)
(arguments (member_expression object: (identifier) @parameter)))
(arguments (member_expression object: (identifier) @variable.parameter)))
; Variables
@ -118,16 +118,16 @@
; Conditionals
"if" @conditional
"if" @keyword.conditional
(ternary_expression
"?" @conditional.ternary
":" @conditional.ternary)
"?" @keyword.conditional.ternary
":" @keyword.conditional.ternary)
; Loops
(for_statement
"for" @repeat
"for" @keyword.repeat
"in"
":" @punctuation.delimiter)
@ -179,8 +179,8 @@
(string) @string
(import_string
"'" @string
(import_name) @namespace
"@" @symbol
(import_name) @module
"@" @string.special.symbol
(import_version) @string.special)
(escape_sequence) @string.escape

View file

@ -6,7 +6,7 @@
"require"
"export"
"import"
] @include
] @keyword.import
; Keywords
@ -37,16 +37,16 @@
(yield "from" @keyword.return)
(future_import_statement
"from" @include
"from" @keyword.import
"__future__" @constant.builtin)
(import_from_statement "from" @include)
"import" @include
(import_from_statement "from" @keyword.import)
"import" @keyword.import
(aliased_import "as" @include)
(aliased_import "as" @keyword.import)
["if" "elif" "else"] @conditional
["if" "elif" "else"] @keyword.conditional
["for" "while" "break" "continue"] @repeat
["for" "while" "break" "continue"] @keyword.repeat
[
"try"
@ -54,13 +54,13 @@
"except*"
"raise"
"finally"
] @exception
] @keyword.exception
(raise_statement "from" @exception)
(raise_statement "from" @keyword.exception)
(try_statement
(else_clause
"else" @exception))
"else" @keyword.exception))
[
"addtask"
@ -73,7 +73,7 @@
[
"before"
"after"
] @storageclass
] @keyword.storage
[
"append"
@ -132,11 +132,11 @@
; Fields
(flag) @field
(flag) @variable.member
((attribute
attribute: (python_identifier) @field)
(#lua-match? @field "^[%l_].*$"))
attribute: (python_identifier) @variable.member)
(#lua-match? @variable.member "^[%l_].*$"))
; Functions
@ -145,7 +145,7 @@
(call
function: (attribute
attribute: (python_identifier) @method.call))
attribute: (python_identifier) @function.method.call))
((call
function: (python_identifier) @constructor)
@ -200,34 +200,34 @@
; Namespace
(inherit_path) @namespace
(inherit_path) @module
;; Normal parameters
(parameters
(python_identifier) @parameter)
(python_identifier) @variable.parameter)
;; Lambda parameters
(lambda_parameters
(python_identifier) @parameter)
(python_identifier) @variable.parameter)
(lambda_parameters
(tuple_pattern
(python_identifier) @parameter))
(python_identifier) @variable.parameter))
; Default parameters
(keyword_argument
name: (python_identifier) @parameter)
name: (python_identifier) @variable.parameter)
; Naming parameters on call-site
(default_parameter
name: (python_identifier) @parameter)
name: (python_identifier) @variable.parameter)
(typed_parameter
(python_identifier) @parameter)
(python_identifier) @variable.parameter)
(typed_default_parameter
(python_identifier) @parameter)
(python_identifier) @variable.parameter)
; Variadic parameters *args, **kwargs
(parameters
(list_splat_pattern ; *args
(python_identifier) @parameter))
(python_identifier) @variable.parameter))
(parameters
(dictionary_splat_pattern ; **kwargs
(python_identifier) @parameter))
(python_identifier) @variable.parameter))
;; Literals
@ -239,7 +239,7 @@
(#eq? @variable.builtin "cls"))
(integer) @number
(float) @float
(float) @number.float
; Operators
@ -309,7 +309,7 @@
"\""
] @string
(include_path) @string.special
(include_path) @string.special.path
[
(escape_sequence)

View file

@ -9,7 +9,7 @@
(boolean) @boolean
(using) @include
(using) @keyword.import
(template) @keyword
@ -34,11 +34,11 @@
(template_definition (template_name_qualifier) @type.qualifier)
(import_statement (gobject_library) @namespace)
(import_statement (gobject_library) @module)
(import_statement (version_number) @float)
(import_statement (version_number) @number.float)
(float) @float
(float) @number.float
(number) @number
[

View file

@ -1,4 +1,4 @@
; Lower priority to prefer @parameter when identifier appears in parameter_declaration.
; Lower priority to prefer @variable.parameter when identifier appears in parameter_declaration.
((identifier) @variable (#set! "priority" 95))
(preproc_def (preproc_arg) @variable)
@ -27,14 +27,14 @@
"do"
"continue"
"break"
] @repeat
] @keyword.repeat
[
"if"
"else"
"case"
"switch"
] @conditional
] @keyword.conditional
[
"#if"
@ -46,11 +46,11 @@
"#elifdef"
"#elifndef"
(preproc_directive)
] @preproc
] @keyword.directive
"#define" @define
"#define" @keyword.directive.define
"#include" @include
"#include" @keyword.import
[ ";" ":" "," "::" ] @punctuation.delimiter
@ -111,7 +111,7 @@
(false)
] @boolean
(conditional_expression [ "?" ":" ] @conditional.ternary)
(conditional_expression [ "?" ":" ] @keyword.conditional.ternary)
(string_literal) @string
(system_lib_string) @string
@ -140,7 +140,7 @@
(type_descriptor)
] @type
(storage_class_specifier) @storageclass
(storage_class_specifier) @keyword.storage
[
(type_qualifier)
@ -149,7 +149,7 @@
] @type.qualifier
(linkage_specification
"extern" @storageclass)
"extern" @keyword.storage)
(type_definition
declarator: (type_identifier) @type.definition)
@ -236,13 +236,13 @@
;; Parameters
(parameter_declaration
declarator: (identifier) @parameter)
declarator: (identifier) @variable.parameter)
(parameter_declaration
declarator: (array_declarator) @parameter)
declarator: (array_declarator) @variable.parameter)
(parameter_declaration
declarator: (pointer_declarator) @parameter)
declarator: (pointer_declarator) @variable.parameter)
; K&R functions
; To enable support for K&R functions,
@ -250,24 +250,24 @@
; They are commented out as they'll conflict with C++
; Note that you'll need to have `; extends` at the top of your query file.
;
; (parameter_list (identifier) @parameter)
; (parameter_list (identifier) @variable.parameter)
;
; (function_definition
; declarator: _
; (declaration
; declarator: (identifier) @parameter))
; declarator: (identifier) @variable.parameter))
;
; (function_definition
; declarator: _
; (declaration
; declarator: (array_declarator) @parameter))
; declarator: (array_declarator) @variable.parameter))
;
; (function_definition
; declarator: _
; (declaration
; declarator: (pointer_declarator) @parameter))
; declarator: (pointer_declarator) @variable.parameter))
(preproc_params (identifier) @parameter)
(preproc_params (identifier) @variable.parameter)
[
"__attribute__"

View file

@ -5,10 +5,10 @@
(#has-ancestor? @keyword accessor_declaration))
(method_declaration
name: (identifier) @method)
name: (identifier) @function.method)
(local_function_statement
name: (identifier) @method)
name: (identifier) @function.method)
(method_declaration
type: (identifier) @type)
@ -23,41 +23,41 @@
(invocation_expression
(member_access_expression
name: (identifier) @method.call))
name: (identifier) @function.method.call))
(invocation_expression
function: (conditional_access_expression
(member_binding_expression
name: (identifier) @method.call)))
name: (identifier) @function.method.call)))
(namespace_declaration
name: [(qualified_name) (identifier)] @namespace)
name: [(qualified_name) (identifier)] @module)
(qualified_name
(identifier) @type)
(invocation_expression
(identifier) @method.call)
(identifier) @function.method.call)
(field_declaration
(variable_declaration
(variable_declarator
(identifier) @field)))
(identifier) @variable.member)))
(initializer_expression
(assignment_expression
left: (identifier) @field))
left: (identifier) @variable.member))
(parameter_list
(parameter
name: (identifier) @parameter))
name: (identifier) @variable.parameter))
(parameter_list
(parameter
type: (identifier) @type))
(integer_literal) @number
(real_literal) @float
(real_literal) @number.float
(null_literal) @constant.builtin
(character_literal) @character
@ -154,12 +154,12 @@
; Generic Method invocation with generic type
(invocation_expression
function: (generic_name
. (identifier) @method.call))
. (identifier) @function.method.call))
(invocation_expression
(member_access_expression
(generic_name
(identifier) @method)))
(identifier) @function.method)))
(base_list
(identifier) @type)
@ -194,10 +194,10 @@
(identifier) @type)
(name_colon
(identifier) @parameter)
(identifier) @variable.parameter)
(warning_directive) @text.warning
(error_directive) @exception
(warning_directive) @comment.warning
(error_directive) @keyword.exception
(define_directive
(identifier) @constant) @constant.macro
@ -231,7 +231,7 @@
(elif_directive)
(else_directive)
(endif_directive)
] @conditional
] @keyword.conditional
(if_directive
(identifier) @constant)
@ -245,14 +245,14 @@
"continue"
"goto"
"foreach"
] @repeat
] @keyword.repeat
[
"try"
"catch"
"throw"
"finally"
] @exception
] @keyword.exception
[
"+"
@ -304,7 +304,7 @@
":"
] @punctuation.delimiter
(conditional_expression ["?" ":"] @conditional.ternary)
(conditional_expression ["?" ":"] @keyword.conditional.ternary)
[
"["
@ -325,10 +325,10 @@
[
"using"
"as"
] @include
] @keyword.import
(alias_qualified_name
(identifier "global") @include)
(identifier "global") @keyword.import)
[
"with"
@ -385,7 +385,7 @@
"static"
"volatile"
"required"
] @storageclass
] @keyword.storage
[
"abstract"

View file

@ -3,17 +3,17 @@
[
"%builtins"
"%lang"
] @preproc
] @keyword.directive
; Includes
(import_statement [ "from" "import" ] @include module_name: (dotted_name (identifier) @namespace . ))
(import_statement [ "from" "import" ] @keyword.import module_name: (dotted_name (identifier) @module . ))
[
"as"
"use"
"mod"
] @include
] @keyword.import
; Variables
@ -21,24 +21,24 @@
; Namespaces
(namespace_definition (identifier) @namespace)
(namespace_definition (identifier) @module)
(mod_item
name: (identifier) @namespace)
name: (identifier) @module)
(use_list (self) @namespace)
(use_list (self) @module)
(scoped_use_list (self) @namespace)
(scoped_use_list (self) @module)
(scoped_identifier
path: (identifier) @namespace)
path: (identifier) @module)
(scoped_identifier
(scoped_identifier
name: (identifier) @namespace))
name: (identifier) @module))
(scoped_type_identifier
path: (identifier) @namespace)
path: (identifier) @module)
((scoped_identifier
path: (identifier) @type)
@ -65,13 +65,13 @@
(#lua-match? @constant "^[A-Z]"))
(scoped_use_list
path: (identifier) @namespace)
path: (identifier) @module)
(scoped_use_list
path: (scoped_identifier
(identifier) @namespace))
(identifier) @module))
(use_list (scoped_identifier (identifier) @namespace . (_)))
(use_list (scoped_identifier (identifier) @module . (_)))
(use_list (identifier) @type (#lua-match? @type "^[A-Z]"))
@ -125,47 +125,47 @@
[
"tempvar"
"extern"
] @storageclass
] @keyword.storage
[
"if"
"else"
"match"
] @conditional
] @keyword.conditional
[
"loop"
] @repeat
] @keyword.repeat
[
"assert"
"static_assert"
"nopanic"
] @exception
] @keyword.exception
; Fields
(implicit_arguments (typed_identifier (identifier) @field))
(implicit_arguments (typed_identifier (identifier) @variable.member))
(member_expression "." (identifier) @field)
(member_expression "." (identifier) @variable.member)
(call_expression (assignment_expression left: (identifier) @field))
(call_expression (assignment_expression left: (identifier) @variable.member))
(tuple_expression (assignment_expression left: (identifier) @field))
(tuple_expression (assignment_expression left: (identifier) @variable.member))
(field_identifier) @field
(field_identifier) @variable.member
(shorthand_field_initializer (identifier) @field)
(shorthand_field_initializer (identifier) @variable.member)
; Parameters
(arguments (typed_identifier (identifier) @parameter))
(arguments (typed_identifier (identifier) @variable.parameter))
(call_expression (tuple_expression (assignment_expression left: (identifier) @parameter)))
(call_expression (tuple_expression (assignment_expression left: (identifier) @variable.parameter)))
(return_type (tuple_type (named_type . (identifier) @parameter)))
(return_type (tuple_type (named_type . (identifier) @variable.parameter)))
(parameter (identifier) @parameter)
(parameter (identifier) @variable.parameter)
; Builtins
@ -202,7 +202,7 @@
; Types
(struct_definition . (identifier) @type (typed_identifier (identifier) @field)?)
(struct_definition . (identifier) @type (typed_identifier (identifier) @variable.member)?)
(named_type (identifier) @type .)

View file

@ -3,7 +3,7 @@
[
(unique_id)
(top_level_annotation_body)
] @preproc
] @keyword.directive
; Includes
@ -12,9 +12,9 @@
"$import"
"embed"
"using"
] @include
] @keyword.import
(import_path) @string @text.uri
(import_path) @string.special.path
; Keywords
@ -53,11 +53,11 @@
[
(annotation_definition_identifier)
(method_identifier)
] @method
] @function.method
; Fields
(field_identifier) @field
(field_identifier) @variable.member
; Properties
@ -68,9 +68,9 @@
[
(param_identifier)
(return_identifier)
] @parameter
] @variable.parameter
(annotation_target) @parameter.builtin
(annotation_target) @variable.parameter.builtin
; Constants
@ -110,7 +110,7 @@
(namespace)
] @string
(namespace) @text.underline
(namespace) @string.special
(escape_sequence) @string.escape
@ -118,11 +118,11 @@
(number) @number
(float) @float
(float) @number.float
(boolean) @boolean
(data_hex) @symbol
(data_hex) @string.special.symbol
; Punctuation

View file

@ -12,14 +12,14 @@
[":" ","] @punctuation.delimiter
(["\"" "'"] @punctuation.special @conceal
(["\"" "'"] @punctuation.special
(#set! conceal ""))
["%" "?" "#"] @character.special
;; Entities
(intent) @namespace
(intent) @module
(slot) @type
@ -37,13 +37,13 @@
;; Import
"import" @include
"import" @keyword.import
(file) @string.special
(file) @string.special.path
;; Text
(word) @text @spell
(word) @spell
;; Comment

View file

@ -17,14 +17,14 @@
(dis_expr) @comment
(#set! "priority" 105) ; Higher priority to mark the whole sexpr as a comment
)
(kwd_lit) @symbol
(kwd_lit) @string.special.symbol
(str_lit) @string
(num_lit) @number
(char_lit) @character
(bool_lit) @boolean
(nil_lit) @constant.builtin
(comment) @comment @spell
(regex_lit) @string.regex
(regex_lit) @string.regexp
["'" "`"] @string.escape
@ -49,13 +49,13 @@
; Quoted symbols
(quoting_lit
(sym_lit) @symbol)
(sym_lit) @string.special.symbol)
(syn_quoting_lit
(sym_lit) @symbol)
(sym_lit) @string.special.symbol)
; Used in destructure pattern
((sym_lit) @parameter
(#lua-match? @parameter "^[&]"))
((sym_lit) @variable.parameter
(#lua-match? @variable.parameter "^[&]"))
; Inline function variables
((sym_lit) @variable.builtin
@ -102,19 +102,19 @@
; Interop
; (.instanceMember instance args*)
; (.instanceMember Classname args*)
((sym_lit) @method
(#lua-match? @method "^%.[^-]"))
((sym_lit) @function.method
(#lua-match? @function.method "^%.[^-]"))
; (.-instanceField instance)
((sym_lit) @field
(#lua-match? @field "^%.%-.*"))
((sym_lit) @variable.member
(#lua-match? @variable.member "^%.%-.*"))
; Classname/staticField
((sym_lit) @field
(#lua-match? @field "^[%u].*/.+"))
((sym_lit) @variable.member
(#lua-match? @variable.member "^[%u].*/.+"))
; (Classname/staticMethod args*)
(list_lit
.
(sym_lit) @method
(#lua-match? @method "^[%u].*/.+"))
(sym_lit) @function.method
(#lua-match? @function.method "^[%u].*/.+"))
;; TODO: Special casing for the `.` macro
; Operators
@ -145,29 +145,29 @@
(#any-of? @comment "comment"))
; Conditionals
((sym_lit) @conditional
(#any-of? @conditional
((sym_lit) @keyword.conditional
(#any-of? @keyword.conditional
"case" "cond" "cond->" "cond->>" "condp"))
((sym_lit) @conditional
(#any-of? @conditional
((sym_lit) @keyword.conditional
(#any-of? @keyword.conditional
"if" "if-let" "if-not" "if-some"))
((sym_lit) @conditional
(#any-of? @conditional
((sym_lit) @keyword.conditional
(#any-of? @keyword.conditional
"when" "when-first" "when-let" "when-not" "when-some"))
; Repeats
((sym_lit) @repeat
(#any-of? @repeat
((sym_lit) @keyword.repeat
(#any-of? @keyword.repeat
"doseq" "dotimes" "for" "loop" "recur" "while"))
; Exception
((sym_lit) @exception
(#any-of? @exception
((sym_lit) @keyword.exception
(#any-of? @keyword.exception
"throw" "try" "catch" "finally"))
; Includes
((sym_lit) @include
(#any-of? @include "ns" "import" "require" "use"))
((sym_lit) @keyword.import
(#any-of? @keyword.import "ns" "import" "require" "use"))
; Builtin macros
;; TODO: Do all these items belong here?
@ -350,18 +350,18 @@
;; TODO: Reproduce bug and file ticket
;.
;[(vec_lit
; (sym_lit)* @parameter)
; (sym_lit)* @variable.parameter)
; (list_lit
; (vec_lit
; (sym_lit)* @parameter))])
; (sym_lit)* @variable.parameter))])
;[((list_lit
; (vec_lit
; (sym_lit) @parameter)
; (sym_lit) @variable.parameter)
; (_)
; +
; ((vec_lit
; (sym_lit) @parameter)
; (sym_lit) @variable.parameter)
; (_)))
@ -378,4 +378,4 @@
(sym_lit) @_include
(#eq? @_include "ns")
.
(sym_lit) @namespace)
(sym_lit) @module)

View file

@ -21,7 +21,7 @@
(normal_command (identifier) @function)
["ENV" "CACHE"] @storageclass
["ENV" "CACHE"] @keyword.storage
["$" "{" "}" "<" ">"] @punctuation.special
["(" ")"] @punctuation.bracket
@ -37,18 +37,18 @@
(elseif)
(else)
(endif)
] @conditional
] @keyword.conditional
[
(foreach)
(endforeach)
(while)
(endwhile)
] @repeat
] @keyword.repeat
(normal_command
(identifier) @repeat
(#match? @repeat "\\c^(continue|break)$")
(identifier) @keyword.repeat
(#match? @keyword.repeat "\\c^(continue|break)$")
)
(normal_command
(identifier) @keyword.return
@ -59,7 +59,7 @@
(function)
(argument_list
. (argument) @function
(argument)* @parameter
(argument)* @variable.parameter
)
)
@ -67,7 +67,7 @@
(macro)
(argument_list
. (argument) @function.macro
(argument)* @parameter
(argument)* @variable.parameter
)
)
@ -134,7 +134,7 @@
(argument_list
. (argument)
(
(argument) @_cache @storageclass
(argument) @_cache @keyword.storage
.
(argument) @_type @type
(#any-of? @_cache "CACHE")
@ -148,8 +148,8 @@
(#match? @_function "\\c^unset$")
(argument_list
. (argument)
(argument) @storageclass
(#any-of? @storageclass "CACHE" "PARENT_SCOPE")
(argument) @keyword.storage
(#any-of? @keyword.storage "CACHE" "PARENT_SCOPE")
)
)
@ -213,5 +213,5 @@
(escape_sequence) @string.escape
((source_file . (line_comment) @preproc)
(#lua-match? @preproc "^#!/"))
((source_file . (line_comment) @keyword.directive)
(#lua-match? @keyword.directive "^#!/"))

View file

@ -1,41 +1,43 @@
((tag
(name) @text.todo @nospell
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
(name) @comment.todo @nospell
("(" @punctuation.bracket
(user) @constant
")" @punctuation.bracket)?
":" @punctuation.delimiter)
(#any-of? @text.todo "TODO" "WIP"))
(#any-of? @comment.todo "TODO" "WIP"))
("text" @text.todo @nospell
(#any-of? @text.todo "TODO" "WIP"))
("text" @comment.todo @nospell
(#any-of? @comment.todo "TODO" "WIP"))
((tag
(name) @text.note @nospell
(name) @comment.note @nospell
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
":" @punctuation.delimiter)
(#any-of? @text.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST"))
(#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST"))
("text" @text.note @nospell
(#any-of? @text.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST"))
("text" @comment.note @nospell
(#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST"))
((tag
(name) @text.warning @nospell
(name) @comment.warning @nospell
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
":" @punctuation.delimiter)
(#any-of? @text.warning "HACK" "WARNING" "WARN" "FIX"))
(#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX"))
("text" @text.warning @nospell
(#any-of? @text.warning "HACK" "WARNING" "WARN" "FIX"))
("text" @comment.warning @nospell
(#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX"))
((tag
(name) @text.danger @nospell
(name) @comment.error @nospell
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
":" @punctuation.delimiter)
(#any-of? @text.danger "FIXME" "BUG" "ERROR"))
(#any-of? @comment.error "FIXME" "BUG" "ERROR"))
("text" @text.danger @nospell
(#any-of? @text.danger "FIXME" "BUG" "ERROR"))
("text" @comment.error @nospell
(#any-of? @comment.error "FIXME" "BUG" "ERROR"))
; Issue number (#123)
("text" @number
(#lua-match? @number "^#[0-9]+$"))
((uri) @text.uri @nospell)
((uri) @string.special.url @nospell)

View file

@ -10,14 +10,14 @@
(defun_header
function_name: (_) @function)
(defun_header
lambda_list: (list_lit (sym_lit) @parameter))
lambda_list: (list_lit (sym_lit) @variable.parameter))
(defun_header
keyword: (defun_keyword "defmethod")
lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @symbol)))
lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @string.special.symbol)))
(defun_header
lambda_list: (list_lit (list_lit . (sym_lit) @parameter . (_))))
lambda_list: (list_lit (list_lit . (sym_lit) @variable.parameter . (_))))
(defun_header
specifier: (sym_lit) @symbol)
specifier: (sym_lit) @string.special.symbol)
[":" "::" "."] @punctuation.special
@ -51,14 +51,14 @@
] @function.macro
"=" @operator
(include_reader_macro) @symbol
(include_reader_macro) @string.special.symbol
["#C" "#c"] @number
[(kwd_lit) (self_referential_reader_macro)] @symbol
[(kwd_lit) (self_referential_reader_macro)] @string.special.symbol
(package_lit
package: (_) @namespace)
"cl" @namespace
package: (_) @module)
"cl" @module
(str_lit) @string
@ -119,10 +119,10 @@
(#lua-match? @constant "^[+].+[+]$"))
(var_quoting_lit
marker: "#'" @symbol
value: (_) @symbol)
marker: "#'" @string.special.symbol
value: (_) @string.special.symbol)
["#" "#p" "#P"] @symbol
["#" "#p" "#P"] @string.special.symbol
(list_lit
.
@ -137,8 +137,8 @@
(#match? @operator "^([+*-+=<>]|<=|>=|/=)$"))
((sym_lit) @symbol
(#lua-match? @symbol "^[&]"))
((sym_lit) @string.special.symbol
(#lua-match? @string.special.symbol "^[&]"))
[(array_dimension) "#0A" "#0a"] @number

View file

@ -2,21 +2,21 @@
(ingredient
"@" @tag
(name)? @text.title
(name)? @markup.heading
(amount
(quantity)? @number
(units)? @tag.attribute)?)
(timer
"~" @tag
(name)? @text.title
(name)? @markup.heading
(amount
(quantity)? @number
(units)? @tag.attribute)?)
(cookware
"#" @tag
(name)? @text.title
(name)? @markup.heading
(amount
(quantity)? @number
(units)? @tag.attribute)?)

View file

@ -15,6 +15,6 @@
(string) @string
(integer) @number
(float) @float
(float) @number.float
(boolean) @boolean
(null) @keyword

View file

@ -19,7 +19,7 @@
(number) @number
(float) @float
(float) @number.float
(boolean) @boolean
@ -38,7 +38,7 @@
[ "<" ">" ] @punctuation.bracket
(("\"" @conceal)
(("\"" @string)
(#set! conceal ""))
; Comments

View file

@ -1,33 +1,33 @@
; inherits: c
((identifier) @field
(#lua-match? @field "^m_.*$"))
((identifier) @variable.member
(#lua-match? @variable.member "^m_.*$"))
(parameter_declaration
declarator: (reference_declarator) @parameter)
declarator: (reference_declarator) @variable.parameter)
; function(Foo ...foo)
(variadic_parameter_declaration
declarator: (variadic_declarator
(_) @parameter))
(_) @variable.parameter))
; int foo = 0
(optional_parameter_declaration
declarator: (_) @parameter)
declarator: (_) @variable.parameter)
;(field_expression) @parameter ;; How to highlight this?
;(field_expression) @variable.parameter ;; How to highlight this?
(((field_expression
(field_identifier) @method)) @_parent
(field_identifier) @function.method)) @_parent
(#has-parent? @_parent template_method function_declarator))
(field_declaration
(field_identifier) @field)
(field_identifier) @variable.member)
(field_initializer
(field_identifier) @property)
(function_declarator
declarator: (field_identifier) @method)
declarator: (field_identifier) @function.method)
(concept_definition
name: (identifier) @type.definition)
@ -37,17 +37,17 @@
(auto) @type.builtin
(namespace_identifier) @namespace
(namespace_identifier) @module
((namespace_identifier) @type
(#lua-match? @type "^[%u]"))
(case_statement
value: (qualified_identifier (identifier) @constant))
(using_declaration . "using" . "namespace" . [(qualified_identifier) (identifier)] @namespace)
(using_declaration . "using" . "namespace" . [(qualified_identifier) (identifier)] @module)
(destructor_name
(identifier) @method)
(identifier) @function.method)
; functions
(function_declarator
@ -125,10 +125,10 @@
; methods
(function_declarator
(template_method
(field_identifier) @method))
(field_identifier) @function.method))
(call_expression
(field_expression
(field_identifier) @method.call))
(field_identifier) @function.method.call))
; constructors
@ -176,7 +176,7 @@
"catch"
"noexcept"
"throw"
] @exception
] @keyword.exception
[

View file

@ -9,7 +9,7 @@
(from)
] @keyword
"@import" @include
"@import" @keyword.import
(comment) @comment @spell
@ -57,7 +57,7 @@
(attribute_name)
] @property
(namespace_name) @namespace
(namespace_name) @module
((property_name) @type.definition
(#lua-match? @type.definition "^[-][-]"))

View file

@ -8,6 +8,6 @@
"__global__"
"__forceinline__"
"__noinline__"
] @storageclass
] @keyword.storage
"__launch_bounds__" @type.qualifier

View file

@ -3,18 +3,18 @@
[
"package"
"import"
] @include
] @keyword.import
; Namespaces
(package_identifier) @namespace
(package_identifier) @module
(import_spec ["." "_"] @punctuation.special)
[
(attr_path)
(package_path)
] @text.uri ;; In attributes
] @string.special.url ;; In attributes
; Attributes
@ -22,13 +22,13 @@
; Conditionals
"if" @conditional
"if" @keyword.conditional
; Repeats
[
"for"
] @repeat
] @keyword.repeat
(for_clause "_" @punctuation.special)
@ -69,7 +69,7 @@
(field
(label
(identifier) @field))
(identifier) @variable.member))
(selector_expression
(_)
@ -135,11 +135,11 @@
(number) @number
(float) @float
(float) @number.float
(si_unit
(float)
(_) @symbol)
(_) @string.special.symbol)
(boolean) @boolean

View file

@ -59,7 +59,7 @@
(integer_literal) @number
(float_literal) @float
(float_literal) @number.float
[
"true"
@ -88,12 +88,12 @@
(parameter
(var_declarator
(identifier) @parameter
(identifier) @variable.parameter
)
)
(function_literal
(identifier) @parameter
(identifier) @variable.parameter
)
(constructor
@ -112,7 +112,7 @@
"else"
"if"
"switch"
] @conditional
] @keyword.conditional
[
"break"
@ -122,7 +122,7 @@
"foreach"
"foreach_reverse"
"while"
] @repeat
] @keyword.repeat
[
"__parameters"
@ -209,7 +209,7 @@
"finally"
"throw"
"try"
] @exception
] @keyword.exception
"null" @constant.builtin
@ -218,7 +218,7 @@
"const"
"immutable"
"shared"
] @storageclass
] @keyword.storage
[
"abstract"
@ -241,11 +241,11 @@
. (identifier) @type.definition)
(module_declaration
"module" @include
"module" @keyword.import
)
(import_declaration
"import" @include
"import" @keyword.import
)
(type) @type
@ -272,8 +272,8 @@
(fundamental_type) @type.builtin
(module_fully_qualified_name (packages (package_name) @namespace))
(module_name) @namespace
(module_fully_qualified_name (packages (package_name) @module))
(module_name) @module
(at_attribute) @attribute

View file

@ -84,11 +84,11 @@
(scoped_identifier
scope: (identifier) @type)
(function_signature
name: (identifier) @method)
name: (identifier) @function.method)
(getter_signature
(identifier) @method)
(identifier) @function.method)
(setter_signature
name: (identifier) @method)
name: (identifier) @function.method)
(enum_declaration
name: (identifier) @type)
(enum_constant
@ -131,10 +131,10 @@
; Parameters
; --------------------
(formal_parameter
name: (identifier) @parameter)
name: (identifier) @variable.parameter)
(named_argument
(label (identifier) @parameter))
(label (identifier) @variable.parameter))
; Literals
; --------------------
@ -147,7 +147,7 @@
; (hex_floating_point_literal)
] @number
(symbol_literal) @symbol
(symbol_literal) @string.special.symbol
(string_literal) @string
(true) @boolean
(false) @boolean
@ -165,7 +165,7 @@
"as"
"show"
"hide"
] @include
] @keyword.import
; Reserved words (cannot be used as identifiers)
[
@ -257,7 +257,7 @@
"static"
"typedef"))
["if" "else" "switch" "default"] @conditional
["if" "else" "switch" "default"] @keyword.conditional
[
"try"
@ -265,6 +265,6 @@
"catch"
"finally"
(break_statement)
] @exception
] @keyword.exception
["do" "while" "continue" "for"] @repeat
["do" "while" "continue" "for"] @keyword.repeat

View file

@ -3,7 +3,7 @@
[
(preproc_include)
(dtsi_include)
] @include
] @keyword.import
(preproc_def) @constant.macro
(preproc_function_def) @function.macro
@ -22,7 +22,7 @@
(integer_literal) @number
(identifier) @variable
(node (identifier) @namespace)
(node (identifier) @module)
(property (identifier) @property)
(labeled_item (identifier) @label)
(call_expression (identifier) @function.macro)

View file

@ -2,11 +2,11 @@
;; Imports
(missing_import) @include
(missing_import) @keyword.import
(local_import) @string.special.path
(http_import) @string @text.uri
(http_import) @string.special.url
[
(env_variable)
@ -29,7 +29,7 @@
;; Parameters
(lambda_expression label: (label) @parameter)
(lambda_expression label: (label) @variable.parameter)
;; Variables
@ -44,13 +44,13 @@
; Fields
(record_literal_entry (label) @field)
(record_literal_entry (label) @variable.member)
(record_type_entry (label) @field)
(record_type_entry (label) @variable.member)
(selector
(selector_dot)
(_) @field)
(_) @variable.member)
;; Keywords
@ -141,7 +141,7 @@
"if"
"then"
"else"
] @conditional
] @keyword.conditional
;; Literals
@ -157,7 +157,7 @@
(natural_literal)
] @number
(double_literal) @float
(double_literal) @number.float
(boolean_literal) @boolean

View file

@ -1,5 +1,5 @@
[(addition) (new_file)] @text.diff.add
[(deletion) (old_file)] @text.diff.delete
[(addition) (new_file)] @diff.plus
[(deletion) (old_file)] @diff.minus
(commit) @constant
(location) @attribute

View file

@ -33,12 +33,12 @@
(subgraph
id: (id
(identifier) @namespace)
(identifier) @module)
)
(attribute
name: (id
(identifier) @field)
(identifier) @variable.member)
)
(attribute
@ -48,6 +48,6 @@
(comment) @comment
(preproc) @preproc
(preproc) @keyword.directive
(comment) @spell

View file

@ -10,14 +10,14 @@
((tag
(tag_name) @_param
(identifier) @parameter)
(identifier) @variable.parameter)
(#any-of? @_param "@param" "\\param"))
(function (identifier) @function)
(function_link) @function
(emphasis) @text.emphasis
(emphasis) @markup.italic
[
"\\a"
@ -30,7 +30,7 @@
"in"
"out"
"inout"
] @storageclass
] @keyword.storage
"~" @operator

View file

@ -1,6 +1,6 @@
;; XML declaration
(XMLDecl "xml" @preproc)
(XMLDecl "xml" @keyword.directive)
(XMLDecl [ "version" "encoding" ] @tag.attribute)
@ -10,12 +10,12 @@
;; Processing instructions
(PI) @preproc
(PI) @keyword.directive
;; Element declaration
(elementdecl
"ELEMENT" @define
"ELEMENT" @keyword.directive.define
(Name) @tag)
(contentspec
@ -30,7 +30,7 @@
;; Entity declaration
(GEDecl
"ENTITY" @define
"ENTITY" @keyword.directive.define
(Name) @constant)
(GEDecl (EntityValue) @string)
@ -42,7 +42,7 @@
;; Parsed entity declaration
(PEDecl
"ENTITY" @define
"ENTITY" @keyword.directive.define
"%" @operator
(Name) @function.macro)
@ -51,18 +51,18 @@
;; Notation declaration
(NotationDecl
"NOTATION" @preproc
"NOTATION" @keyword.directive
(Name) @label)
((NotationDecl
(ExternalID
(SystemLiteral (URI) @string.special))
(SystemLiteral (URI) @string.special.url))
(#set! "priority" 105)))
;; Attlist declaration
(AttlistDecl
"ATTLIST" @define
"ATTLIST" @keyword.directive.define
(Name) @tag)
(AttDef (Name) @tag.attribute)
@ -100,7 +100,7 @@
(PubidLiteral) @string.special
(SystemLiteral (URI) @text.uri)
(SystemLiteral (URI) @string.special.url)
;; Delimiters & punctuation
@ -114,6 +114,6 @@
;; Misc
[ "INCLUDE" "IGNORE" ] @include
[ "INCLUDE" "IGNORE" ] @keyword.import
(Comment) @comment @spell

View file

@ -13,8 +13,8 @@
((identifier) @type
(#lua-match? @type "^%u"))
((identifier) @symbol
(#lua-match? @symbol "^%l"))
((identifier) @string.special.symbol
(#lua-match? @string.special.symbol "^%l"))
((identifier) @constant
(#lua-match? @constant "^%u[%u%d_]+$"))

View file

@ -86,25 +86,25 @@
(generator_function_declaration
name: (identifier) @function)
(method_definition
name: [(property_identifier) (private_property_identifier)] @method)
name: [(property_identifier) (private_property_identifier)] @function.method)
(method_definition
name: (property_identifier) @constructor
(#eq? @constructor "constructor"))
(pair
key: (property_identifier) @method
key: (property_identifier) @function.method
value: (function))
(pair
key: (property_identifier) @method
key: (property_identifier) @function.method
value: (arrow_function))
(assignment_expression
left: (member_expression
property: (property_identifier) @method)
property: (property_identifier) @function.method)
right: (arrow_function))
(assignment_expression
left: (member_expression
property: (property_identifier) @method)
property: (property_identifier) @function.method)
right: (function))
(variable_declarator
@ -129,13 +129,13 @@
(call_expression
function: (member_expression
property: [(property_identifier) (private_property_identifier)] @method.call))
property: [(property_identifier) (private_property_identifier)] @function.method.call))
; Builtins
;---------
((identifier) @namespace.builtin
(#eq? @namespace.builtin "Intl"))
((identifier) @module.builtin
(#eq? @module.builtin "Intl"))
((identifier) @function.builtin
(#any-of? @function.builtin
@ -159,7 +159,7 @@
; Variables
;----------
(namespace_import
(identifier) @namespace)
(identifier) @module)
; Decorators
;----------
@ -192,15 +192,15 @@
((comment) @comment.documentation
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
(hash_bang_line) @preproc
(hash_bang_line) @keyword.directive
((string_fragment) @preproc
(#eq? @preproc "use strict"))
((string_fragment) @keyword.directive
(#eq? @keyword.directive "use strict"))
(string) @string
(template_string) @string
(escape_sequence) @string.escape
(regex_pattern) @string.regex
(regex_pattern) @string.regexp
(regex_flags) @character.special
(regex "/" @punctuation.bracket) ; Regex delimiters
@ -266,7 +266,7 @@
] @operator
(binary_expression "/" @operator)
(ternary_expression ["?" ":"] @conditional.ternary)
(ternary_expression ["?" ":"] @keyword.conditional.ternary)
(unary_expression ["!" "~" "-" "+"] @operator)
(unary_expression ["delete" "void"] @keyword.operator)
@ -289,17 +289,17 @@
"else"
"switch"
"case"
] @conditional
] @keyword.conditional
[
"import"
"from"
] @include
] @keyword.import
(export_specifier "as" @include)
(import_specifier "as" @include)
(namespace_export "as" @include)
(namespace_import "as" @include)
(export_specifier "as" @keyword.import)
(import_specifier "as" @keyword.import)
(namespace_export "as" @keyword.import)
(namespace_import "as" @keyword.import)
[
"for"
@ -307,7 +307,7 @@
"do"
"while"
"continue"
] @repeat
] @keyword.repeat
[
"break"
@ -352,9 +352,9 @@
"try"
"catch"
"finally"
] @exception
] @keyword.exception
(export_statement
"default" @keyword)
(switch_default
"default" @conditional)
"default" @keyword.conditional)

View file

@ -40,7 +40,7 @@
(quoted_atom)
(keyword)
(quoted_keyword)
] @symbol
] @string.special.symbol
; Interpolation
(interpolation ["#{" "}"] @string.special)
@ -52,7 +52,7 @@
(integer) @number
; Floats
(float) @float
(float) @number.float
; Characters
[

View file

@ -16,7 +16,7 @@
"else"
(case)
(of)
] @conditional
] @keyword.conditional
[
"let"
@ -32,7 +32,7 @@
[
(import)
(exposing)
] @include
] @keyword.import
; Punctuation
@ -79,14 +79,14 @@
(lower_case_identifier) @variable)
(value_qid
((dot) (lower_case_identifier) @field))
((dot) (lower_case_identifier) @variable.member))
(field_access_expr
((dot) (lower_case_identifier) @field))
((dot) (lower_case_identifier) @variable.member))
(function_declaration_left
(anything_pattern (underscore) @parameter))
(anything_pattern (underscore) @variable.parameter))
(function_declaration_left
(lower_pattern (lower_case_identifier) @parameter))
(lower_pattern (lower_case_identifier) @variable.parameter))
; Functions
@ -136,13 +136,13 @@
;--------
(module_declaration
(upper_case_qid (upper_case_identifier) @namespace))
(upper_case_qid (upper_case_identifier) @module))
(import_clause
(upper_case_qid (upper_case_identifier) @namespace))
(upper_case_qid (upper_case_identifier) @module))
(as_clause
(upper_case_identifier) @namespace)
(upper_case_identifier) @module)
(value_expr
(value_qid (upper_case_identifier) @namespace))
(value_qid (upper_case_identifier) @module))
; Types

View file

@ -11,11 +11,11 @@
; Method
(method) @method
(method) @function.method
; Parameter
(parameter) @parameter
(parameter) @variable.parameter
; Variables

View file

@ -1,21 +1,21 @@
(comment) @comment @spell
["if" "elif"] @conditional
(if (else "else" @conditional))
["if" "elif"] @keyword.conditional
(if (else "else" @keyword.conditional))
["while" "for"] @repeat
(while (else "else" @repeat))
(for (else "else" @repeat))
["while" "for"] @keyword.repeat
(while (else "else" @keyword.repeat))
(for (else "else" @keyword.repeat))
["try" "catch" "finally"] @exception
(try (else "else" @exception))
["try" "catch" "finally"] @keyword.exception
(try (else "else" @keyword.exception))
"use" @include
(import (bareword) @string.special)
"use" @keyword.import
(import (bareword) @string.special.path)
(wildcard ["*" "**" "?"] @character.special)
(command argument: (bareword) @parameter)
(command argument: (bareword) @variable.parameter)
(command head: (identifier) @function.call)
((command head: (identifier) @keyword.return)
(#eq? @keyword.return "return"))
@ -34,7 +34,7 @@
"fn" @keyword.function
(identifier) @function)
(parameter_list) @parameter
(parameter_list) @variable.parameter
(parameter_list "|" @punctuation.bracket)
["var" "set" "tmp" "del"] @keyword

View file

@ -3,7 +3,7 @@
(char) @character
(integer) @number
(float) @float
(float) @number.float
(comment) @comment @spell
@ -70,12 +70,12 @@
"end"
"maybe"
"else"
] @conditional
] @keyword.conditional
[
"catch"
"try"
] @exception
] @keyword.exception
((atom) @boolean (#any-of? @boolean "true" "false"))
@ -86,26 +86,26 @@
(pp_define
lhs: _ @constant.macro (#set! "priority" 101)
)
(_preprocessor_directive) @preproc (#set! "priority" 99)
(_preprocessor_directive) @keyword.directive (#set! "priority" 99)
;; Attributes
(pp_include) @include
(pp_include_lib) @include
(export_attribute) @include
(pp_include) @keyword.import
(pp_include_lib) @keyword.import
(export_attribute) @keyword.import
(export_type_attribute) @type.definition
(export_type_attribute types: (fa fun: _ @type (#set! "priority" 101)))
(behaviour_attribute) @include
(module_attribute (atom) @namespace) @include
(behaviour_attribute) @keyword.import
(module_attribute (atom) @module) @keyword.import
(wild_attribute name: (attr_name name: _ @attribute)) @attribute
;; Records
(record_expr) @type
(record_field_expr _ @field) @type
(record_field_name _ @field) @type
(record_field_expr _ @variable.member) @type
(record_field_name _ @variable.member) @type
(record_name "#" @type name: _ @type) @type
(record_decl name: _ @type) @type.definition
(record_field name: _ @field)
(record_field name: _ @field ty: _ @type)
(record_field name: _ @variable.member)
(record_field name: _ @variable.member ty: _ @type)
;; Type alias
(type_alias name: _ @type) @type.definition
@ -115,7 +115,7 @@
;;; expr_function_call
(call expr: [(atom) (remote) (var)] @function)
(call (atom) @exception (#any-of? @exception "error" "throw" "exit"))
(call (atom) @keyword.exception (#any-of? @keyword.exception "error" "throw" "exit"))
;;; Parenthesized expression: (SomeFunc)(), only highlight the parens
(call

View file

@ -75,7 +75,7 @@
name: (identifier) @variable)
(method
name: (identifier) @method)
name: (identifier) @function.method)
(number_literal) @number
(string_literal) @string

View file

@ -30,11 +30,11 @@
(multi_symbol
"." @punctuation.delimiter
(symbol) @field)
(symbol) @variable.member)
(multi_symbol_method
":" @punctuation.delimiter
(symbol) @method.call .)
(symbol) @function.method.call .)
(list . (symbol) @function.call)
(list . (multi_symbol (symbol) @function.call .))
@ -42,7 +42,7 @@
((symbol) @variable.builtin
(#lua-match? @variable.builtin "^[$]"))
(binding) @symbol
(binding) @string.special.symbol
[
"fn"
@ -64,16 +64,16 @@
[
"for"
"each"
] @repeat
((symbol) @repeat
(#any-of? @repeat
] @keyword.repeat
((symbol) @keyword.repeat
(#any-of? @keyword.repeat
"while"))
[
"match"
] @conditional
((symbol) @conditional
(#any-of? @conditional
] @keyword.conditional
((symbol) @keyword.conditional
(#any-of? @keyword.conditional
"if" "when"))
[
@ -89,8 +89,8 @@
(#any-of? @keyword
"comment" "do" "doc" "eval-compiler" "lua" "macros" "quote" "tset" "values"))
((symbol) @include
(#any-of? @include
((symbol) @keyword.import
(#any-of? @keyword.import
"require" "require-macros" "import-macros" "include"))
[

View file

@ -1,8 +1,8 @@
; Namespaces
(circuit (identifier) @namespace)
(circuit (identifier) @module)
(module (identifier) @namespace)
(module (identifier) @module)
; Types
@ -52,14 +52,14 @@
[
"input"
"output"
] @storageclass
] @keyword.storage
; Conditionals
[
"when"
"else"
] @conditional
] @keyword.conditional
; Annotations
@ -99,31 +99,31 @@
"reader"
"writer"
"readwriter"
] @field.builtin
] @variable.member.builtin
((field_id) @field
((field_id) @variable.member
(#set! "priority" 105))
(port (identifier) @field)
(port (identifier) @variable.member)
(wire (identifier) @field)
(wire (identifier) @variable.member)
(cmem (identifier) @field)
(cmem (identifier) @variable.member)
(smem (identifier) @field)
(smem (identifier) @variable.member)
(memory (identifier) @field)
(memory (identifier) @variable.member)
(register (identifier) @field)
(register (identifier) @variable.member)
; Parameters
(primitive_operation (identifier) @parameter)
(primitive_operation (identifier) @variable.parameter)
(mux (identifier) @parameter)
(printf (identifier) @parameter)
(reset (identifier) @parameter)
(stop (identifier) @parameter)
(mux (identifier) @variable.parameter)
(printf (identifier) @variable.parameter)
(reset (identifier) @variable.parameter)
(stop (identifier) @variable.parameter)
; Variables
@ -151,7 +151,7 @@
(number_str) @string.special
(double) @float
(double) @number.float
(string) @string

View file

@ -35,29 +35,29 @@
[
"if"
"end"
] @conditional)
] @keyword.conditional)
(switch_statement
[
"switch"
"end"
] @conditional)
] @keyword.conditional)
(case_clause
[
"case"
] @conditional)
] @keyword.conditional)
(else_clause
[
"else"
] @conditional)
] @keyword.conditional)
(else_if_clause
[
"else"
"if"
] @conditional)
] @keyword.conditional)
;; Loops/Blocks
@ -65,19 +65,19 @@
[
"while"
"end"
] @repeat)
] @keyword.repeat)
(for_statement
[
"for"
"end"
] @repeat)
] @keyword.repeat)
(begin_statement
[
"begin"
"end"
] @repeat)
] @keyword.repeat)
;; Keywords
@ -106,7 +106,7 @@
(command
argument: [
(word) @parameter (#lua-match? @parameter "^[-]")
(word) @variable.parameter (#lua-match? @variable.parameter "^[-]")
]
)
@ -137,7 +137,7 @@
option: [
(word)
(concatenation (word))
] @parameter (#lua-match? @parameter "^[-]")
] @variable.parameter (#lua-match? @variable.parameter "^[-]")
)
;; Strings
@ -159,5 +159,5 @@
((word) @boolean
(#any-of? @boolean "true" "false"))
((program . (comment) @preproc)
(#lua-match? @preproc "^#!/"))
((program . (comment) @keyword.directive)
(#lua-match? @keyword.directive "^#!/"))

View file

@ -11,32 +11,32 @@
;; Macros
(macro
"$" @conditional
(prev_scope)* @conditional
(identifier)* @namespace
"$" @keyword.conditional
(prev_scope)* @keyword.conditional
(identifier)* @module
)
;; Directives
"#" @conditional
"#" @keyword.conditional
(preproc_call
directive: (identifier)* @conditional
argument: (identifier)* @namespace
directive: (identifier)* @keyword.conditional
argument: (identifier)* @module
)
((preproc_call
argument: (identifier)* @namespace) @conditional
(#eq? @conditional "ifeq"))
((preproc_call) @conditional
(#any-of? @conditional "else" "endif"))
argument: (identifier)* @module) @keyword.conditional
(#eq? @keyword.conditional "ifeq"))
((preproc_call) @keyword.conditional
(#any-of? @keyword.conditional "else" "endif"))
;; Literals
(number_literal) @float
(number_literal) @number.float
(string_literal) @string
(escape_sequence) @string.escape
(boolean) @boolean
;; Treat [m^2 s^-2] the same as if it was put in numbers format
(dimensions dimension: (identifier) @float)
(dimensions dimension: (identifier) @number.float)
;; Punctuation
[

View file

@ -1,26 +1,26 @@
; Preprocs
(preproc_file_line) @preproc
(preproc_file_line) @keyword.directive
; Namespaces
(program_statement
(name) @namespace)
(name) @module)
(end_program_statement
(name) @namespace)
(name) @module)
(module_statement
(name) @namespace)
(name) @module)
(end_module_statement
(name) @namespace)
(name) @module)
(submodule_statement
(name) @namespace)
(name) @module)
(end_submodule_statement
(name) @namespace)
(name) @module)
; Includes
@ -28,7 +28,7 @@
"import"
"include"
"use"
] @include
] @keyword.import
(import_statement
","
@ -147,7 +147,7 @@
"in"
"inout"
"out"
] @storageclass
] @keyword.storage
; Labels
@ -211,7 +211,7 @@
[
"error"
] @exception
] @keyword.exception
; Conditionals
@ -224,7 +224,7 @@
"if"
"then"
"where"
] @conditional
] @keyword.conditional
; Repeats
@ -238,7 +238,7 @@
"continue"
"cycle"
"exit"
] @repeat
] @keyword.repeat
; Variables
@ -247,10 +247,10 @@
; Parameters
(keyword_argument
name: (identifier) @parameter)
name: (identifier) @variable.parameter)
(parameters
(identifier) @parameter)
(identifier) @variable.parameter)
; Properties

View file

@ -85,7 +85,7 @@
(flag) @constant
; Special Params
(code_value) @parameter
(code_value) @variable.parameter
; Extras
(fsh_comment) @comment @spell

View file

@ -1,20 +1,20 @@
; Include
"#include" @include
"#include" @keyword.import
(include_path) @string
; Preproc
[
"#pragma"
] @preproc
] @keyword.directive
(pragma_directive
[
"version"
"not-version"
"test-version-set"
] @preproc)
] @keyword.directive)
; Keywords
@ -40,14 +40,14 @@
"elseif"
"elseifnot"
"until"
] @conditional
] @keyword.conditional
; Exceptions
[
"try"
"catch"
] @exception
] @keyword.exception
; Repeats
@ -56,7 +56,7 @@
"forall"
"repeat"
"while"
] @repeat
] @keyword.repeat
; Qualifiers
[
@ -83,11 +83,11 @@
function: (identifier) @function)
(method_call
method_name: (identifier) @method.call)
method_name: (identifier) @function.method.call)
; Parameters
(parameter) @parameter
(parameter) @variable.parameter
; Types

View file

@ -12,7 +12,7 @@
(afx_attribute
(afx_property_identifier) @tag.attribute)
(afx_text) @text
(afx_text) @spell
; identifiers eel
@ -43,13 +43,13 @@
(include_statement
[
"include"
] @include
(source_file) @text.uri
] @keyword.import
(source_file) @string.special.url
)
(namespace_declaration
"namespace" @keyword
(alias_namespace) @namespace)
(alias_namespace) @module)
(type
name: (type_name) @type)
@ -78,7 +78,7 @@
[
(package_name)
(alias_namespace)
] @namespace
] @module
(namespace_declaration "=" @operator)
(assignment "=" @operator)
@ -117,4 +117,4 @@
] @punctuation.delimiter
(eel_ternary_expression
["?" ":"] @conditional.ternary)
["?" ":"] @keyword.conditional.ternary)

View file

@ -6,7 +6,7 @@
(comment) @comment @spell
(string_name) @string
(string) @string
(float) @float
(float) @number.float
(integer) @number
(null) @constant
(setter) @function
@ -15,14 +15,14 @@
(get_body "get" @keyword.function)
(static_keyword) @type.qualifier
(tool_statement) @keyword
(breakpoint_statement) @debug
(breakpoint_statement) @keyword.debug
(inferred_type) @operator
[(true) (false)] @boolean
[
(get_node)
(node_path)
] @text.uri
] @string.special.url
(class_name_statement
(name) @type) @keyword
@ -44,14 +44,14 @@
(function_definition
(name) @function (parameters
(identifier) @parameter)*)
(identifier) @variable.parameter)*)
(typed_parameter (identifier) @parameter)
(default_parameter (identifier) @parameter)
(typed_parameter (identifier) @variable.parameter)
(default_parameter (identifier) @variable.parameter)
(call (identifier) @function.call)
(call (identifier) @include
(#any-of? @include "preload" "load"))
(call (identifier) @keyword.import
(#any-of? @keyword.import "preload" "load"))
;; Properties and Methods
@ -63,9 +63,9 @@
; Same question but for methods?
(class_definition
(body (function_definition (name) @method)))
(body (function_definition (name) @function.method)))
(attribute_call (identifier) @method.call)
(attribute_call (identifier) @function.method.call)
(attribute (_) (identifier) @property)
;; Enums
@ -90,9 +90,9 @@
["," "." ":"] @punctuation.delimiter
["if" "elif" "else" "match"] @conditional
["if" "elif" "else" "match"] @keyword.conditional
["for" "while" "break" "continue"] @repeat
["for" "while" "break" "continue"] @keyword.repeat
[
"~"

View file

@ -2,13 +2,13 @@
(section_name) @type
((section_name) @include
(#eq? @include "include"))
((section_name) @keyword.import
(#eq? @keyword.import "include"))
((section_header
(section_name) @include
(section_name) @keyword.import
(subsection_name))
(#eq? @include "includeIf"))
(#eq? @keyword.import "includeIf"))
(variable (name) @property)
@ -28,11 +28,11 @@
(string) @string
((string) @text.uri
(#lua-match? @text.uri "^[.]?[/]"))
((string) @string.special.path
(#lua-match? @string.special.path "^[.]?[/]"))
((string) @text.uri
(#lua-match? @text.uri "^[~]"))
((string) @string.special.path
(#lua-match? @string.special.path "^[~]"))
(section_header
[

View file

@ -1,6 +1,6 @@
((command) @keyword
(label)? @constant
(message)? @text @spell)
(message)? @none @spell)
(option) @operator

View file

@ -22,7 +22,7 @@
] @string.escape
(attribute
(attr_name) @parameter)
(attr_name) @variable.parameter)
(attribute
(builtin_attr) @variable.builtin)
@ -37,15 +37,16 @@
(string_value) @string
(macro_tag) @preproc
(macro_tag) @keyword.directive
(macro_def
macro_name: (_) @property)
[
(pattern_negation)
(redundant_escape)
(trailing_slash)
] @error
; we do not lint syntax errors
; [
; (pattern_negation)
; (redundant_escape)
; (trailing_slash)
; ] @error
(comment) @comment @spell

View file

@ -1,17 +1,17 @@
(comment) @comment
(generated_comment) @comment
(title) @text.title
(text) @text
(branch) @text.reference
(title) @markup.heading
; (text) @none
(branch) @markup.link
(change) @keyword
(filepath) @text.uri
(filepath) @string.special.url
(arrow) @punctuation.delimiter
(subject) @text.title @spell
(subject (overflow) @text @spell)
(subject) @markup.heading @spell
(subject (overflow) @none @spell)
(subject (subject_prefix) @function @nospell)
(prefix (type) @keyword @nospell)
(prefix (scope) @parameter @nospell)
(prefix (scope) @variable.parameter @nospell)
(prefix [
"("
")"
@ -21,12 +21,12 @@
"!"
] @punctuation.special)
(message) @text @spell
(message) @spell
(trailer (token) @label)
(trailer (value) @text)
; (trailer (value) @none)
(breaking_change (token) @text.warning)
(breaking_change (value) @text @spell)
(breaking_change (token) @comment.warning)
(breaking_change (value) @none @spell)
(scissor) @comment

View file

@ -16,18 +16,18 @@
; Imports
[
"import"
] @include
] @keyword.import
; Conditionals
[
"case"
"if"
] @conditional
] @keyword.conditional
; Exceptions
[
"assert"
] @exception
] @keyword.exception
; Punctuation
[
@ -99,9 +99,9 @@
] @comment
; Modules & Imports
(module) @namespace
(import alias: ((identifier) @namespace)?)
(remote_type_identifier module: (identifier) @namespace)
(module) @module
(import alias: ((identifier) @module)?)
(remote_type_identifier module: (identifier) @module)
(unqualified_import name: (identifier) @function)
; Strings
@ -113,11 +113,11 @@
; Numbers
(integer) @number
(float) @float
(float) @number.float
; Function Parameter Labels
(function_call arguments: (arguments (argument label: (label) @label)))
(function_parameter label: (label)? @label name: (identifier) @parameter)
(function_parameter label: (label)? @label name: (identifier) @variable.parameter)
; Records
(record arguments: (arguments (argument label: (label) @property)?))
@ -154,7 +154,7 @@
; External Functions
(external_function name: (identifier) @function)
(external_function_body (string) @namespace . (string) @function)
(external_function_body (string) @module . (string) @function)
; Constructors
(constructor_name) @type @constructor

View file

@ -23,10 +23,10 @@
(block_statement_end) @tag.delimiter
; Highlight `if`/`each`/`let`
(block_statement_start path: (identifier) @conditional)
(block_statement_end path: (identifier) @conditional)
((mustache_statement (identifier) @conditional)
(#lua-match? @conditional "else"))
(block_statement_start path: (identifier) @keyword.conditional)
(block_statement_end path: (identifier) @keyword.conditional)
((mustache_statement (identifier) @keyword.conditional)
(#lua-match? @keyword.conditional "else"))
; == Mustache Statements ===
@ -66,8 +66,8 @@
(identifier) @function
])
(#not-any-of? @function "if" "yield"))
((helper_invocation helper: (identifier) @conditional)
(#eq? @conditional "if"))
((helper_invocation helper: (identifier) @keyword.conditional)
(#eq? @keyword.conditional "if"))
((helper_invocation helper: (identifier) @keyword)
(#eq? @keyword "yield"))

View file

@ -29,7 +29,7 @@
"subroutine" @keyword.function
(extension_storage_class) @storageclass
(extension_storage_class) @keyword.storage
((identifier) @variable.builtin
(#lua-match? @variable.builtin "^gl_"))

View file

@ -1,17 +1,17 @@
; Includes
"import" @include
"import" @keyword.import
; Conditionals
[
"if"
"else"
] @conditional
] @keyword.conditional
; Repeats
"foreach" @repeat
"foreach" @keyword.repeat
; Operators
@ -42,7 +42,7 @@
; Fields
(scope_access field: (identifier) @field)
(scope_access field: (identifier) @variable.member)
; Literals

View file

@ -8,10 +8,10 @@
(type_spec name: (type_identifier) @type.definition)
(field_identifier) @property
(identifier) @variable
(package_identifier) @namespace
(package_identifier) @module
(parameter_declaration (identifier) @parameter)
(variadic_parameter_declaration (identifier) @parameter)
(parameter_declaration (identifier) @variable.parameter)
(variadic_parameter_declaration (identifier) @variable.parameter)
(label_name) @label
@ -25,7 +25,7 @@
(call_expression
function: (selector_expression
field: (field_identifier) @method.call))
field: (field_identifier) @function.method.call))
; Function definitions
@ -33,10 +33,10 @@
name: (identifier) @function)
(method_declaration
name: (field_identifier) @method)
name: (field_identifier) @function.method)
(method_spec
name: (field_identifier) @method)
name: (field_identifier) @function.method)
; Constructors
@ -112,19 +112,19 @@
"return" @keyword.return
"go" @keyword.coroutine
"for" @repeat
"for" @keyword.repeat
[
"import"
"package"
] @include
] @keyword.import
[
"else"
"case"
"switch"
"if"
] @conditional
] @keyword.conditional
;; Builtin types
@ -204,7 +204,7 @@
(escape_sequence) @string.escape
(int_literal) @number
(float_literal) @float
(float_literal) @number.float
(imaginary_literal) @number
[
@ -218,8 +218,8 @@
] @constant.builtin
(keyed_element
. (literal_element (identifier) @field))
(field_declaration name: (field_identifier) @field)
. (literal_element (identifier) @variable.member))
(field_declaration name: (field_identifier) @variable.member)
; Comments

View file

@ -5,7 +5,7 @@
(
(method_declaration
name: (field_identifier) @local.definition.method); @method
name: (field_identifier) @local.definition.method); @function.method
)
(short_var_declaration

View file

@ -6,7 +6,7 @@
(string) @string
(integer) @number
(float) @float
(float) @number.float
(true) @constant.builtin
(false) @constant.builtin

View file

@ -11,7 +11,7 @@
"=>" @operator
(comment) @comment @spell
(module_path) @text.uri
(module_path) @string.special.url
[
(version)

View file

@ -8,11 +8,11 @@
] @keyword
(module_path) @string @text.uri
(module_path) @string.special.url
(module_version) @string.special
(hash_version) @attribute
(hash) @symbol
(hash) @string.special.symbol
[
(number)

View file

@ -1,8 +1,8 @@
(option . _ @keyword)
(option
("no-" @parameter)?
(name) @parameter)
("no-" @variable.parameter)?
(name) @variable.parameter)
(string (content) @string)
@ -11,7 +11,7 @@
"clear"
] @string.special
(url) @text.uri
(url) @string.special.url
(key) @constant
@ -25,9 +25,9 @@
"sensitive:" @type.qualifier
(filter_name) @parameter
(filter_name) @variable.parameter
(filter_scope) @namespace
(filter_scope) @module
(filter_property) @property

View file

@ -80,17 +80,17 @@
(input_fields_definition
(input_value_definition
(name) @parameter))
(name) @variable.parameter))
(argument
(name) @parameter)
(name) @variable.parameter)
(arguments_definition
(input_value_definition
(name) @parameter))
(name) @variable.parameter))
(variable_definition
(variable) @parameter)
(variable) @variable.parameter)
(argument
(value
@ -103,7 +103,7 @@
(int_value) @number
(float_value) @float
(float_value) @number.float
(boolean_value) @boolean

View file

@ -7,7 +7,7 @@
(block
(unit
(identifier) @namespace))
(identifier) @module))
(func
(identifier) @function)
@ -64,8 +64,8 @@
"private"
"public"))
((identifier) @exception
(#any-of? @exception
((identifier) @keyword.exception
(#any-of? @keyword.exception
"throw"
"finally"
"try"

View file

@ -16,7 +16,7 @@
] @punctuation.bracket
(property
key: (identifier) @field)
key: (identifier) @variable.member)
(value) @string
(string_literal) @string
(cap

View file

@ -43,7 +43,7 @@
"include_once"
"require"
"require_once"
] @include
] @keyword.import
[
"new"
@ -184,10 +184,10 @@
] @operator
(integer) @number
(float) @float
(float) @number.float
(parameter
(variable) @parameter)
(variable) @variable.parameter)
(call_expression
function: (qualified_identifier (identifier) @function.call .))
@ -197,23 +197,23 @@
(call_expression
function: (selection_expression
(qualified_identifier (identifier) @method.call .)))
(qualified_identifier (identifier) @function.method.call .)))
(qualified_identifier
(_) @namespace .
(_) @module .
(_))
(use_statement
(qualified_identifier
(_) @namespace .)
(_) @module .)
(use_clause))
(use_statement
(use_type "namespace")
(use_clause
(qualified_identifier
(identifier) @namespace .)
alias: (identifier)? @namespace))
(identifier) @module .)
alias: (identifier)? @module))
(use_statement
(use_type "const")
@ -239,8 +239,8 @@
(use_clause
(use_type "namespace")
(qualified_identifier
(_) @namespace .)
alias: (identifier)? @namespace)
(_) @module .)
alias: (identifier)? @module)
(use_clause
(use_type "function")
@ -263,7 +263,7 @@
(function_declaration
name: (identifier) @function)
(method_declaration
name: (identifier) @method)
name: (identifier) @function.method)
(type_arguments
[ "<" ">" ] @punctuation.bracket)
@ -279,7 +279,7 @@
"\\" @punctuation.delimiter)
(ternary_expression
["?" ":"] @conditional.ternary)
["?" ":"] @keyword.conditional.ternary)
[
"if"
@ -287,13 +287,13 @@
"elseif"
"switch"
"case"
] @conditional
] @keyword.conditional
[
"try"
"catch"
"finally"
] @exception
] @keyword.exception
[
"for"
@ -302,7 +302,7 @@
"do"
"continue"
"break"
] @repeat
] @keyword.repeat
[
(string)

View file

@ -23,18 +23,18 @@
[
"use"
] @include
] @keyword.import
(use_statement
(scoped_type_identifier
(identifier) @namespace))
(identifier) @module))
(use_statement
(identifier) @namespace "{")
(identifier) @module "{")
(use_statement
. (identifier) @namespace .)
. (identifier) @module .)
((scoped_type_identifier
path: (_) @namespace)
path: (_) @module)
(#set! "priority" 105))
; Keywords
@ -103,7 +103,7 @@
(call_expression
. (scoped_type_identifier
. (identifier) . "::" . (identifier) @method.call))
. (identifier) . "::" . (identifier) @function.method.call))
((call_expression
. (identifier) @function.builtin)
@ -123,25 +123,25 @@
; Parameters
(parameter
(_) @parameter . ":")
(_) @variable.parameter . ":")
; Fields
((member_expression
"." (_) @field)
"." (_) @variable.member)
(#set! "priority" 105))
(field
. (identifier) @field)
. (identifier) @variable.member)
(field_assignment
. (identifier) @field)
. (identifier) @variable.member)
; Repeats
[
"for"
] @repeat
] @keyword.repeat
; Conditionals
@ -152,7 +152,7 @@
"switch"
"match"
"case"
] @conditional
] @keyword.conditional
; Operators
@ -237,7 +237,7 @@
(number) @number
(float) @float
(float) @number.float
(boolean) @boolean

View file

@ -8,27 +8,27 @@
(pat_wildcard) @variable
(function
patterns: (patterns (_) @parameter))
patterns: (patterns (_) @variable.parameter))
(exp_lambda (_)+ @parameter "->")
(exp_lambda (_)+ @variable.parameter "->")
(function
infix: (infix
lhs: (_) @parameter))
lhs: (_) @variable.parameter))
(function
infix: (infix
rhs: (_) @parameter))
rhs: (_) @variable.parameter))
;; ----------------------------------------------------------------------------
;; Literals and comments
(integer) @number
(exp_negation) @number
(exp_literal (float)) @float
(exp_literal (float)) @number.float
(char) @character
(string) @string
(con_unit) @symbol ; unit, as in ()
(con_unit) @string.special.symbol ; unit, as in ()
(comment) @comment
@ -82,9 +82,9 @@
[
"forall"
"∀"
] @repeat
] @keyword.repeat
(pragma) @preproc
(pragma) @keyword.directive
[
"if"
@ -92,13 +92,13 @@
"else"
"case"
"of"
] @conditional
] @keyword.conditional
[
"import"
"qualified"
"module"
] @include
] @keyword.import
[
(operator)
@ -124,12 +124,12 @@
] @operator
(module) @namespace
(module) @module
((qualified_module (module) @constructor)
. (module))
(qualified_type (module) @namespace)
(qualified_variable (module) @namespace)
(import (module) @namespace)
(qualified_type (module) @module)
(qualified_variable (module) @module)
(import (module) @module)
(import (module) @constructor . (module))
[
@ -250,7 +250,7 @@
[
((variable) @function.call)
(qualified_variable (
(module) @namespace
(module) @module
(variable) @function.call))
])
. (operator))
@ -391,7 +391,7 @@
;; namespaced quasi-quoter
(quasiquote
(_
(module) @namespace
(module) @module
. (variable) @function.call
))
@ -400,8 +400,8 @@
;; ----------------------------------------------------------------------------
;; Exceptions/error handling
((variable) @exception
(#any-of? @exception
((variable) @keyword.exception
(#any-of? @keyword.exception
"error"
"undefined"
"try"
@ -431,8 +431,8 @@
;; ----------------------------------------------------------------------------
;; Debugging
((variable) @debug
(#any-of? @debug
((variable) @keyword.debug
(#any-of? @keyword.debug
"trace"
"traceId"
"traceShow"
@ -453,11 +453,11 @@
;; ----------------------------------------------------------------------------
;; Fields
(field (variable) @field)
(pat_field (variable) @field)
(exp_projection field: (variable) @field)
(import_item (type) . (import_con_names (variable) @field))
(exp_field field: [((variable) @field) (qualified_variable (variable) @field)])
(field (variable) @variable.member)
(pat_field (variable) @variable.member)
(exp_projection field: (variable) @variable.member)
(import_item (type) . (import_con_names (variable) @variable.member))
(exp_field field: [((variable) @variable.member) (qualified_variable (variable) @variable.member)])
;; ----------------------------------------------------------------------------

View file

@ -2,13 +2,13 @@
;; Literals and comments
(integer) @number
(float) @float
(float) @number.float
(char) @character
(string) @string
(attribute_name) @attribute
(attribute_exclamation_mark) @attribute
(con_unit) @symbol ; unit, as in ()
(con_unit) @string.special.symbol ; unit, as in ()
(comment) @comment @spell

View file

@ -48,13 +48,13 @@
"for"
"endfor"
"in"
] @repeat
] @keyword.repeat
[
"if"
"else"
"endif"
] @conditional
] @keyword.conditional
[
(quoted_template_start) ; "
@ -84,14 +84,14 @@
(body (block (identifier) @keyword))
(body (block (body (block (identifier) @type))))
(function_call (identifier) @function)
(attribute (identifier) @field)
(attribute (identifier) @variable.member)
; { key: val }
;
; highlight identifier keys as though they were block attributes
(object_elem key: (expression (variable_expr (identifier) @field)))
(object_elem key: (expression (variable_expr (identifier) @variable.member)))
; var.foo, data.bar
;
; first element in get_attr is a variable.builtin or a reference to a variable.builtin
(expression (variable_expr (identifier) @variable.builtin) (get_attr (identifier) @field))
(expression (variable_expr (identifier) @variable.builtin) (get_attr (identifier) @variable.member))

View file

@ -30,7 +30,7 @@
(comment) @comment @spell
; HEEx text content is treated as markup
(text) @text
; (text) @none
; HEEx tags and slots are highlighted as HTML
[

View file

@ -15,12 +15,12 @@
"required"
] @keyword
(include "include" @include)
(include "include" @keyword.import)
(substitution ["${" "${?" "}"] @punctuation.special)
(substitution (_) @field)
(substitution (_) @variable.member)
(path (_) @field)
(path (_) @variable.member)
(value [":" "=" "+=" ] @operator)
[

View file

@ -27,7 +27,7 @@
(date) @string.special
(mold) @symbol
(mold) @string.special.symbol
(specialIndex) @number.builtin
(lark) @operator
(fullContext) @symbol
(fullContext) @string.special.symbol

View file

@ -1,54 +1,54 @@
(tag_name) @tag
(erroneous_end_tag_name) @error
; (erroneous_end_tag_name) @error ; we do not lint syntax errors
(comment) @comment @spell
(attribute_name) @tag.attribute
((attribute
(quoted_attribute_value) @string)
(#set! "priority" 99))
(text) @text @spell
(text) @none @spell
((element (start_tag (tag_name) @_tag) (text) @text.title)
((element (start_tag (tag_name) @_tag) (text) @markup.heading)
(#eq? @_tag "title"))
((element (start_tag (tag_name) @_tag) (text) @text.title.1)
((element (start_tag (tag_name) @_tag) (text) @markup.heading.1)
(#eq? @_tag "h1"))
((element (start_tag (tag_name) @_tag) (text) @text.title.2)
((element (start_tag (tag_name) @_tag) (text) @markup.heading.2)
(#eq? @_tag "h2"))
((element (start_tag (tag_name) @_tag) (text) @text.title.3)
((element (start_tag (tag_name) @_tag) (text) @markup.heading.3)
(#eq? @_tag "h3"))
((element (start_tag (tag_name) @_tag) (text) @text.title.4)
((element (start_tag (tag_name) @_tag) (text) @markup.heading.4)
(#eq? @_tag "h4"))
((element (start_tag (tag_name) @_tag) (text) @text.title.5)
((element (start_tag (tag_name) @_tag) (text) @markup.heading.5)
(#eq? @_tag "h5"))
((element (start_tag (tag_name) @_tag) (text) @text.title.6)
((element (start_tag (tag_name) @_tag) (text) @markup.heading.6)
(#eq? @_tag "h6"))
((element (start_tag (tag_name) @_tag) (text) @text.strong)
((element (start_tag (tag_name) @_tag) (text) @markup.strong)
(#any-of? @_tag "strong" "b"))
((element (start_tag (tag_name) @_tag) (text) @text.emphasis)
((element (start_tag (tag_name) @_tag) (text) @markup.italic)
(#any-of? @_tag "em" "i"))
((element (start_tag (tag_name) @_tag) (text) @text.strike)
((element (start_tag (tag_name) @_tag) (text) @markup.strikethrough)
(#any-of? @_tag "s" "del"))
((element (start_tag (tag_name) @_tag) (text) @text.underline)
((element (start_tag (tag_name) @_tag) (text) @markup.underline)
(#eq? @_tag "u"))
((element (start_tag (tag_name) @_tag) (text) @text.literal)
((element (start_tag (tag_name) @_tag) (text) @markup.raw)
(#any-of? @_tag "code" "kbd"))
((element (start_tag (tag_name) @_tag) (text) @text.uri)
((element (start_tag (tag_name) @_tag) (text) @string.special.url)
(#eq? @_tag "a"))
((attribute
(attribute_name) @_attr
(quoted_attribute_value (attribute_value) @text.uri))
(quoted_attribute_value (attribute_value) @string.special.url))
(#any-of? @_attr "href" "src"))
[

View file

@ -18,8 +18,8 @@
(variable_name) @variable
(filter_name) @method
(filter_argument) @parameter
(filter_name) @function.method
(filter_argument) @variable.parameter
(keyword) @keyword

View file

@ -4,7 +4,7 @@
; Methods
(method) @method
(method) @function.method
; Constants
@ -16,11 +16,11 @@
; Fields
(pair name: (identifier) @field)
(pair name: (identifier) @variable.member)
; Parameters
(query_param (key) @parameter)
(query_param (key) @variable.parameter)
; Operators
@ -35,7 +35,7 @@
(string) @string
(target_url) @string @text.uri
(target_url) @string.special.url
(number) @number

View file

@ -100,7 +100,7 @@
[
(float)
(json_number)
] @float
] @number.float
[ ":" "," ] @punctuation.delimiter
@ -115,13 +115,16 @@
[
"base64,"
"file,"
"hex,"
(file_value)
(version)
] @string.special
(regex) @string.regex
[
"file,"
(file_value)
] @string.special.path
(regex) @string.regexp
(multiline_string_type) @type

View file

@ -12,5 +12,4 @@
] @operator
(setting (setting_name) @property)
(setting_value) @text ; grammar does not support subtypes
(ERROR (setting_name) @text)
; (setting_value) @none ; grammar does not support subtypes

View file

@ -24,11 +24,11 @@
"foreach_tiled"
"foreach_active"
"foreach_unique"
] @repeat
] @keyword.repeat
[
"cif"
] @conditional
] @keyword.conditional
[
"varying"

View file

@ -1,6 +1,6 @@
;; >> Literals
(kwd_lit) @symbol
(kwd_lit) @string.special.symbol
(str_lit) @string
(long_str_lit) @string
(buf_lit) @string
@ -31,10 +31,10 @@
;; Quoted symbols
(quote_lit
(sym_lit) @symbol)
(sym_lit) @string.special.symbol)
(qq_lit
(sym_lit) @symbol)
(sym_lit) @string.special.symbol)
;; Dynamic variables

View file

@ -7,30 +7,30 @@
; Methods
(method_declaration
name: (identifier) @method)
name: (identifier) @function.method)
(method_invocation
name: (identifier) @method.call)
name: (identifier) @function.method.call)
(super) @function.builtin
; Parameters
(formal_parameter
name: (identifier) @parameter)
name: (identifier) @variable.parameter)
(catch_formal_parameter
name: (identifier) @parameter)
name: (identifier) @variable.parameter)
(spread_parameter
(variable_declarator
name: (identifier) @parameter)) ; int... foo
name: (identifier) @variable.parameter)) ; int... foo
;; Lambda parameter
(inferred_parameters (identifier) @parameter) ; (x,y) -> ...
(inferred_parameters (identifier) @variable.parameter) ; (x,y) -> ...
(lambda_expression
parameters: (identifier) @parameter) ; x -> ...
parameters: (identifier) @variable.parameter) ; x -> ...
; Operators
@ -107,10 +107,10 @@
(field_declaration
declarator: (variable_declarator
name: (identifier) @field))
name: (identifier) @variable.member))
(field_access
field: (identifier) @field)
field: (identifier) @variable.member)
[
(boolean_type)
@ -153,7 +153,7 @@
[
(decimal_floating_point_literal)
(hex_floating_point_literal)
] @float
] @number.float
[
(true)
@ -204,7 +204,7 @@
[
"transient"
"volatile"
] @storageclass
] @keyword.storage
[
"return"
@ -222,9 +222,9 @@
"else"
"switch"
"case"
] @conditional
] @keyword.conditional
(ternary_expression ["?" ":"] @conditional.ternary)
(ternary_expression ["?" ":"] @keyword.conditional.ternary)
; Loops
@ -234,7 +234,7 @@
"do"
"continue"
"break"
] @repeat
] @keyword.repeat
; Includes
@ -247,7 +247,7 @@
"provides"
"requires"
"uses"
] @include
] @keyword.import
; Punctuation
@ -277,7 +277,7 @@
"finally"
"try"
"catch"
] @exception
] @keyword.exception
; Labels

View file

@ -1,55 +1,55 @@
; inherits: ecma,jsx
;;; Parameters
(formal_parameters (identifier) @parameter)
(formal_parameters (identifier) @variable.parameter)
(formal_parameters
(rest_pattern
(identifier) @parameter))
(identifier) @variable.parameter))
;; ({ a }) => null
(formal_parameters
(object_pattern
(shorthand_property_identifier_pattern) @parameter))
(shorthand_property_identifier_pattern) @variable.parameter))
;; ({ a = b }) => null
(formal_parameters
(object_pattern
(object_assignment_pattern
(shorthand_property_identifier_pattern) @parameter)))
(shorthand_property_identifier_pattern) @variable.parameter)))
;; ({ a: b }) => null
(formal_parameters
(object_pattern
(pair_pattern
value: (identifier) @parameter)))
value: (identifier) @variable.parameter)))
;; ([ a ]) => null
(formal_parameters
(array_pattern
(identifier) @parameter))
(identifier) @variable.parameter))
;; ({ a } = { a }) => null
(formal_parameters
(assignment_pattern
(object_pattern
(shorthand_property_identifier_pattern) @parameter)))
(shorthand_property_identifier_pattern) @variable.parameter)))
;; ({ a = b } = { a }) => null
(formal_parameters
(assignment_pattern
(object_pattern
(object_assignment_pattern
(shorthand_property_identifier_pattern) @parameter))))
(shorthand_property_identifier_pattern) @variable.parameter))))
;; a => null
(arrow_function
parameter: (identifier) @parameter)
parameter: (identifier) @variable.parameter)
;; optional parameters
(formal_parameters
(assignment_pattern
left: (identifier) @parameter))
left: (identifier) @variable.parameter))
;; punctuation
(optional_chain) @punctuation.delimiter

View file

@ -48,7 +48,7 @@
(identifier) @function)
(funcdefargs
(identifier) @parameter)
(identifier) @variable.parameter)
[
"reduce"
@ -264,7 +264,7 @@
[
"import"
"include"
] @include
] @keyword.import
[
"if"
@ -272,12 +272,12 @@
"elif"
"else"
"end"
] @conditional
] @keyword.conditional
[
"try"
"catch"
] @exception
] @keyword.exception
[
"or"

View file

@ -11,7 +11,7 @@
] @boolean
; Keywords
"for" @repeat
"for" @keyword.repeat
"in" @keyword.operator
"function" @keyword.function
@ -19,7 +19,7 @@
"if"
"then"
"else"
] @conditional
] @keyword.conditional
[
(local)
@ -30,7 +30,7 @@
[
"assert"
"error"
] @exception
] @keyword.exception
[
(dollar)
@ -84,12 +84,12 @@
[
(import)
(importstr)
] @include
] @keyword.import
; Fields
(fieldname (id) @field)
(fieldname (string (string_content) @field))
(fieldname (id) @variable.member)
(fieldname (string (string_content) @variable.member))
; Functions
(field
@ -98,7 +98,7 @@
function: (fieldname
(string (string_content) @function)))
(param
identifier: (id) @parameter)
identifier: (id) @variable.parameter)
(bind (id) @variable.local)
(bind function: (id) @function)
@ -113,6 +113,6 @@
"("
(args
(named_argument
(id) @parameter
(id) @variable.parameter
))?
")")

View file

@ -14,11 +14,11 @@
name: (identifier) @function.macro)
(quote_expression
":" @symbol
[(identifier) (operator)] @symbol)
":" @string.special.symbol
[(identifier) (operator)] @string.special.symbol)
(field_expression
(identifier) @field .)
(identifier) @variable.member .)
;;; Function names
@ -68,18 +68,18 @@
;;; Parameters
(parameter_list
(identifier) @parameter)
(identifier) @variable.parameter)
(optional_parameter .
(identifier) @parameter)
(identifier) @variable.parameter)
(slurp_parameter
(identifier) @parameter)
(identifier) @variable.parameter)
(typed_parameter
parameter: (identifier)? @parameter
parameter: (identifier)? @variable.parameter
type: (_) @type)
(function_expression
. (identifier) @parameter) ; Single parameter arrow functions
. (identifier) @variable.parameter) ; Single parameter arrow functions
;;; Types
@ -362,42 +362,42 @@
["let" "end"] @keyword)
(if_statement
["if" "end"] @conditional)
["if" "end"] @keyword.conditional)
(elseif_clause
"elseif" @conditional)
"elseif" @keyword.conditional)
(else_clause
"else" @conditional)
"else" @keyword.conditional)
(if_clause
"if" @conditional) ; `if` clause in comprehensions
"if" @keyword.conditional) ; `if` clause in comprehensions
(ternary_expression
["?" ":"] @conditional.ternary)
["?" ":"] @keyword.conditional.ternary)
(try_statement
["try" "end"] @exception)
["try" "end"] @keyword.exception)
(finally_clause
"finally" @exception)
"finally" @keyword.exception)
(catch_clause
"catch" @exception)
"catch" @keyword.exception)
(for_statement
["for" "end"] @repeat)
["for" "end"] @keyword.repeat)
(while_statement
["while" "end"] @repeat)
["while" "end"] @keyword.repeat)
(for_clause
"for" @repeat)
"for" @keyword.repeat)
[
(break_statement)
(continue_statement)
] @repeat
] @keyword.repeat
(module_definition
["module" "baremodule" "end"] @include)
["module" "baremodule" "end"] @keyword.import)
(import_statement
["import" "using"] @include)
["import" "using"] @keyword.import)
(import_alias
"as" @include)
"as" @keyword.import)
(export_statement
"export" @include)
"export" @keyword.import)
(selected_import
":" @punctuation.delimiter)
@ -458,10 +458,10 @@
(boolean_literal) @boolean
(integer_literal) @number
(float_literal) @float
(float_literal) @number.float
((identifier) @float
(#any-of? @float "NaN" "NaN16" "NaN32"
((identifier) @number.float
(#any-of? @number.float "NaN" "NaN16" "NaN32"
"Inf" "Inf16" "Inf32"))
((identifier) @constant.builtin

View file

@ -1,4 +1,4 @@
"source" @include
"source" @keyword.import
[
"mainmenu"
@ -24,7 +24,7 @@
"select"
"imply"
"visible if"
] @conditional
] @keyword.conditional
[
"def_bool"
@ -70,10 +70,10 @@
((symbol) @constant
(#lua-match? @constant "[A-Z0-9]+"))
(mainmenu name: (prompt) @text.title)
(comment_entry name: (prompt) @text.title)
(menu name: (prompt) @text.title)
(mainmenu name: (prompt) @markup.heading)
(comment_entry name: (prompt) @markup.heading)
(menu name: (prompt) @markup.heading)
(source (prompt) @text.uri @string.special)
(source (prompt) @string.special.url)
(comment) @comment @spell

View file

@ -29,8 +29,8 @@
(number) @number
(number (decimal) @float)
(number (exponent) @float)
(number (decimal) @number.float)
(number (exponent) @number.float)
(boolean) @boolean

View file

@ -97,10 +97,10 @@
))
(package_header "package" @keyword
. (identifier (simple_identifier) @namespace))
. (identifier (simple_identifier) @module))
(import_header
"import" @include)
"import" @keyword.import)
; The last `simple_identifier` in a `import_header` will always either be a function
; or a type. Classes can appear anywhere in the import path, unlike functions
@ -142,16 +142,16 @@
("init") @constructor)
(parameter
(simple_identifier) @parameter)
(simple_identifier) @variable.parameter)
(parameter_with_optional_type
(simple_identifier) @parameter)
(simple_identifier) @variable.parameter)
; lambda parameters
(lambda_literal
(lambda_parameters
(variable_declaration
(simple_identifier) @parameter)))
(simple_identifier) @variable.parameter)))
;;; Function calls
@ -227,9 +227,9 @@
((multiline_comment) @comment.documentation
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
(shebang_line) @preproc
(shebang_line) @keyword.directive
(real_literal) @float
(real_literal) @number.float
[
(integer_literal)
(long_literal)
@ -254,7 +254,7 @@
; - "[abc]?".toRegex()
(call_expression
(navigation_expression
((string_literal) @string.regex)
((string_literal) @string.regexp)
(navigation_suffix
((simple_identifier) @_function
(#eq? @_function "toRegex")))))
@ -266,7 +266,7 @@
(call_suffix
(value_arguments
(value_argument
(string_literal) @string.regex))))
(string_literal) @string.regexp))))
; - Regex.fromLiteral("[abc]?")
(call_expression
@ -279,7 +279,7 @@
(call_suffix
(value_arguments
(value_argument
(string_literal) @string.regex))))
(string_literal) @string.regexp))))
;;; Keywords
@ -323,7 +323,7 @@
"if"
"else"
"when"
] @conditional
] @keyword.conditional
[
"for"
@ -333,14 +333,14 @@
"continue@"
"break"
"break@"
] @repeat
] @keyword.repeat
[
"try"
"catch"
"throw"
"finally"
] @exception
] @keyword.exception
(annotation

View file

@ -12,8 +12,8 @@
] @function.call
(typed_parameter
(identifier) @parameter)
(function_arguments (identifier) @parameter)
(identifier) @variable.parameter)
(function_arguments (identifier) @variable.parameter)
[
(binary_operator)

View file

@ -10,7 +10,7 @@
[
"match"
"else"
] @conditional
] @keyword.conditional
[
"+"
@ -32,7 +32,7 @@
["<" ">"] @punctuation.bracket)
(binding_symbol
name: (identifier) @parameter)
name: (identifier) @variable.parameter)
(bare_symbol
(macro
@ -54,7 +54,7 @@
[";" ":"] @punctuation.delimiter
(lifetime (identifier) @storageclass)
(lifetime (identifier) @keyword.storage)
(string_literal) @string
(regex_literal) @string

View file

@ -6,7 +6,7 @@
command: _ @function)
(key_value_pair
key: (_) @parameter
key: (_) @variable.parameter
value: (_))
[
@ -15,13 +15,13 @@
(comment_environment)
] @comment @spell
((line_comment) @preproc
(#lua-match? @preproc "^%% !TeX"))
((line_comment) @keyword.directive
(#lua-match? @keyword.directive "^%% !TeX"))
[
(brack_group)
(brack_group_argc)
] @parameter
] @variable.parameter
[(operator) "="] @operator
@ -34,12 +34,12 @@
;; General environments
(begin
command: _ @text.environment
name: (curly_group_text (text) @text.environment.name))
command: _ @markup.environment
name: (curly_group_text (text) @markup.environment.name))
(end
command: _ @text.environment
name: (curly_group_text (text) @text.environment.name))
command: _ @markup.environment
name: (curly_group_text (text) @markup.environment.name))
;; Definitions and references
(new_command_definition
@ -54,11 +54,11 @@
(environment_definition
command: _ @function.macro
name: (curly_group_text (_) @text.reference))
name: (curly_group_text (_) @markup.link))
(theorem_definition
command: _ @function.macro
name: (curly_group_text (_) @text.environment.name))
name: (curly_group_text (_) @markup.environment.name))
(paired_delimiter_definition
command: _ @function.macro
@ -66,178 +66,178 @@
(label_definition
command: _ @function.macro
name: (curly_group_text (_) @text.reference))
name: (curly_group_text (_) @markup.link))
(label_reference_range
command: _ @function.macro
from: (curly_group_text (_) @text.reference)
to: (curly_group_text (_) @text.reference))
from: (curly_group_text (_) @markup.link)
to: (curly_group_text (_) @markup.link))
(label_reference
command: _ @function.macro
names: (curly_group_text_list (_) @text.reference))
names: (curly_group_text_list (_) @markup.link))
(label_number
command: _ @function.macro
name: (curly_group_text (_) @text.reference)
number: (_) @text.reference)
name: (curly_group_text (_) @markup.link)
number: (_) @markup.link)
(citation
command: _ @function.macro
keys: (curly_group_text_list) @text.reference)
keys: (curly_group_text_list) @markup.link)
(glossary_entry_definition
command: _ @function.macro
name: (curly_group_text (_) @text.reference))
name: (curly_group_text (_) @markup.link))
(glossary_entry_reference
command: _ @function.macro
name: (curly_group_text (_) @text.reference))
name: (curly_group_text (_) @markup.link))
(acronym_definition
command: _ @function.macro
name: (curly_group_text (_) @text.reference))
name: (curly_group_text (_) @markup.link))
(acronym_reference
command: _ @function.macro
name: (curly_group_text (_) @text.reference))
name: (curly_group_text (_) @markup.link))
(color_definition
command: _ @function.macro
name: (curly_group_text (_) @text.reference))
name: (curly_group_text (_) @markup.link))
(color_reference
command: _ @function.macro
name: (curly_group_text (_) @text.reference))
name: (curly_group_text (_) @markup.link))
;; Math
[
(displayed_equation)
(inline_formula)
] @text.math
] @markup.math
(math_environment
(begin
command: _ @text.math
name: (curly_group_text (text) @text.math)))
command: _ @markup.math
name: (curly_group_text (text) @markup.math)))
(math_environment
(text) @text.math)
(text) @markup.math)
(math_environment
(end
command: _ @text.math
name: (curly_group_text (text) @text.math)))
command: _ @markup.math
name: (curly_group_text (text) @markup.math)))
;; Sectioning
(title_declaration
command: _ @namespace
options: (brack_group (_) @text.title.1)?
text: (curly_group (_) @text.title.1))
command: _ @module
options: (brack_group (_) @markup.heading.1)?
text: (curly_group (_) @markup.heading.1))
(author_declaration
command: _ @namespace
command: _ @module
authors: (curly_group_author_list
((author)+ @text.title.1)))
((author)+ @markup.heading.1)))
(chapter
command: _ @namespace
toc: (brack_group (_) @text.title.2)?
text: (curly_group (_) @text.title.2))
command: _ @module
toc: (brack_group (_) @markup.heading.2)?
text: (curly_group (_) @markup.heading.2))
(part
command: _ @namespace
toc: (brack_group (_) @text.title.2)?
text: (curly_group (_) @text.title.2))
command: _ @module
toc: (brack_group (_) @markup.heading.2)?
text: (curly_group (_) @markup.heading.2))
(section
command: _ @namespace
toc: (brack_group (_) @text.title.3)?
text: (curly_group (_) @text.title.3))
command: _ @module
toc: (brack_group (_) @markup.heading.3)?
text: (curly_group (_) @markup.heading.3))
(subsection
command: _ @namespace
toc: (brack_group (_) @text.title.4)?
text: (curly_group (_) @text.title.4))
command: _ @module
toc: (brack_group (_) @markup.heading.4)?
text: (curly_group (_) @markup.heading.4))
(subsubsection
command: _ @namespace
toc: (brack_group (_) @text.title.5)?
text: (curly_group (_) @text.title.5))
command: _ @module
toc: (brack_group (_) @markup.heading.5)?
text: (curly_group (_) @markup.heading.5))
(paragraph
command: _ @namespace
toc: (brack_group (_) @text.title.6)?
text: (curly_group (_) @text.title.6))
command: _ @module
toc: (brack_group (_) @markup.heading.6)?
text: (curly_group (_) @markup.heading.6))
(subparagraph
command: _ @namespace
toc: (brack_group (_) @text.title.6)?
text: (curly_group (_) @text.title.6))
command: _ @module
toc: (brack_group (_) @markup.heading.6)?
text: (curly_group (_) @markup.heading.6))
;; Beamer frames
(generic_environment
(begin
name: (curly_group_text
(text) @text.environment.name)
(#any-of? @text.environment.name "frame"))
(text) @markup.environment.name)
(#any-of? @markup.environment.name "frame"))
.
(curly_group (_) @text.title))
(curly_group (_) @markup.heading))
((generic_command
command: (command_name) @_name
arg: (curly_group
(text) @text.title))
(text) @markup.heading))
(#eq? @_name "\\frametitle"))
;; Formatting
(text_mode
content: (curly_group (_) @text))
content: (curly_group (_) @none @spell))
((generic_command
command: (command_name) @_name
arg: (curly_group (_) @text.emphasis))
arg: (curly_group (_) @markup.italic))
(#eq? @_name "\\emph"))
((generic_command
command: (command_name) @_name
arg: (curly_group (_) @text.emphasis))
arg: (curly_group (_) @markup.italic))
(#any-of? @_name "\\textit" "\\mathit"))
((generic_command
command: (command_name) @_name
arg: (curly_group (_) @text.strong))
arg: (curly_group (_) @markup.strong))
(#any-of? @_name "\\textbf" "\\mathbf"))
((generic_command
command: (command_name) @_name
.
arg: (curly_group (_) @text.uri))
arg: (curly_group (_) @markup.link.url))
(#any-of? @_name "\\url" "\\href"))
;; File inclusion commands
(class_include
command: _ @include
command: _ @keyword.import
path: (curly_group_path) @string)
(package_include
command: _ @include
command: _ @keyword.import
paths: (curly_group_path_list) @string)
(latex_include
command: _ @include
command: _ @keyword.import
path: (curly_group_path) @string)
(import_include
command: _ @include
command: _ @keyword.import
directory: (curly_group_path) @string
file: (curly_group_path) @string)
(bibtex_include
command: _ @include
command: _ @keyword.import
path: (curly_group_path) @string)
(biblatex_include
"\\addbibresource" @include
glob: (curly_group_glob_pattern) @string.regex)
"\\addbibresource" @keyword.import
glob: (curly_group_glob_pattern) @string.regexp)
(graphics_include
command: _ @include
command: _ @keyword.import
path: (curly_group_path) @string)
(tikz_library_import
command: _ @include
command: _ @keyword.import
paths: (curly_group_path_list) @string)
(text) @spell

View file

@ -23,11 +23,11 @@
(option_value)
(check_in)
(check_out)
] @text.literal
] @markup.raw
((account) @field)
((account) @variable.member)
"include" @include
"include" @keyword.import
[
"account"

View file

@ -34,23 +34,23 @@
"transition"
] @keyword.function
"import" @include
"import" @keyword.import
"return" @keyword.return
(return_arrow) @punctuation.delimiter
"for" @repeat
"for" @keyword.repeat
[
"else"
"if"
] @conditional
] @keyword.conditional
[
(ternary_if)
(ternary_else)
] @conditional.ternary
] @keyword.conditional.ternary
[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket
@ -118,11 +118,11 @@
] @string.special
;record declaration
(record_declaration (identifier) @field)
(record_declaration (identifier) @variable.member)
;struct component
(struct_component_declaration
(identifier) @field)
(identifier) @variable.member)
(type) @type
@ -140,7 +140,7 @@
(record_type
(locator
(identifier) @field))
(identifier) @variable.member))
(transition_declaration
name: (identifier) @function.builtin)
@ -159,13 +159,13 @@
(method_call
. (_)
. (identifier) @method.call)
. (identifier) @function.method.call)
(function_parameter
(identifier) @parameter)
(identifier) @variable.parameter)
(struct_declaration
name: (identifier) @field)
name: (identifier) @variable.member)
(variable_declaration
(identifier_or_identifiers

View file

@ -13,13 +13,13 @@
; Conditionals
(conditional_expression [ "?" ":" ] @conditional.ternary)
(conditional_expression [ "?" ":" ] @keyword.conditional.ternary)
; Variables
(symbol) @variable
(filename) @string.special @text.underline
(filename) @string.special.path
; Functions
@ -27,8 +27,8 @@
function: (symbol) @function.call)
((call_expression
function: (symbol) @preproc)
(#eq? @preproc "DEFINED"))
function: (symbol) @keyword.directive)
(#eq? @keyword.directive "DEFINED"))
((call_expression
function: (symbol) @function.builtin)
@ -52,7 +52,7 @@
[
"ORIGIN" "org" "o"
"LENGTH" "len" "l"
] @field.builtin
] @variable.member.builtin
; Constants
@ -80,7 +80,7 @@
; Exceptions
"ASSERT" @exception
"ASSERT" @keyword.exception
[
"/DISCARD/"

Some files were not shown because too many files have changed in this diff Show more