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) {
|
jsonataFunctions.sort(function(A,B) {
|
||||||
return B.length-A.length;
|
return B.length-A.length;
|
||||||
});
|
});
|
||||||
jsonataFunctions = jsonataFunctions.join("|").replace(/\$/g,"\\$");
|
jsonataFunctions = "("+jsonataFunctions.join("|").replace(/\$/g,"\\$")+")(\\b)";
|
||||||
|
|
||||||
var JSONataHighlightRules = function() {
|
var JSONataHighlightRules = function() {
|
||||||
|
|
||||||
@ -27,12 +27,17 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
|
|||||||
"function"
|
"function"
|
||||||
}, "identifier");
|
}, "identifier");
|
||||||
this.$rules = {
|
this.$rules = {
|
||||||
"start" : [
|
"no_regex" : [
|
||||||
{
|
{
|
||||||
token: "string.regexp",
|
token : "comment.doc", // doc comment
|
||||||
regex: "\\/",
|
regex : "\\/\\*",
|
||||||
next: "regex"
|
next : "comments"
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// token: "string.regexp",
|
||||||
|
// regex: "\\/",
|
||||||
|
// next: "regex"
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : "'(?=.)",
|
regex : "'(?=.)",
|
||||||
@ -91,7 +96,7 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
|
|||||||
{
|
{
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : '"|$',
|
regex : '"|$',
|
||||||
next : "start"
|
next : "no_regex"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
defaultToken: "string"
|
defaultToken: "string"
|
||||||
@ -101,7 +106,7 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
|
|||||||
{
|
{
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : "'|$",
|
regex : "'|$",
|
||||||
next : "start"
|
next : "no_regex"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
defaultToken: "string"
|
defaultToken: "string"
|
||||||
@ -110,15 +115,37 @@ ace.define("ace/mode/jsonata",["require","exports","module","ace/lib/oop","ace/m
|
|||||||
"regex" : [
|
"regex" : [
|
||||||
{
|
{
|
||||||
token: "string.regexp",
|
token: "string.regexp",
|
||||||
regex: "\\\\/"
|
regex: "/[sxngimy]*",
|
||||||
|
next: "start"
|
||||||
|
}, {
|
||||||
|
defaultToken: "string.regexp"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": [
|
||||||
|
{
|
||||||
|
token : "comment.doc", // doc comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "comments"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
token: "string.regexp",
|
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"
|
next : "start"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
defaultToken: "string.regexp"
|
defaultToken: "comment.doc"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user