Add better regex highlighting in jsonata edit mode

Fixes #2465
This commit is contained in:
Nick O'Leary 2020-02-24 13:27:42 +00:00
parent 04d3981921
commit e16fe1e6a5
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 52 additions and 30 deletions

View File

@ -28,6 +28,11 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
}, "identifier"); }, "identifier");
this.$rules = { this.$rules = {
"start" : [ "start" : [
{
token: "string.regexp",
regex: "\\/",
next: "regex"
},
{ {
token : "string", token : "string",
regex : "'(?=.)", regex : "'(?=.)",
@ -46,7 +51,8 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
token : "constant.numeric", // float token : "constant.numeric", // float
regex : /[+-]?\d[\d_]*(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ regex : /[+-]?\d[\d_]*(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
}, },
{ token: "keyword", {
token: "keyword",
regex: /λ/ regex: /λ/
}, },
{ {
@ -86,7 +92,8 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
token : "string", token : "string",
regex : '"|$', regex : '"|$',
next : "start" next : "start"
}, { },
{
defaultToken: "string" defaultToken: "string"
} }
], ],
@ -95,9 +102,24 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
token : "string", token : "string",
regex : "'|$", regex : "'|$",
next : "start" next : "start"
}, { },
{
defaultToken: "string" defaultToken: "string"
} }
],
"regex" : [
{
token: "string.regexp",
regex: "\\\\/"
},
{
token: "string.regexp",
regex: "/[sxngimy]*",
next: "start"
},
{
defaultToken: "string.regexp"
}
] ]
}; };
}; };