mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add comment highlighting to JSONata and fix regex handling
Closes #2701
This commit is contained in:
parent
19726cf428
commit
5a174ba014
@ -12,7 +12,7 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
|
||||
jsonataFunctions.sort(function(A,B) {
|
||||
return B.length-A.length;
|
||||
});
|
||||
jsonataFunctions = jsonataFunctions.join("|").replace(/\$/g,"\\$");
|
||||
jsonataFunctions = "("+jsonataFunctions.join("|").replace(/\$/g,"\\$")+")(\\b)";
|
||||
|
||||
var JSONataHighlightRules = function() {
|
||||
|
||||
@ -27,12 +27,17 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
|
||||
"function"
|
||||
}, "identifier");
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
"no_regex" : [
|
||||
{
|
||||
token: "string.regexp",
|
||||
regex: "\\/",
|
||||
next: "regex"
|
||||
token : "comment.doc", // doc comment
|
||||
regex : "\\/\\*",
|
||||
next : "comments"
|
||||
},
|
||||
// {
|
||||
// token: "string.regexp",
|
||||
// regex: "\\/",
|
||||
// next: "regex"
|
||||
// },
|
||||
{
|
||||
token : "string",
|
||||
regex : "'(?=.)",
|
||||
@ -91,7 +96,7 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
|
||||
{
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "start"
|
||||
next : "no_regex"
|
||||
},
|
||||
{
|
||||
defaultToken: "string"
|
||||
@ -101,7 +106,7 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
|
||||
{
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "start"
|
||||
next : "no_regex"
|
||||
},
|
||||
{
|
||||
defaultToken: "string"
|
||||
@ -110,15 +115,37 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
|
||||
"regex" : [
|
||||
{
|
||||
token: "string.regexp",
|
||||
regex: "\\\\/"
|
||||
regex: "/[sxngimy]*",
|
||||
next: "start"
|
||||
}, {
|
||||
defaultToken: "string.regexp"
|
||||
}
|
||||
],
|
||||
"start": [
|
||||
{
|
||||
token : "comment.doc", // doc comment
|
||||
regex : "\\/\\*",
|
||||
next : "comments"
|
||||
},
|
||||
{
|
||||
token: "string.regexp",
|
||||
regex: "/[sxngimy]*",
|
||||
regex: "\\/",
|
||||
next: "regex",
|
||||
},{
|
||||
// immediately return to the start mode without matching
|
||||
// anything
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "no_regex"
|
||||
}],
|
||||
"comments": [
|
||||
{
|
||||
token : "comment.doc", // doc comment
|
||||
regex : "\\*\\/",
|
||||
next : "start"
|
||||
},
|
||||
{
|
||||
defaultToken: "string.regexp"
|
||||
defaultToken: "comment.doc"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user