aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorChrHorn2022-11-05 18:30:40 +0000
committerGitHub2022-11-05 18:30:40 +0000
commit4ec2a21c6e21ab4e515f1bd7ee1049094af2a6b2 (patch)
treea51150f224d6cce28b80ab60d8b95b0acfb059b8 /runtime
parent38149872989477f62222ce68dc32d2d6018ae165 (diff)
Update Julia grammar, queries (#4588)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/queries/julia/highlights.scm42
-rw-r--r--runtime/queries/julia/locals.scm3
2 files changed, 38 insertions, 7 deletions
diff --git a/runtime/queries/julia/highlights.scm b/runtime/queries/julia/highlights.scm
index 9271615f..90baee21 100644
--- a/runtime/queries/julia/highlights.scm
+++ b/runtime/queries/julia/highlights.scm
@@ -7,13 +7,22 @@
(block_comment)
] @comment
-(((identifier) @constant.builtin) (match? @constant.builtin "^(nothing|missing|Inf|NaN)$"))
-(((identifier) @constant.builtin.boolean) (#eq? @constant.builtin.boolean "true"))
-(((identifier) @constant.builtin.boolean) (#eq? @constant.builtin.boolean "false"))
+(
+ ((identifier) @constant.builtin)
+ (#match? @constant.builtin "^(nothing|missing|undef)$"))
+
+[
+ (true)
+ (false)
+] @constant.builtin.boolean
(integer_literal) @constant.numeric.integer
(float_literal) @constant.numeric.float
+(
+ ((identifier) @constant.numeric.float)
+ (#match? @constant.numeric.float "^((Inf|NaN)(16|32|64)?)$"))
+
(character_literal) @constant.character
(escape_sequence) @constant.character.escape
@@ -66,7 +75,7 @@
(type_parameter_list
(identifier) @type)
-(constrained_parameter
+(constrained_type_parameter
(identifier) @type)
(subtype_clause
@@ -81,13 +90,32 @@
(type_argument_list
(identifier) @type)
+(where_clause
+ (identifier) @type)
+
; -------------------
; Function definition
; -------------------
(
(function_definition
- name: (identifier) @function)
+ name: [
+ (identifier) @function
+ (scoped_identifier
+ (identifier) @namespace
+ (identifier) @function)
+ ])
+ ; prevent constructors (PascalCase) to be highlighted as functions
+ (#match? @function "^[^A-Z]"))
+
+(
+ (short_function_definition
+ name: [
+ (identifier) @function
+ (scoped_identifier
+ (identifier) @namespace
+ (identifier) @function)
+ ])
; prevent constructors (PascalCase) to be highlighted as functions
(#match? @function "^[^A-Z]"))
@@ -101,7 +129,7 @@
(optional_parameter
. (identifier) @variable.parameter)
-(spread_parameter
+(slurp_parameter
(identifier) @variable.parameter)
(function_expression
@@ -185,6 +213,7 @@
[
"abstract"
+ "baremodule"
"begin"
"const"
"do"
@@ -198,6 +227,7 @@
"return"
"struct"
"type"
+ "where"
] @keyword
; TODO: fix this
diff --git a/runtime/queries/julia/locals.scm b/runtime/queries/julia/locals.scm
index 07b96f2c..70b31e50 100644
--- a/runtime/queries/julia/locals.scm
+++ b/runtime/queries/julia/locals.scm
@@ -21,7 +21,7 @@
(optional_parameter .
(identifier) @local.definition)
-(spread_parameter
+(slurp_parameter
(identifier) @local.definition)
(function_expression
@@ -33,6 +33,7 @@
[
(function_definition)
+ (short_function_definition)
(macro_definition)
] @local.scope