]> git.lizzy.rs Git - micro.git/commitdiff
Fix Lua number syntax highlighting (#2409)
authorLars Müller <34514239+appgurueu@users.noreply.github.com>
Thu, 28 Apr 2022 22:28:28 +0000 (00:28 +0200)
committerGitHub <noreply@github.com>
Thu, 28 Apr 2022 22:28:28 +0000 (15:28 -0700)
* Fix Lua number syntax highlighting

* Number RegEx: Fix hex exponent

The hex exponent doesn't support hex digits, only decimals.

runtime/syntax/lua.yaml

index 934f6a317508b665647314dd5e2b404c63393c35..71df510f55d1c2b4c5cf9dc1835dbb1674a46f0b 100644 (file)
@@ -22,10 +22,12 @@ rules:
     - identifier: "\\b(self|arg)\\b"
     - constant: "\\b(false|nil|true)\\b"
     - statement: "(\\b(dofile|require|include)|%q|%!|%Q|%r|%x)\\b"
-    - constant.number: "\\b([0-9]+)\\b"
+
     - symbol.brackets: "[(){}\\[\\]]"
     - symbol: "(\\*|//|/|%|\\+|-|\\^|>|>=|<|<=|~=|=|[\\.]{2,3}|#)"
 
+    - constant.number: "\\b((0[xX](([0-9A-Fa-f]+\\.[0-9A-Fa-f]*)|(\\.?[0-9A-Fa-f]+))([pP][-+]?[0-9]+)?)|((([0-9]+\\.[0-9]*)|(\\.?[0-9]+))([eE][-+]?[0-9]+)?))"    
+
     - constant.string:
         start: "\""
         end: "\""
@@ -73,8 +75,6 @@ rules:
         rules:
             - constant.specialChar: "\\\\."
 
-    - special: "\\\\[0-7][0-7][0-7]|\\\\x[0-9a-fA-F][0-9a-fA-F]|\\\\[abefnrs]|(\\\\c|\\\\C-|\\\\M-|\\\\M-\\\\C-)."
-
     - comment.block:
         start: "\\-\\-\\[\\["
         end: "\\]\\]"