Skip to content

Commit

Permalink
Merge pull request #1578 from zoodogood/LSP-(number)--fix
Browse files Browse the repository at this point in the history
Syntax highlighting: fix leading `_` being treated as a number
  • Loading branch information
STRd6 authored Nov 5, 2024
2 parents cbfdce2 + 6078e4f commit b9386d9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lsp/syntaxes/civet.json
Original file line number Diff line number Diff line change
Expand Up @@ -871,19 +871,19 @@
"numbers": {
"patterns": [
{
"match": "\\b(?<!\\$)0(x|X)[0-9a-fA-F]+\\b(?!\\$)",
"match": "\\b(?<!\\$)0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\\b(?!\\$)",
"name": "constant.numeric.hex.civet"
},
{
"match": "\\b(?<!\\$)0(b|B)[01]+\\b(?!\\$)",
"match": "\\b(?<!\\$)0(b|B)[01][01_]*\\b(?!\\$)",
"name": "constant.numeric.binary.civet"
},
{
"match": "\\b(?<!\\$)0(o|O)?[0-7]+\\b(?!\\$)",
"match": "\\b(?<!\\$)0(o|O)?[0-7][0-7_]*\\b(?!\\$)",
"name": "constant.numeric.octal.civet"
},
{
"match": "(?x)\n(?<!\\$)(?:\n (?:\\b[0-9]+(\\.)[0-9]+[eE][+-]?[0-9]+\\b)| # 1.1E+3\n (?:\\b[0-9]+(\\.)[eE][+-]?[0-9]+\\b)| # 1.E+3\n (?:\\B(\\.)[0-9]+[eE][+-]?[0-9]+\\b)| # .1E+3\n (?:\\b[0-9]+[eE][+-]?[0-9]+\\b)| # 1E+3\n (?:\\b[0-9]+(\\.)[0-9]+\\b)| # 1.1\n (?:\\b[0-9]+(?=\\.{2,3}))| # 1 followed by a slice\n (?:\\b[0-9]+(\\.)\\B)| # 1.\n (?:\\B(\\.)[0-9]+\\b)| # .1\n (?:\\b[0-9]+\\b(?!\\.)) # 1\n)(?!\\$)",
"match": "(?x)\n(?<!\\$)(?:\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1.1E+3\n (?:\\b[0-9][0-9_]*(\\.)[eE][+-]?[0-9][0-9_]*\\b)| # 1.E+3\n (?:\\B(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # .1E+3\n (?:\\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*\\b)| # 1E+3\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*\\b)| # 1.1\n (?:\\b[0-9][0-9_]*(?=\\.{2,3}))| # 1 followed by a slice\n (?:\\b[0-9][0-9_]*(\\.)\\B)| # 1.\n (?:\\B(\\.)[0-9][0-9_]*\\b)| # .1\n (?:\\b[0-9][0-9_]*\\b(?!\\.)) # 1\n)(?!\\$)",
"captures": {
"0": {
"name": "constant.numeric.decimal.civet"
Expand Down

0 comments on commit b9386d9

Please sign in to comment.