Skip to content

Commit

Permalink
highlight hex floats and invalid numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexu committed Aug 31, 2022
1 parent ac25b33 commit ef039ef
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions syntaxes/zig.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@
},
{
"match": "[\\s\\(\\[\\{](\\.@\"[^\"]*\")(?!\\s*=[^>]|\\s*\\()",
"captures": {
"1": {
"name": "variable.other.enummember.zig"
}
"captures": {
"1": {
"name": "variable.other.enummember.zig"
}
}
},
{
"name": "keyword.default.zig",
Expand Down Expand Up @@ -334,6 +334,10 @@
},
"numbers": {
"patterns": [
{
"name": "constant.numeric.hexfloat.zig",
"match": "\\b0x[0-9a-fA-F][0-9a-fA-F_]*(\\.[0-9a-fA-F][0-9a-fA-F_]*)?([pP][+-]?[0-9a-fA-F_]+)?\\b"
},
{
"name": "constant.numeric.float.zig",
"match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?([eE][+-]?[0-9_]+)?\\b"
Expand All @@ -353,6 +357,10 @@
{
"name": "constant.numeric.binary.zig",
"match": "\\b0b[01_]+\\b"
},
{
"name": "constant.numeric.invalid.zig",
"match": "\\b[0-9](([eEpP][+-])|[0-9a-zA-Z_])*(\\.(([eEpP][+-])|[0-9a-zA-Z_])*)?([eEpP][+-])?[0-9a-zA-Z_]*\\b"
}
]
},
Expand All @@ -366,4 +374,4 @@
]
}
}
}
}

0 comments on commit ef039ef

Please sign in to comment.