summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergio Alejandro Vargas <savargasqu+git@unal.edu.co>2022-04-15 17:15:51 -0500
committerChristian Clason <christian.clason@uni-due.de>2022-04-16 00:28:00 +0200
commit394e7f804831dfebf4286d88850fe9bba5db1ee1 (patch)
tree74bfceaaffdf970ae46188fbfdd0c351e6150d51
parent8ab11853a3938d2b92d2e2d42a64923dc00df124 (diff)
highlights(julia): Update literals
Add queries for: - Character literals - Escape sequences - NaNs, Infs and missing Remove highlight to identifiers in coefficient expressions. Update other literals to match grammar.
-rw-r--r--queries/julia/highlights.scm58
1 files changed, 33 insertions, 25 deletions
diff --git a/queries/julia/highlights.scm b/queries/julia/highlights.scm
index 7b12369e..12c159bc 100644
--- a/queries/julia/highlights.scm
+++ b/queries/julia/highlights.scm
@@ -5,16 +5,6 @@
((identifier) @constant
(#match? @constant "^[A-Z][A-Z_]{2}[A-Z_]*$"))
-(escape_sequence) @character.special
-(character_literal) @character
-(string_literal) @string
-(command_literal) @string.special
-
-(prefixed_string_literal
- prefix: (identifier) @constant.builtin)
-(prefixed_command_literal
- prefix: (identifier) @constant.builtin)
-
(macro_identifier) @function.macro
(macro_identifier (identifier) @function.macro) ; for any one using the variable highlight
(macro_definition
@@ -90,10 +80,6 @@
(struct_definition
name: (identifier) @type)
-[
- (integer_literal)
- (float_literal)
-] @number
(range_expression
(identifier) @number
(#eq? @number "end"))
@@ -101,9 +87,6 @@
(_
(identifier) @number
(#eq? @number "end")))
-(coefficient_expression
- [(integer_literal) (float_literal)]
- (identifier) @constant.builtin)
;; TODO: operators.
;; Those are a bit difficult to implement since the respective nodes are hidden right now (_power_operator)
@@ -131,11 +114,6 @@
(function_definition ["function" "end"] @keyword.function)
[
- (line_comment)
- (block_comment)
-] @comment
-
-[
"abstract"
"const"
"macro"
@@ -184,9 +162,39 @@
((identifier) @include (#eq? @include "baremodule"))
-(((identifier) @constant.builtin) (#match? @constant.builtin "^(nothing|Inf|NaN)$"))
-(((identifier) @boolean) (#eq? @boolean "true"))
-(((identifier) @boolean) (#eq? @boolean "false"))
+
+;;; Literals
+
+(integer_literal) @number
+(float_literal) @float
+
+((identifier) @float
+ (#any-of? @float "NaN" "NaN16" "NaN32"
+ "Inf" "Inf16" "Inf32"))
+
+((identifier) @boolean
+ (#any-of? @boolean "true" "false"))
+
+((identifier) @constant.builtin
+ (#any-of? @constant.builtin "nothing" "missing"))
+
+(character_literal) @character
+(escape_sequence) @string.escape
+
+(string_literal) @string
+(prefixed_string_literal
+ prefix: (identifier) @function.macro) @string
+
+(command_literal) @string.special
+(prefixed_command_literal
+ prefix: (identifier) @function.macro) @string.special
+
+[
+ (line_comment)
+ (block_comment)
+] @comment
+
+;;; Punctuation
(range_expression ":" @operator)
(quote_expression ":" @symbol)