Added support for DataWeave language (#2659)
This commit is contained in:
parent
24574406da
commit
0803525b21
File diff suppressed because one or more lines are too long
|
@ -290,6 +290,10 @@
|
|||
"require": "clike",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"dataweave": {
|
||||
"title": "DataWeave",
|
||||
"owner": "machaval"
|
||||
},
|
||||
"dax": {
|
||||
"title": "DAX",
|
||||
"owner": "peterbud"
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
(function (Prism) {
|
||||
Prism.languages.dataweave = {
|
||||
'url': /\b[A-Za-z]+:\/\/[\w/:.?=&-]+|\burn:[\w:.?=&-]+/,
|
||||
'property': {
|
||||
pattern: /(?:\w+#)?(?:"(?:\\.|[^\\"\r\n])*"|\w+)(?=\s*[:@])/,
|
||||
greedy: true
|
||||
},
|
||||
'string': {
|
||||
pattern: /(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1/,
|
||||
greedy: true
|
||||
},
|
||||
'mime-type': /\b(?:text|audio|video|application|multipart|image)\/[\w+-]+/,
|
||||
'date': {
|
||||
pattern: /\|[\w:+-]+\|/,
|
||||
greedy: true
|
||||
},
|
||||
'comment': [
|
||||
{
|
||||
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
||||
lookbehind: true,
|
||||
greedy: true
|
||||
},
|
||||
{
|
||||
pattern: /(^|[^\\:])\/\/.*/,
|
||||
lookbehind: true,
|
||||
greedy: true
|
||||
}
|
||||
],
|
||||
'regex': {
|
||||
pattern: /\/(?:[^\\\/\r\n]|\\[^\r\n])+\//,
|
||||
greedy: true
|
||||
},
|
||||
'function': /\b[A-Za-z_]\w*(?=\s*\()/i,
|
||||
'number': /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
||||
'punctuation': /[{}[\];(),.:@]/,
|
||||
'operator': /<<|>>|->|[<>~=]=?|!=|--?-?|\+\+?|\!|\?/,
|
||||
'boolean': /\b(?:true|false)\b/,
|
||||
'keyword': /\b(?:match|input|output|ns|type|update|null|if|else|using|unless|at|is|as|case|do|fun|var|not|and|or)\b/
|
||||
};
|
||||
|
||||
}(Prism));
|
|
@ -0,0 +1 @@
|
|||
Prism.languages.dataweave={url:/\b[A-Za-z]+:\/\/[\w/:.?=&-]+|\burn:[\w:.?=&-]+/,property:{pattern:/(?:\w+#)?(?:"(?:\\.|[^\\"\r\n])*"|\w+)(?=\s*[:@])/,greedy:!0},string:{pattern:/(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1/,greedy:!0},"mime-type":/\b(?:text|audio|video|application|multipart|image)\/[\w+-]+/,date:{pattern:/\|[\w:+-]+\|/,greedy:!0},comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],regex:{pattern:/\/(?:[^\\\/\r\n]|\\[^\r\n])+\//,greedy:!0},function:/\b[A-Za-z_]\w*(?=\s*\()/i,number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\];(),.:@]/,operator:/<<|>>|->|[<>~=]=?|!=|--?-?|\+\+?|\!|\?/,boolean:/\b(?:true|false)\b/,keyword:/\b(?:match|input|output|ns|type|update|null|if|else|using|unless|at|is|as|case|do|fun|var|not|and|or)\b/};
|
|
@ -0,0 +1,39 @@
|
|||
<h2>Full example</h2>
|
||||
<pre><code>
|
||||
%dw 2.0
|
||||
input payalod application/json
|
||||
ns ns0 http://localhost.com
|
||||
var a = 123
|
||||
type T = String
|
||||
fun test(a: Number) = a + 123
|
||||
output application/json
|
||||
---
|
||||
{
|
||||
// This is a comment
|
||||
/**
|
||||
This is a multiline comment
|
||||
**/
|
||||
name: payload.name,
|
||||
string: "this",
|
||||
'another string': true,
|
||||
"regex": /123/,
|
||||
fc: test(1),
|
||||
"dates": |12-12-2020-T12:00:00|,
|
||||
number: 123,
|
||||
"null": null,
|
||||
|
||||
a: {} match {
|
||||
case is {} -> foo.name
|
||||
},
|
||||
b: {} update {
|
||||
case name at .user.name -> "123"
|
||||
},
|
||||
stringMultiLine: "This is a multiline
|
||||
string
|
||||
",
|
||||
a: if( !true > 2) a else 2,
|
||||
b: do {
|
||||
{}
|
||||
}
|
||||
}
|
||||
</code></pre>
|
|
@ -53,6 +53,7 @@
|
|||
"conc": "Concurnas",
|
||||
"csp": "Content-Security-Policy",
|
||||
"css-extras": "CSS Extras",
|
||||
"dataweave": "DataWeave",
|
||||
"dax": "DAX",
|
||||
"django": "Django/Jinja2",
|
||||
"jinja2": "Django/Jinja2",
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(){if("undefined"!=typeof self&&self.Prism&&self.document)if(Prism.plugins.toolbar){var r={none:"Plain text",html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"ABNF",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",arff:"ARFF",asciidoc:"AsciiDoc",adoc:"AsciiDoc",aspnet:"ASP.NET (C#)",asm6502:"6502 Assembly",autohotkey:"AutoHotkey",autoit:"AutoIt",basic:"BASIC",bbcode:"BBcode",bnf:"BNF",rbnf:"RBNF",bsl:"BSL (1C:Enterprise)",oscript:"OneScript",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cil:"CIL",cmake:"CMake",coffee:"CoffeeScript",conc:"Concurnas",csp:"Content-Security-Policy","css-extras":"CSS Extras",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",ebnf:"EBNF",editorconfig:"EditorConfig",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",glsl:"GLSL",graphql:"GraphQL",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam",ignore:".ignore",gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras",json:"JSON",webmanifest:"Web App Manifest",json5:"JSON5",jsonp:"JSONP",jsstacktrace:"JS stack trace","js-templates":"JS Templates",kts:"Kotlin Script",kt:"Kotlin",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",lolcode:"LOLCODE",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",mel:"MEL",mongodb:"MongoDB",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",naniscript:"Naninovel Script",nani:"Naninovel Script",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",parigp:"PARI/GP",objectpascal:"Object Pascal",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",promql:"PromQL",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",purs:"PureScript",py:"Python",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session","sh-session":"Shell session",shellsession:"Shell session",sml:"SML",smlnj:"SML/NJ",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",iecst:"Structured Text (IEC 61131-3)","t4-templating":"T4 templating","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)",tap:"TAP",tt2:"Template Toolkit 2",toml:"TOML",trig:"TriG",ts:"TypeScript",tsconfig:"TSConfig",uscript:"UnrealScript",uc:"UnrealScript",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vba:"VBA",vb:"Visual Basic",wasm:"WebAssembly",wiki:"Wiki markup",xeoracube:"XeoraCube","xml-doc":"XML doc (.net)",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML",yang:"YANG"};Prism.plugins.toolbar.registerButton("show-language",function(e){var a=e.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var s,t=a.getAttribute("data-language")||r[e.language]||((s=e.language)?(s.substring(0,1).toUpperCase()+s.substring(1)).replace(/s(?=cript)/,"S"):s);if(t){var o=document.createElement("span");return o.textContent=t,o}}})}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}();
|
||||
!function(){if("undefined"!=typeof self&&self.Prism&&self.document)if(Prism.plugins.toolbar){var r={none:"Plain text",html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"ABNF",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",arff:"ARFF",asciidoc:"AsciiDoc",adoc:"AsciiDoc",aspnet:"ASP.NET (C#)",asm6502:"6502 Assembly",autohotkey:"AutoHotkey",autoit:"AutoIt",basic:"BASIC",bbcode:"BBcode",bnf:"BNF",rbnf:"RBNF",bsl:"BSL (1C:Enterprise)",oscript:"OneScript",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cil:"CIL",cmake:"CMake",coffee:"CoffeeScript",conc:"Concurnas",csp:"Content-Security-Policy","css-extras":"CSS Extras",dataweave:"DataWeave",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",ebnf:"EBNF",editorconfig:"EditorConfig",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",glsl:"GLSL",graphql:"GraphQL",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam",ignore:".ignore",gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras",json:"JSON",webmanifest:"Web App Manifest",json5:"JSON5",jsonp:"JSONP",jsstacktrace:"JS stack trace","js-templates":"JS Templates",kts:"Kotlin Script",kt:"Kotlin",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",lolcode:"LOLCODE",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",mel:"MEL",mongodb:"MongoDB",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",naniscript:"Naninovel Script",nani:"Naninovel Script",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",parigp:"PARI/GP",objectpascal:"Object Pascal",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",promql:"PromQL",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",purs:"PureScript",py:"Python",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session","sh-session":"Shell session",shellsession:"Shell session",sml:"SML",smlnj:"SML/NJ",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",iecst:"Structured Text (IEC 61131-3)","t4-templating":"T4 templating","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)",tap:"TAP",tt2:"Template Toolkit 2",toml:"TOML",trig:"TriG",ts:"TypeScript",tsconfig:"TSConfig",uscript:"UnrealScript",uc:"UnrealScript",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vba:"VBA",vb:"Visual Basic",wasm:"WebAssembly",wiki:"Wiki markup",xeoracube:"XeoraCube","xml-doc":"XML doc (.net)",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML",yang:"YANG"};Prism.plugins.toolbar.registerButton("show-language",function(e){var a=e.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var s,t=a.getAttribute("data-language")||r[e.language]||((s=e.language)?(s.substring(0,1).toUpperCase()+s.substring(1)).replace(/s(?=cript)/,"S"):s);if(t){var o=document.createElement("span");return o.textContent=t,o}}})}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}();
|
|
@ -0,0 +1,12 @@
|
|||
true
|
||||
false
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["boolean", "true"],
|
||||
["boolean", "false"]
|
||||
]
|
||||
|
||||
----------------------------------------------------
|
||||
Check for boolean
|
|
@ -0,0 +1,17 @@
|
|||
// Line comment ""
|
||||
/* Block comment */
|
||||
/**
|
||||
* MultiLine Comment
|
||||
**/
|
||||
/* "" */
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["comment", "// Line comment \"\"\t"],
|
||||
["comment", "/* Block comment */"],
|
||||
["comment", "/**\r\n\t* MultiLine Comment\r\n\t**/"],
|
||||
["comment", "/* \"\" */"]
|
||||
]
|
||||
----------------------------------------------------
|
||||
Check for comments
|
|
@ -0,0 +1,27 @@
|
|||
|12-12-2001-T12:00:00|
|
||||
|12-12-2001-T12:00:00+03:00|
|
||||
|12-12-2001-T12:00:00Z|
|
||||
|12-12-2001|
|
||||
|12:00:00|
|
||||
|12:00:00Z|
|
||||
|12:00:00-03:00|
|
||||
|P1D|
|
||||
|P1Y1D|
|
||||
|P1Y1D2H3M5S|
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["date", "|12-12-2001-T12:00:00|"],
|
||||
["date", "|12-12-2001-T12:00:00+03:00|"],
|
||||
["date", "|12-12-2001-T12:00:00Z|"],
|
||||
["date", "|12-12-2001|"],
|
||||
["date", "|12:00:00|"],
|
||||
["date", "|12:00:00Z|"],
|
||||
["date", "|12:00:00-03:00|"],
|
||||
["date", "|P1D|"],
|
||||
["date", "|P1Y1D|"],
|
||||
["date", "|P1Y1D2H3M5S|"]
|
||||
]
|
||||
----------------------------------------------------
|
||||
Check for date
|
|
@ -0,0 +1,28 @@
|
|||
myfunction(a, b,123)
|
||||
payload.myFunction(1,2,3)
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["function", "myfunction"],
|
||||
["punctuation", "("],
|
||||
"a",
|
||||
["punctuation", ","],
|
||||
" b",
|
||||
["punctuation", ","],
|
||||
["number", "123"],
|
||||
["punctuation", ")"],
|
||||
|
||||
"\npayload",
|
||||
["punctuation", "."],
|
||||
["function", "myFunction"],
|
||||
["punctuation", "("],
|
||||
["number", "1"],
|
||||
["punctuation", ","],
|
||||
["number", "2"],
|
||||
["punctuation", ","],
|
||||
["number", "3"],
|
||||
["punctuation", ")"]
|
||||
]
|
||||
----------------------------------------------------
|
||||
Check for functions
|
|
@ -0,0 +1,124 @@
|
|||
%dw 2.0
|
||||
input payalod application/json
|
||||
ns ns0 http://localhost.com
|
||||
var a = 123
|
||||
type T = String
|
||||
fun test(a: Number) = a + 123
|
||||
output application/json
|
||||
---
|
||||
{} match {
|
||||
case a is String -> x as String
|
||||
}
|
||||
update {
|
||||
case a at .name ->
|
||||
}
|
||||
if(true or false and not true) do {
|
||||
|
||||
}
|
||||
else
|
||||
payload match {
|
||||
case a is String -> x as String
|
||||
}
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
"%dw ",
|
||||
["number", "2.0"],
|
||||
|
||||
["keyword", "input"],
|
||||
" payalod ",
|
||||
["mime-type", "application/json"],
|
||||
|
||||
["keyword", "ns"],
|
||||
" ns0 ",
|
||||
["url", "http://localhost.com"],
|
||||
|
||||
["keyword", "var"],
|
||||
" a ",
|
||||
["operator", "="],
|
||||
["number", "123"],
|
||||
|
||||
["keyword", "type"],
|
||||
" T ",
|
||||
["operator", "="],
|
||||
" String\n",
|
||||
|
||||
["keyword", "fun"],
|
||||
["function", "test"],
|
||||
["punctuation", "("],
|
||||
["property", "a"],
|
||||
["punctuation", ":"],
|
||||
" Number",
|
||||
["punctuation", ")"],
|
||||
["operator", "="],
|
||||
" a ",
|
||||
["operator", "+"],
|
||||
["number", "123"],
|
||||
|
||||
["keyword", "output"],
|
||||
["mime-type", "application/json"],
|
||||
|
||||
["operator", "---"],
|
||||
|
||||
["punctuation", "{"],
|
||||
["punctuation", "}"],
|
||||
["keyword", "match"],
|
||||
["punctuation", "{"],
|
||||
|
||||
["keyword", "case"],
|
||||
" a ",
|
||||
["keyword", "is"],
|
||||
" String ",
|
||||
["operator", "->"],
|
||||
" x ",
|
||||
["keyword", "as"],
|
||||
" String\n",
|
||||
|
||||
["punctuation", "}"],
|
||||
|
||||
["keyword", "update"],
|
||||
["punctuation", "{"],
|
||||
|
||||
["keyword", "case"],
|
||||
" a ",
|
||||
["keyword", "at"],
|
||||
["punctuation", "."],
|
||||
"name ",
|
||||
["operator", "->"],
|
||||
|
||||
["punctuation", "}"],
|
||||
|
||||
["function", "if"],
|
||||
["punctuation", "("],
|
||||
["boolean", "true"],
|
||||
["keyword", "or"],
|
||||
["boolean", "false"],
|
||||
["keyword", "and"],
|
||||
["keyword", "not"],
|
||||
["boolean", "true"],
|
||||
["punctuation", ")"],
|
||||
["keyword", "do"],
|
||||
["punctuation", "{"],
|
||||
|
||||
["punctuation", "}"],
|
||||
|
||||
["keyword", "else"],
|
||||
|
||||
" \npayload ",
|
||||
["keyword", "match"],
|
||||
["punctuation", "{"],
|
||||
|
||||
["keyword", "case"],
|
||||
" a ",
|
||||
["keyword", "is"],
|
||||
" String ",
|
||||
["operator", "->"],
|
||||
" x ",
|
||||
["keyword", "as"],
|
||||
" String\n",
|
||||
|
||||
["punctuation", "}"]
|
||||
]
|
||||
----------------------------------------------------
|
||||
Check for keywords
|
|
@ -0,0 +1,9 @@
|
|||
null
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["keyword", "null"]
|
||||
]
|
||||
----------------------------------------------------
|
||||
Check for null
|
|
@ -0,0 +1,25 @@
|
|||
0
|
||||
123
|
||||
3.14159
|
||||
5.0e8
|
||||
0.2E+2
|
||||
47e-5
|
||||
-1.23
|
||||
-2.34E33
|
||||
-4.34E-33
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["number", "0"],
|
||||
["number", "123"],
|
||||
["number", "3.14159"],
|
||||
["number", "5.0e8"],
|
||||
["number", "0.2E+2"],
|
||||
["number", "47e-5"],
|
||||
["number", "-1.23"],
|
||||
["number", "-2.34E33"],
|
||||
["number", "-4.34E-33"]
|
||||
]
|
||||
----------------------------------------------------
|
||||
Check for number
|
|
@ -0,0 +1,77 @@
|
|||
a > b
|
||||
c < d
|
||||
a = 1
|
||||
a << 1
|
||||
b >> 2
|
||||
d <= 2
|
||||
e >= 3
|
||||
f != 4
|
||||
g ~= 4
|
||||
h == 1
|
||||
(a) -> 1
|
||||
a ++ b
|
||||
c -- d
|
||||
payload.name!
|
||||
payload.name?
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
"a ",
|
||||
["operator", ">"],
|
||||
" b\nc ",
|
||||
["operator", "<"],
|
||||
" d\na ",
|
||||
["operator", "="],
|
||||
["number", "1"],
|
||||
|
||||
"\na ",
|
||||
["operator", "<<"],
|
||||
["number", "1"],
|
||||
|
||||
"\nb ",
|
||||
["operator", ">>"],
|
||||
["number", "2"],
|
||||
|
||||
"\nd ",
|
||||
["operator", "<="],
|
||||
["number", "2"],
|
||||
|
||||
"\ne ",
|
||||
["operator", ">="],
|
||||
["number", "3"],
|
||||
|
||||
"\nf ",
|
||||
["operator", "!="],
|
||||
["number", "4"],
|
||||
|
||||
"\ng ",
|
||||
["operator", "~="],
|
||||
["number", "4"],
|
||||
|
||||
"\nh ",
|
||||
["operator", "=="],
|
||||
["number", "1"],
|
||||
|
||||
["punctuation", "("],
|
||||
"a",
|
||||
["punctuation", ")"],
|
||||
["operator", "->"],
|
||||
["number", "1"],
|
||||
|
||||
"\na ",
|
||||
["operator", "++"],
|
||||
" b\nc ",
|
||||
["operator", "--"],
|
||||
" d\npayload",
|
||||
["punctuation", "."],
|
||||
"name",
|
||||
["operator", "!"],
|
||||
|
||||
"\npayload",
|
||||
["punctuation", "."],
|
||||
"name",
|
||||
["operator", "?"]
|
||||
]
|
||||
----------------------------------------------------
|
||||
Check for operators
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
a: 123,
|
||||
"My Name": true,
|
||||
t#test : true,
|
||||
"test" @(a: true): 2,
|
||||
test#"test" @(a: true): 3
|
||||
}
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["punctuation", "{"],
|
||||
|
||||
["property", "a"],
|
||||
["punctuation", ":"],
|
||||
["number", "123"],
|
||||
["punctuation", ","],
|
||||
|
||||
["property", "\"My Name\""],
|
||||
["punctuation", ":"],
|
||||
["boolean", "true"],
|
||||
["punctuation", ","],
|
||||
|
||||
["property", "t#test"],
|
||||
["punctuation", ":"],
|
||||
["boolean", "true"],
|
||||
["punctuation", ","],
|
||||
|
||||
["property", "\"test\""],
|
||||
["punctuation", "@"],
|
||||
["punctuation", "("],
|
||||
["property", "a"],
|
||||
["punctuation", ":"],
|
||||
["boolean", "true"],
|
||||
["punctuation", ")"],
|
||||
["punctuation", ":"],
|
||||
["number", "2"],
|
||||
["punctuation", ","],
|
||||
|
||||
["property", "test#\"test\""],
|
||||
["punctuation", "@"],
|
||||
["punctuation", "("],
|
||||
["property", "a"],
|
||||
["punctuation", ":"],
|
||||
["boolean", "true"],
|
||||
["punctuation", ")"],
|
||||
["punctuation", ":"],
|
||||
["number", "3"],
|
||||
|
||||
["punctuation", "}"]
|
||||
]
|
||||
----------------------------------------------------
|
||||
Check for properties
|
|
@ -0,0 +1,15 @@
|
|||
/(asd)+?[a-Z]/
|
||||
/ /
|
||||
/\w+\/\s*/
|
||||
/([0-1]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])/
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["regex", "/(asd)+?[a-Z]/"],
|
||||
["regex", "/ /"],
|
||||
["regex", "/\\w+\\/\\s*/"],
|
||||
["regex", "/([0-1]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])/"]
|
||||
]
|
||||
----------------------------------------------------
|
||||
Check for regex
|
|
@ -0,0 +1,27 @@
|
|||
""
|
||||
"foo"
|
||||
"foo\"bar\"baz"
|
||||
"\u2642\\"
|
||||
`hello`
|
||||
'test'
|
||||
"this is a multiline
|
||||
test
|
||||
that
|
||||
can
|
||||
be long"
|
||||
"This string \r\n Should also \\ \t"
|
||||
|
||||
----------------------------------------------------
|
||||
|
||||
[
|
||||
["string", "\"\""],
|
||||
["string", "\"foo\""],
|
||||
["string", "\"foo\\\"bar\\\"baz\""],
|
||||
["string", "\"\\u2642\\\\\""],
|
||||
["string", "`hello`"],
|
||||
["string", "'test'"],
|
||||
["string", "\"this is a multiline\r\ntest\r\nthat \r\ncan \r\nbe long\""],
|
||||
["string", "\"This string \\r\\n Should also \\\\ \\t\""]
|
||||
]
|
||||
----------------------------------------------------
|
||||
Check for strings
|
Loading…
Reference in New Issue