]> git.lizzy.rs Git - micro.git/commitdiff
Better Julia syntax. (#1567)
authorKoki Fushimi <paalon1936@gmail.com>
Tue, 24 Mar 2020 14:59:48 +0000 (23:59 +0900)
committerGitHub <noreply@github.com>
Tue, 24 Mar 2020 14:59:48 +0000 (10:59 -0400)
* Fix regex syntax and change to match one or more spaces.

* Add constant `nothing` and `missing`.

* Add Inf and NaN to constant numbers.

runtime/syntax/julia.yaml

index 984a8c19b6e07a293e9d76684b9ca7377e0fe1d4..8ee2439db7cdad2d0d51bb3c6ac7a9df449e54fd 100644 (file)
@@ -8,13 +8,14 @@ rules:
 
     # built-in objects
     - constant.bool: "\\b(true|false)\\b"
+    - constant: "\\b(nothing|missing)\\b"
       # built-in attributes
     - constant: "__[A-Za-z0-9_]+__"
       # definitions
     - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
       # keywords
     - statement: "\\b(baremodule|begin|break|catch|const|continue|do|else|elseif|end|export|finally|for|function|global|if|import|let|local|macro|module|quote|return|struct|try|using|while)\\b"
-    - statement: "\\b(abstract type|primitive type|mutable struct\\b)"
+    - statement: "\\b(abstract\\s+type|primitive\\s+type|mutable\\s+struct)\\b"
       # decorators
     - identifier.macro: "@[A-Za-z0-9_]+"
       # operators
@@ -22,7 +23,7 @@ rules:
       # parentheses
     - symbol.brackets: "([(){}]|\\[|\\])"
       # 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]+)*)\\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}'"