Added lexars

This commit is contained in:
Toastie 2025-03-22 20:46:00 +13:00
parent 382b2ce94b
commit f9f64b0558
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7
820 changed files with 149371 additions and 0 deletions

5
lexers/testdata/aql/comments.actual vendored Normal file
View file

@ -0,0 +1,5 @@
code//comment
code/*comment*/
/* comment RETURN 42 "'` *
multiline */code
white space

13
lexers/testdata/aql/comments.expected vendored Normal file
View file

@ -0,0 +1,13 @@
[
{"type":"Name","value":"code"},
{"type":"CommentSingle","value":"//comment\n"},
{"type":"Name","value":"code"},
{"type":"CommentMultiline","value":"/*comment*/"},
{"type":"Text","value":"\n"},
{"type":"CommentMultiline","value":"/* comment RETURN 42 \"'` *\nmultiline */"},
{"type":"Name","value":"code"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"white"},
{"type":"Text","value":" \t"},
{"type":"Name","value":"space"}
]

14
lexers/testdata/aql/functions.actual vendored Normal file
View file

@ -0,0 +1,14 @@
RAND()
rand ()
Collections()
COUNT_DISTINCT()
COUNT()
not_null()
REMOVE_VALUE()
group::func()
GROUP_57::F9_()
0::0()
1SUM()
_G::A()
_aql::avg()

48
lexers/testdata/aql/functions.expected vendored Normal file
View file

@ -0,0 +1,48 @@
[
{"type":"NameFunction","value":"RAND"},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":"\n"},
{"type":"NameFunction","value":"rand"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":"\n"},
{"type":"NameFunction","value":"Collections"},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":"\n"},
{"type":"NameFunction","value":"COUNT_DISTINCT"},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":"\n"},
{"type":"NameFunction","value":"COUNT"},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":"\n"},
{"type":"NameFunction","value":"not_null"},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":"\n"},
{"type":"NameFunction","value":"REMOVE_VALUE"},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":"\n"},
{"type":"NameFunction","value":"group::func"},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":"\n"},
{"type":"NameFunction","value":"GROUP_57::F9_"},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":"\n\n"},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Operator","value":"::"},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":"\n"},
{"type":"LiteralNumberInteger","value":"1"},
{"type":"NameFunction","value":"SUM"},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"_G"},
{"type":"Operator","value":"::"},
{"type":"Name","value":"A"},
{"type":"Punctuation","value":"()"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"_aql"},
{"type":"Operator","value":"::"},
{"type":"NameFunction","value":"avg"},
{"type":"Punctuation","value":"()"}
]

19
lexers/testdata/aql/identifiers.actual vendored Normal file
View file

@ -0,0 +1,19 @@
i
doc
Vertex
n036
$X
__foo__
`FILTER`
`@12 3!`
´&tab FOR äöü´
`multi\`
\\\`
line`
´multi\´
\\\´
line´
$6
$_Y
_8

View file

@ -0,0 +1,32 @@
[
{"type":"Name","value":"i"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"doc"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"Vertex"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"n036"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"$X"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"__foo__"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"`FILTER`"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"`@12 3!`"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"´\u0026tab\tFOR äöü´"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"`multi\\`\n\\\\\\`\nline`"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"´multi\\´\n\\\\\\´\nline´"},
{"type":"Text","value":"\n\n"},
{"type":"Error","value":"$"},
{"type":"LiteralNumberInteger","value":"6"},
{"type":"Text","value":"\n"},
{"type":"Error","value":"$"},
{"type":"Name","value":"_Y"},
{"type":"Text","value":"\n"},
{"type":"Error","value":"_"},
{"type":"LiteralNumberInteger","value":"8"}
]

31
lexers/testdata/aql/keywords.actual vendored Normal file
View file

@ -0,0 +1,31 @@
LET
AT LEAST
NULL
nULL
true
false
TRUE
FALSE
True
fAlSe
WITH COUNT INTO
KEEP
prune
SEARCH
to
OPTIONS {}
options{}
CURRENT
NEW
OLD
LEAST
AT
CAT LEAST
KNULL
falsey
COUNT
OPTIONS
current
New
old

70
lexers/testdata/aql/keywords.expected vendored Normal file
View file

@ -0,0 +1,70 @@
[
{"type":"KeywordDeclaration","value":"LET"},
{"type":"Text","value":"\n"},
{"type":"KeywordReserved","value":"AT LEAST"},
{"type":"Text","value":"\n"},
{"type":"KeywordConstant","value":"NULL"},
{"type":"Text","value":"\n"},
{"type":"KeywordConstant","value":"nULL"},
{"type":"Text","value":"\n"},
{"type":"KeywordConstant","value":"true"},
{"type":"Text","value":"\n"},
{"type":"KeywordConstant","value":"false"},
{"type":"Text","value":"\n"},
{"type":"KeywordConstant","value":"TRUE"},
{"type":"Text","value":"\n"},
{"type":"KeywordConstant","value":"FALSE"},
{"type":"Text","value":"\n"},
{"type":"KeywordConstant","value":"True"},
{"type":"Text","value":"\n"},
{"type":"KeywordConstant","value":"fAlSe"},
{"type":"Text","value":"\n"},
{"type":"KeywordReserved","value":"WITH"},
{"type":"Text","value":" "},
{"type":"KeywordPseudo","value":"COUNT"},
{"type":"Text","value":" "},
{"type":"KeywordReserved","value":"INTO"},
{"type":"Text","value":"\n"},
{"type":"KeywordPseudo","value":"KEEP"},
{"type":"Text","value":"\n"},
{"type":"KeywordPseudo","value":"prune"},
{"type":"Text","value":"\n"},
{"type":"KeywordPseudo","value":"SEARCH"},
{"type":"Text","value":"\n"},
{"type":"KeywordPseudo","value":"to"},
{"type":"Text","value":"\n"},
{"type":"KeywordPseudo","value":"OPTIONS"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{}"},
{"type":"Text","value":"\n"},
{"type":"KeywordPseudo","value":"options"},
{"type":"Punctuation","value":"{}"},
{"type":"Text","value":"\n"},
{"type":"NameBuiltinPseudo","value":"CURRENT"},
{"type":"Text","value":"\n"},
{"type":"NameBuiltinPseudo","value":"NEW"},
{"type":"Text","value":"\n"},
{"type":"NameBuiltinPseudo","value":"OLD"},
{"type":"Text","value":"\n\n"},
{"type":"Name","value":"LEAST"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"AT"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"CAT"},
{"type":"Text","value":" "},
{"type":"Name","value":"LEAST"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"KNULL"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"falsey"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"COUNT"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"OPTIONS"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"current"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"New"},
{"type":"Text","value":"\n"},
{"type":"Name","value":"old"}
]

9
lexers/testdata/aql/numbers.actual vendored Normal file
View file

@ -0,0 +1,9 @@
0b1100 0B1
0xC0DE 0Xa7
0.0 -1.23 .5 8e9 3.33E-3 456.7e+89
0 2 400
0B 0b1e
0x 0X5G
00.7 .e6 ..5
01

52
lexers/testdata/aql/numbers.expected vendored Normal file
View file

@ -0,0 +1,52 @@
[
{"type":"LiteralNumberBin","value":"0b1100"},
{"type":"Text","value":" "},
{"type":"LiteralNumberBin","value":"0B1"},
{"type":"Text","value":"\n"},
{"type":"LiteralNumberHex","value":"0xC0DE"},
{"type":"Text","value":" "},
{"type":"LiteralNumberHex","value":"0Xa7"},
{"type":"Text","value":"\n"},
{"type":"LiteralNumberFloat","value":"0.0"},
{"type":"Text","value":" "},
{"type":"Operator","value":"-"},
{"type":"LiteralNumberFloat","value":"1.23"},
{"type":"Text","value":" "},
{"type":"LiteralNumberFloat","value":".5"},
{"type":"Text","value":" "},
{"type":"LiteralNumberFloat","value":"8e9"},
{"type":"Text","value":" "},
{"type":"LiteralNumberFloat","value":"3.33E-3"},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"45"},
{"type":"LiteralNumberFloat","value":"6.7e+89"},
{"type":"Text","value":"\n"},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"2"},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"400"},
{"type":"Text","value":"\n\n"},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Name","value":"B"},
{"type":"Text","value":" "},
{"type":"LiteralNumberBin","value":"0b1"},
{"type":"Name","value":"e"},
{"type":"Text","value":"\n"},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Name","value":"x"},
{"type":"Text","value":" "},
{"type":"LiteralNumberHex","value":"0X5"},
{"type":"Name","value":"G"},
{"type":"Text","value":"\n"},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"LiteralNumberFloat","value":"0.7"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"e6"},
{"type":"Text","value":" "},
{"type":"Operator","value":".."},
{"type":"LiteralNumberInteger","value":"5"},
{"type":"Text","value":"\n"},
{"type":"LiteralNumberInteger","value":"01"}
]

12
lexers/testdata/aql/queries.actual vendored Normal file
View file

@ -0,0 +1,12 @@
FOR doc IN @@coll
FILTER doc.value >= @val && doc["value"] < COUNT ([.1, FALSE])
COLLECT ´v a l´ /* legal! */ = doc.value WITH COUNT INTO count // blarg
RETURN MERGE(doc, { [CONCAT("new", 0.125)]: true } )
LET arr = [[1,2],3,[0]]
RETURN arr[** FILTER CURRENT % 2 == 0 RETURN CURRENT||null]
FOR v,e,p IN 2..4 OUTBOUND "components/S" GRAPH "g"
PRUNE e != null AND p.edges[-1].text =~ @AND
OPTIONS { vertexCollections: ['components'] }
RETURN v.´sort´ ?: 0xBEEF

194
lexers/testdata/aql/queries.expected vendored Normal file
View file

@ -0,0 +1,194 @@
[
{"type":"KeywordReserved","value":"FOR"},
{"type":"Text","value":" "},
{"type":"Name","value":"doc"},
{"type":"Text","value":" "},
{"type":"KeywordReserved","value":"IN"},
{"type":"Text","value":" "},
{"type":"NameVariableGlobal","value":"@@coll"},
{"type":"Text","value":"\n "},
{"type":"KeywordReserved","value":"FILTER"},
{"type":"Text","value":" "},
{"type":"Name","value":"doc"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"value"},
{"type":"Text","value":" "},
{"type":"Operator","value":"\u003e="},
{"type":"Text","value":" "},
{"type":"NameVariable","value":"@val"},
{"type":"Text","value":" "},
{"type":"Operator","value":"\u0026\u0026"},
{"type":"Text","value":" "},
{"type":"Name","value":"doc"},
{"type":"Punctuation","value":"["},
{"type":"LiteralStringDouble","value":"\"value\""},
{"type":"Punctuation","value":"]"},
{"type":"Text","value":" "},
{"type":"Operator","value":"\u003c"},
{"type":"Text","value":" "},
{"type":"NameFunction","value":"COUNT"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"(["},
{"type":"LiteralNumberFloat","value":".1"},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"KeywordConstant","value":"FALSE"},
{"type":"Punctuation","value":"])"},
{"type":"Text","value":"\n "},
{"type":"KeywordReserved","value":"COLLECT"},
{"type":"Text","value":" "},
{"type":"Name","value":"´v a l´"},
{"type":"Text","value":" "},
{"type":"CommentMultiline","value":"/* legal! */"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"Name","value":"doc"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"value"},
{"type":"Text","value":" "},
{"type":"KeywordReserved","value":"WITH"},
{"type":"Text","value":" "},
{"type":"KeywordPseudo","value":"COUNT"},
{"type":"Text","value":" "},
{"type":"KeywordReserved","value":"INTO"},
{"type":"Text","value":" "},
{"type":"Name","value":"count"},
{"type":"Text","value":" "},
{"type":"CommentSingle","value":"// blarg\n"},
{"type":"Text","value":" "},
{"type":"KeywordReserved","value":"RETURN"},
{"type":"Text","value":" "},
{"type":"NameFunction","value":"MERGE"},
{"type":"Punctuation","value":"("},
{"type":"Name","value":"doc"},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"["},
{"type":"NameFunction","value":"CONCAT"},
{"type":"Punctuation","value":"("},
{"type":"LiteralStringDouble","value":"\"new\""},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"LiteralNumberFloat","value":"0.125"},
{"type":"Punctuation","value":")]"},
{"type":"Operator","value":":"},
{"type":"Text","value":" "},
{"type":"KeywordConstant","value":"true"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"}"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":")"},
{"type":"Text","value":"\n\n"},
{"type":"KeywordDeclaration","value":"LET"},
{"type":"Text","value":" "},
{"type":"Name","value":"arr"},
{"type":"Text","value":" "},
{"type":"Operator","value":"="},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"[["},
{"type":"LiteralNumberInteger","value":"1"},
{"type":"Punctuation","value":","},
{"type":"LiteralNumberInteger","value":"2"},
{"type":"Punctuation","value":"],"},
{"type":"LiteralNumberInteger","value":"3"},
{"type":"Punctuation","value":",["},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Punctuation","value":"]]"},
{"type":"Text","value":"\n"},
{"type":"KeywordReserved","value":"RETURN"},
{"type":"Text","value":" "},
{"type":"Name","value":"arr"},
{"type":"Punctuation","value":"["},
{"type":"Operator","value":"**"},
{"type":"Text","value":" "},
{"type":"KeywordReserved","value":"FILTER"},
{"type":"Text","value":" "},
{"type":"NameBuiltinPseudo","value":"CURRENT"},
{"type":"Text","value":" "},
{"type":"Operator","value":"%"},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"2"},
{"type":"Text","value":" "},
{"type":"Operator","value":"=="},
{"type":"Text","value":" "},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Text","value":" "},
{"type":"KeywordReserved","value":"RETURN"},
{"type":"Text","value":" "},
{"type":"NameBuiltinPseudo","value":"CURRENT"},
{"type":"Operator","value":"||"},
{"type":"KeywordConstant","value":"null"},
{"type":"Punctuation","value":"]"},
{"type":"Text","value":"\n\n"},
{"type":"KeywordReserved","value":"FOR"},
{"type":"Text","value":" "},
{"type":"Name","value":"v"},
{"type":"Punctuation","value":","},
{"type":"Name","value":"e"},
{"type":"Punctuation","value":","},
{"type":"Name","value":"p"},
{"type":"Text","value":" "},
{"type":"KeywordReserved","value":"IN"},
{"type":"Text","value":" "},
{"type":"LiteralNumberFloat","value":"2"},
{"type":"Operator","value":".."},
{"type":"LiteralNumberInteger","value":"4"},
{"type":"Text","value":" "},
{"type":"KeywordReserved","value":"OUTBOUND"},
{"type":"Text","value":" "},
{"type":"LiteralStringDouble","value":"\"components/S\""},
{"type":"Text","value":" "},
{"type":"KeywordReserved","value":"GRAPH"},
{"type":"Text","value":" "},
{"type":"LiteralStringDouble","value":"\"g\""},
{"type":"Text","value":"\n "},
{"type":"KeywordPseudo","value":"PRUNE"},
{"type":"Text","value":" "},
{"type":"Name","value":"e"},
{"type":"Text","value":" "},
{"type":"Operator","value":"!="},
{"type":"Text","value":" "},
{"type":"KeywordConstant","value":"null"},
{"type":"Text","value":" "},
{"type":"KeywordReserved","value":"AND"},
{"type":"Text","value":" "},
{"type":"Name","value":"p"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"edges"},
{"type":"Punctuation","value":"["},
{"type":"Operator","value":"-"},
{"type":"LiteralNumberInteger","value":"1"},
{"type":"Punctuation","value":"]."},
{"type":"Name","value":"text"},
{"type":"Text","value":" "},
{"type":"Operator","value":"=~"},
{"type":"Text","value":" "},
{"type":"NameVariable","value":"@AND"},
{"type":"Text","value":"\n "},
{"type":"KeywordPseudo","value":"OPTIONS"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":" "},
{"type":"Name","value":"vertexCollections"},
{"type":"Operator","value":":"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"["},
{"type":"LiteralStringSingle","value":"'components'"},
{"type":"Punctuation","value":"]"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"}"},
{"type":"Text","value":"\n "},
{"type":"KeywordReserved","value":"RETURN"},
{"type":"Text","value":" "},
{"type":"Name","value":"v"},
{"type":"Punctuation","value":"."},
{"type":"Name","value":"´sort´"},
{"type":"Text","value":" "},
{"type":"Operator","value":"?:"},
{"type":"Text","value":" "},
{"type":"LiteralNumberHex","value":"0xBEEF"},
{"type":"Text","value":"\n"}
]

12
lexers/testdata/aql/strings.actual vendored Normal file
View file

@ -0,0 +1,12 @@
"double"
'single'
"multi
line"
'multi
line'
"escaped\"
quote"
'escaped\'
quote'
"backtick\\'"
'backtick\\"'

17
lexers/testdata/aql/strings.expected vendored Normal file
View file

@ -0,0 +1,17 @@
[
{"type":"LiteralStringDouble","value":"\"double\""},
{"type":"Text","value":"\n"},
{"type":"LiteralStringSingle","value":"'single'"},
{"type":"Text","value":"\n"},
{"type":"LiteralStringDouble","value":"\"multi\nline\""},
{"type":"Text","value":"\n"},
{"type":"LiteralStringSingle","value":"'multi\nline'"},
{"type":"Text","value":"\n"},
{"type":"LiteralStringDouble","value":"\"escaped\\\"\nquote\""},
{"type":"Text","value":"\n"},
{"type":"LiteralStringSingle","value":"'escaped\\'\nquote'"},
{"type":"Text","value":"\n"},
{"type":"LiteralStringDouble","value":"\"backtick\\\\'\""},
{"type":"Text","value":"\n"},
{"type":"LiteralStringSingle","value":"'backtick\\\\\"'"}
]