Improve grammar definitions

pull/724/head
Blaž Hrastnik 3 years ago
parent 37606bad47
commit a6108baec9

@ -1 +1 @@
Subproject commit 0ba7a24b062b671263ae08e707e9e94383b25bb7
Subproject commit 12ea597262125fc22fd2e91aa953ac69b19c26ca

@ -1,9 +1,3 @@
(identifier) @variable
;; In case you want type highlighting based on Julia naming conventions (this might collide with mathematical notation)
;((identifier) @type ; exception: mark `A_foo` sort of identifiers as variables
;(match? @type "^[A-Z][^_]"))
((identifier) @constant
(match? @constant "^[A-Z][A-Z_]{2}[A-Z_]*$"))
[
(triple_string)
@ -28,43 +22,43 @@
(call_expression
(identifier) @function)
(call_expression
(field_expression (identifier) @method .))
(field_expression (identifier) @function.method .))
(broadcast_call_expression
(identifier) @function)
(broadcast_call_expression
(field_expression (identifier) @method .))
(field_expression (identifier) @function.method .))
(parameter_list
(identifier) @parameter)
(identifier) @variable.parameter)
(parameter_list
(optional_parameter .
(identifier) @parameter))
(identifier) @variable.parameter))
(typed_parameter
(identifier) @parameter
(identifier) @variable.parameter
(identifier) @type)
(type_parameter_list
(identifier) @type)
(typed_parameter
(identifier) @parameter
(identifier) @variable.parameter
(parameterized_identifier) @type)
(function_expression
. (identifier) @parameter)
(spread_parameter) @parameter
. (identifier) @variable.parameter)
(spread_parameter) @variable.parameter
(spread_parameter
(identifier) @parameter)
(identifier) @variable.parameter)
(named_argument
. (identifier) @parameter)
. (identifier) @variable.parameter)
(argument_list
(typed_expression
(identifier) @parameter
(identifier) @variable.parameter
(identifier) @type))
(argument_list
(typed_expression
(identifier) @parameter
(identifier) @variable.parameter
(parameterized_identifier) @type))
;; Symbol expressions (:my-wanna-be-lisp-keyword)
(quote_expression
(identifier)) @symbol
(identifier)) @string.special.symbol
;; Parsing error! foo (::Type) get's parsed as two quote expressions
(argument_list
@ -76,7 +70,7 @@
(identifier) @type)
(parameterized_identifier (_)) @type
(argument_list
(typed_expression . (identifier) @parameter))
(typed_expression . (identifier) @variable.parameter))
(typed_expression
(identifier) @type .)
@ -113,13 +107,13 @@
"end" @keyword
(if_statement
["if" "end"] @conditional)
["if" "end"] @keyword.control.conditional)
(elseif_clause
["elseif"] @conditional)
["elseif"] @keyword.control.conditional)
(else_clause
["else"] @conditional)
["else"] @keyword.control.conditional)
(ternary_expression
["?" ":"] @conditional)
["?" ":"] @keyword.control.conditional)
(function_definition ["function" "end"] @keyword.function)
@ -134,47 +128,57 @@
"type"
] @keyword
((identifier) @keyword (#any-of? @keyword "global" "local"))
((identifier) @keyword (match? @keyword "global|local"))
(compound_expression
["begin" "end"] @keyword)
(try_statement
["try" "end" ] @exception)
["try" "end" ] @keyword.control.exception)
(finally_clause
"finally" @exception)
"finally" @keyword.control.exception)
(catch_clause
"catch" @exception)
"catch" @keyword.control.exception)
(quote_statement
["quote" "end"] @keyword)
(let_statement
["let" "end"] @keyword)
(for_statement
["for" "end"] @repeat)
["for" "end"] @keyword.control.repeat)
(while_statement
["while" "end"] @repeat)
(break_statement) @repeat
(continue_statement) @repeat
["while" "end"] @keyword.control.repeat)
(break_statement) @keyword.control.repeat
(continue_statement) @keyword.control.repeat
(for_binding
"in" @repeat)
"in" @keyword.control.repeat)
(for_clause
"for" @repeat)
"for" @keyword.control.repeat)
(do_clause
["do" "end"] @keyword)
(export_statement
["export"] @include)
["export"] @keyword.control.import)
[
"using"
"module"
"import"
] @include
] @keyword.control.import
((identifier) @include (#eq? @include "baremodule"))
((identifier) @keyword.control.import (#eq? @keyword.control.import "baremodule"))
(((identifier) @constant.builtin) (match? @constant.builtin "^(nothing|Inf|NaN)$"))
(((identifier) @boolean) (eq? @boolean "true"))
(((identifier) @boolean) (eq? @boolean "false"))
(((identifier) @constant.builtin.boolean) (#eq? @constant.builtin.boolean "true"))
(((identifier) @constant.builtin.boolean) (#eq? @constant.builtin.boolean "false"))
["::" ":" "." "," "..." "!"] @punctuation.delimiter
["[" "]" "(" ")" "{" "}"] @punctuation.bracket
["="] @operator
(identifier) @variable
;; In case you want type highlighting based on Julia naming conventions (this might collide with mathematical notation)
;((identifier) @type ; exception: mark `A_foo` sort of identifiers as variables
;(match? @type "^[A-Z][^_]"))
((identifier) @constant
(match? @constant "^[A-Z][A-Z_]{2}[A-Z_]*$"))

@ -259,7 +259,7 @@
(comment) @comment
(bracket_group) @parameter
(bracket_group) @variable.parameter
[(math_operator) "="] @operator
@ -312,7 +312,7 @@
key: (word) @text.reference)
(key_val_pair
key: (_) @parameter
key: (_) @variable.parameter
value: (_))
["[" "]" "{" "}"] @punctuation.bracket ;"(" ")" is has no special meaning in LaTeX

@ -108,7 +108,7 @@
[
(false)
(true)
] @boolean
] @constant.builtin.boolean
(nil) @constant.builtin
(spread) @constant ;; "..."
((identifier) @constant
@ -116,7 +116,7 @@
;; Parameters
(parameters
(identifier) @parameter)
(identifier) @variable.parameter)
; ;; Functions
(function [(function_name) (identifier)] @function)
@ -139,8 +139,8 @@
(function_call
[
((identifier) @variable (method) @method)
((_) (method) @method)
((identifier) @variable (method) @function.method)
((_) (method) @function.method)
(identifier) @function
(field_expression (property_identifier) @function)
]

@ -25,12 +25,12 @@
(external (value_name) @function)
(method_name) @method
(method_name) @function.method
; Variables
;----------
(value_pattern) @parameter
(value_pattern) @variable.parameter
; Application
;------------

@ -17,7 +17,7 @@
(escape_sequence) @escape
(primitive_type) @type.builtin
(boolean_literal) @constant.builtin
(boolean_literal) @constant.builtin.boolean
[
(integer_literal)
(float_literal)

@ -1,6 +1,6 @@
(block_mapping_pair key: (_) @property)
(flow_mapping (_ key: (_) @property))
(boolean_scalar) @boolean
(boolean_scalar) @constant.builtin.boolean
(null_scalar) @constant.builtin
(double_quote_scalar) @string
(single_quote_scalar) @string

Loading…
Cancel
Save