Julia syntax improvements (#2415)

* fix D syntax highlighting for integer literals with underscores

* improve julia syntax highlighting for strings, chars and operators
This commit is contained in:
Mikko 2022-05-15 23:00:59 +03:00 committed by GitHub
parent 656e0a8a7b
commit c57c5c04e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 10 deletions

View file

@ -10,7 +10,7 @@ rules:
# Octal integer literals are deprecated # Octal integer literals are deprecated
- error: "(0[0-7_]*)(L[uU]?|[uU]L?)?" - error: "(0[0-7_]*)(L[uU]?|[uU]L?)?"
# Decimal integer literals # Decimal integer literals
- constant.number: "([0-9]|[1-9][0-9_]*)(L[uU]?|[uU]L?)?" - constant.number: "([0-9]|[1-9][0-9_]*)(L[uU]?|[uU]L?)?\\b"
# Binary integer literals # Binary integer literals
- constant: "(0[bB][01_]*)(L[uU]?|[uU]L?)?" - constant: "(0[bB][01_]*)(L[uU]?|[uU]L?)?"
# Decimal float literals # Decimal float literals

View file

@ -19,30 +19,40 @@ rules:
# decorators # decorators
- identifier.macro: "@[A-Za-z0-9_]+" - identifier.macro: "@[A-Za-z0-9_]+"
# operators # operators
- symbol.operator: "[-+*/|=%<>&~^]|\\b(in|isa|where)\\b" - symbol.operator: "[:+*|=!%~<>/\\-?&\\\\÷∈∉∘]|\\b(in|isa|where)\\b"
# for some reason having ^ in the same regex with the other operators broke things
- symbol.operator: "\\^"
# parentheses # parentheses
- symbol.brackets: "([(){}]|\\[|\\])" - symbol.brackets: "([(){}]|\\[|\\])"
# numbers # numbers
- constant.number: "\\b([0-9]+(_[0-9]+)*|0x[0-9a-fA-F]+(_[0-9a-fA-F]+)*|0b[01]+(_[01]+)*|0o[0-7]+(_[0-7]+)*|Inf(16|32|64)?|NaN(16|32|64)?)\\b" - constant.number: "\\b([0-9]+(_[0-9]+)*|0x[0-9a-fA-F]+(_[0-9a-fA-F]+)*|0b[01]+(_[01]+)*|0o[0-7]+(_[0-7]+)*|Inf(16|32|64)?|NaN(16|32|64)?)\\b"
- constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^']){1}'"
- constant.string: - constant.string:
start: "\"\"\"" start: "\"\"\""
end: "\"\"\"" end: "\"\"\""
rules: [] rules: []
- constant.string: - constant.string:
start: "\"[^\"]|\"$" start: "\""
end: "\"" end: "\""
rules: [] skip: "\\\\."
rules:
- constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{1,4}|U[0-9A-Fa-f]{1,8})"
- comment: - constant.string:
start: "#[^=]|#$" start: "'"
end: "$" end: "'"
rules: [] skip: "\\\\."
rules:
- error: "..+"
- constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{1,4}|U[0-9A-Fa-f]{1,8})"
- comment: - comment:
start: "#=" start: "#="
end: "=#" end: "=#"
rules: [] rules: []
- comment:
start: "#"
end: "$"
rules: []