Imported test cases from pygments

This commit is contained in:
Roberto Alsina 2024-08-03 07:36:47 -03:00
parent c9df4be879
commit 99e1e2b0cb
692 changed files with 37403 additions and 0 deletions

View File

@ -85,9 +85,11 @@ module Tartrazine
raise Exception.new "Can't have a token without a match" if match.nil?
[Token.new(type: xml["type"], value: match[0])]
when "push"
puts "Pushing state #{xml["state"]}"
lexer.state_stack << xml["state"]
[] of Token
when "pop"
puts "Popping #{xml["depth"]} states"
lexer.state_stack.pop(xml["depth"].to_i)
[] of Token
else

View File

@ -0,0 +1,12 @@
---input---
Example
ServerName localhost
---tokens---
'Example' Name.Builtin
'\n' Text.Whitespace
'ServerName' Name.Builtin
' ' Text.Whitespace
'localhost' Text
'\n' Text.Whitespace

View File

@ -0,0 +1,8 @@
---input---
LockFile /var/lock/apache2/accept.lock
---tokens---
'LockFile' Name.Builtin
' ' Text.Whitespace
'/var/lock/apache2/accept.lock' Literal.String.Other
'\n' Text.Whitespace

View File

@ -0,0 +1,8 @@
---input---
Include /etc/httpd/conf.d/*.conf
---tokens---
'Include' Name.Builtin
' ' Text.Whitespace
'/etc/httpd/conf.d/*.conf' Literal.String.Other
'\n' Text.Whitespace

View File

@ -0,0 +1,19 @@
---input---
<VirtualHost "test">
</VirtualHost
>
---tokens---
'<VirtualHost' Name.Tag
' ' Text.Whitespace
'"test"' Literal.String
'>' Name.Tag
'\n' Text.Whitespace
'<' Error
'/' Error
'VirtualHost' Name.Builtin
'\n' Text.Whitespace
'>' Error
'\n' Text.Whitespace

View File

@ -0,0 +1,8 @@
---input---
Include /etc/httpd/conf.d/*/*.conf
---tokens---
'Include' Name.Builtin
' ' Text.Whitespace
'/etc/httpd/conf.d/*/*.conf' Literal.String.Other
'\n' Text.Whitespace

View File

@ -0,0 +1,8 @@
---input---
Include /*conf/*.conf
---tokens---
'Include' Name.Builtin
' ' Text.Whitespace
'/*conf/*.conf' Literal.String.Other
'\n' Text.Whitespace

View File

@ -0,0 +1,20 @@
---input---
SecAction \
"id:'900001', \
phase:1, \
t:none, \
setvar:tx.critical_anomaly_score=5, \
setvar:tx.error_anomaly_score=4, \
setvar:tx.warning_anomaly_score=3, \
setvar:tx.notice_anomaly_score=2, \
nolog, \
pass"
---tokens---
'SecAction' Name.Builtin
' ' Text.Whitespace
'\\\n' Text
' ' Text.Whitespace
'"id:\'900001\', \\\n phase:1, \\\n t:none, \\\n setvar:tx.critical_anomaly_score=5, \\\n setvar:tx.error_anomaly_score=4, \\\n setvar:tx.warning_anomaly_score=3, \\\n setvar:tx.notice_anomaly_score=2, \\\n nolog, \\\n pass"' Literal.String.Double
'\n' Text.Whitespace

View File

@ -0,0 +1,12 @@
---input---
#SecAction \
"id:'900004', \
phase:1, \
t:none, \
setvar:tx.anomaly_score_blocking=on, \
nolog, \
pass"
---tokens---
'#SecAction \\\n "id:\'900004\', \\\n phase:1, \\\n t:none, \\\n setvar:tx.anomaly_score_blocking=on, \\\n nolog, \\\n pass"' Comment
'\n' Text.Whitespace

View File

@ -0,0 +1,14 @@
---input---
<VirtualHost "test">
</VirtualHost>
---tokens---
'<VirtualHost' Name.Tag
' ' Text.Whitespace
'"test"' Literal.String
'>' Name.Tag
'\n' Text.Whitespace
'</VirtualHost' Name.Tag
'>' Name.Tag
'\n' Text.Whitespace

View File

@ -0,0 +1,26 @@
---input---
_op_←{_← ⍵⋄( )+⍵⍵ ⍵}
---tokens---
'_op_' Name.Variable
'←' Keyword.Declaration
'{' Keyword.Type
'_' Name.Variable
'←' Keyword.Declaration
'' Name.Builtin.Pseudo
' ' Text.Whitespace
'⍵' Name.Builtin.Pseudo
'⋄' Punctuation
'(' Punctuation
'' Name.Builtin.Pseudo
'' Name.Builtin.Pseudo
' ' Text.Whitespace
'' Name.Builtin.Pseudo
')' Punctuation
'+' Operator
'⍵' Name.Builtin.Pseudo
'⍵' Name.Builtin.Pseudo
' ' Text.Whitespace
'⍵' Name.Builtin.Pseudo
'}' Keyword.Type
'\n' Text.Whitespace

9
tests/asm/test_cpuid.txt Normal file
View File

@ -0,0 +1,9 @@
# CPU is a valid directive, and we don't want to parse this as
# cpu id, but as a single token. See bug #1517
---input---
cpuid
---tokens---
'cpuid' Name.Function
'\n' Text.Whitespace

147
tests/asn1/certificate.txt Normal file
View File

@ -0,0 +1,147 @@
---input---
Certificate ::= SEQUENCE {
tbsCertificate TBSCertificate,
signatureAlgorithm AlgorithmIdentifier,
signatureValue BIT STRING }
TBSCertificate ::= SEQUENCE {
version [0] EXPLICIT Version DEFAULT v1,
serialNumber CertificateSerialNumber,
signature AlgorithmIdentifier,
issuer Name,
validity Validity,
subject Name,
subjectPublicKeyInfo SubjectPublicKeyInfo,
issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL,
-- If present, version MUST be v2 or v3
subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL,
-- If present, version MUST be v2 or v3
extensions [3] EXPLICIT Extensions OPTIONAL
-- If present, version MUST be v3
}
---tokens---
'Certificate' Name.Type
' ' Text.Whitespace
'::=' Operator
' ' Text.Whitespace
'SEQUENCE' Keyword.Declaration
' ' Text.Whitespace
'{' Punctuation
'\n ' Text.Whitespace
'tbsCertificate' Name.Variable
' ' Text.Whitespace
'TBSCertificate' Name.Type
',' Punctuation
'\n ' Text.Whitespace
'signatureAlgorithm' Name.Variable
' ' Text.Whitespace
'AlgorithmIdentifier' Name.Type
',' Punctuation
'\n ' Text.Whitespace
'signatureValue' Name.Variable
' ' Text.Whitespace
'BIT STRING' Keyword.Type
' ' Text.Whitespace
'}' Punctuation
'\n\n' Text.Whitespace
'TBSCertificate' Name.Type
' ' Text.Whitespace
'::=' Operator
' ' Text.Whitespace
'SEQUENCE' Keyword.Declaration
' ' Text.Whitespace
'{' Punctuation
'\n ' Text.Whitespace
'version' Name.Variable
' ' Text.Whitespace
'[' Punctuation
'0' Literal.Number.Integer
']' Punctuation
' ' Text.Whitespace
'EXPLICIT' Keyword
' ' Text.Whitespace
'Version' Name.Type
' ' Text.Whitespace
'DEFAULT' Keyword.Declaration
' ' Text.Whitespace
'v1' Name.Variable
',' Punctuation
'\n ' Text.Whitespace
'serialNumber' Name.Variable
' ' Text.Whitespace
'CertificateSerialNumber' Name.Type
',' Punctuation
'\n ' Text.Whitespace
'signature' Name.Variable
' ' Text.Whitespace
'AlgorithmIdentifier' Name.Type
',' Punctuation
'\n ' Text.Whitespace
'issuer' Name.Variable
' ' Text.Whitespace
'Name' Name.Type
',' Punctuation
'\n ' Text.Whitespace
'validity' Name.Variable
' ' Text.Whitespace
'Validity' Name.Type
',' Punctuation
'\n ' Text.Whitespace
'subject' Name.Variable
' ' Text.Whitespace
'Name' Name.Type
',' Punctuation
'\n ' Text.Whitespace
'subjectPublicKeyInfo' Name.Variable
' ' Text.Whitespace
'SubjectPublicKeyInfo' Name.Type
',' Punctuation
'\n ' Text.Whitespace
'issuerUniqueID' Name.Variable
' ' Text.Whitespace
'[' Punctuation
'1' Literal.Number.Integer
']' Punctuation
' ' Text.Whitespace
'IMPLICIT' Keyword
' ' Text.Whitespace
'UniqueIdentifier' Name.Type
' ' Text.Whitespace
'OPTIONAL' Keyword.Declaration
',' Punctuation
'\n ' Text.Whitespace
'-- If present, version MUST be v2 or v3' Comment.Single
'\n ' Text.Whitespace
'subjectUniqueID' Name.Variable
' ' Text.Whitespace
'[' Punctuation
'2' Literal.Number.Integer
']' Punctuation
' ' Text.Whitespace
'IMPLICIT' Keyword
' ' Text.Whitespace
'UniqueIdentifier' Name.Type
' ' Text.Whitespace
'OPTIONAL' Keyword.Declaration
',' Punctuation
'\n ' Text.Whitespace
'-- If present, version MUST be v2 or v3' Comment.Single
'\n ' Text.Whitespace
'extensions' Name.Variable
' ' Text.Whitespace
'[' Punctuation
'3' Literal.Number.Integer
']' Punctuation
' ' Text.Whitespace
'EXPLICIT' Keyword
' ' Text.Whitespace
'Extensions' Name.Type
' ' Text.Whitespace
'OPTIONAL' Keyword.Declaration
'\n ' Text.Whitespace
'-- If present, version MUST be v3' Comment.Single
'\n ' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,49 @@
---input---
/*
Outer comment
/*
Inner comment
*/
Outer comment
*/
test ::= SEQUENCE {
a INTEGER,
b OCTET STRING,
b BIT STRING }
---tokens---
'/*' Comment.Multiline
'\n Outer comment\n ' Comment.Multiline
'/*' Comment.Multiline
'\n Inner comment\n ' Comment.Multiline
'*/' Comment.Multiline
'\n Outer comment\n' Comment.Multiline
'*/' Comment.Multiline
'\n\n' Text.Whitespace
'test' Name.Variable
' ' Text.Whitespace
'::=' Operator
' ' Text.Whitespace
'SEQUENCE' Keyword.Declaration
' ' Text.Whitespace
'{' Punctuation
'\n ' Text.Whitespace
'a' Error
' ' Text.Whitespace
'INTEGER' Keyword.Type
',' Punctuation
'\n ' Text.Whitespace
'b' Error
' ' Text.Whitespace
'OCTET STRING' Keyword.Type
',' Punctuation
'\n ' Text.Whitespace
'b' Error
' ' Text.Whitespace
'BIT STRING' Keyword.Type
' ' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,34 @@
---input---
BEGIN {a = 5;b=6; print (a==b)? "a==b" : "a!=b"}
---tokens---
'BEGIN' Name.Builtin
' ' Text
'{' Punctuation
'a' Name.Other
' ' Text
'=' Operator
' ' Text
'5' Literal.Number.Integer
';' Punctuation
'b' Name.Other
'=' Operator
'6' Literal.Number.Integer
';' Punctuation
' ' Text
'print' Keyword.Reserved
' ' Text
'(' Punctuation
'a' Name.Other
'==' Operator
'b' Name.Other
')' Punctuation
'?' Operator
' ' Text
'"a==b"' Literal.String.Double
' ' Text
':' Operator
' ' Text
'"a!=b"' Literal.String.Double
'}' Punctuation
'\n' Text

View File

@ -0,0 +1,54 @@
---input---
% BibTeX standard bibliography style `plain'
INTEGERS { output.state before.all }
FUNCTION {sort.format.title}
{ 't :=
"A " #2
"An " #3
"The " #4 t chop.word
chop.word
chop.word
sortify
#1 global.max$ substring$
}
ITERATE {call.type$}
---tokens---
"% BibTeX standard bibliography style `plain'" Comment
'\n\n' Text.Whitespace
'INTEGERS { output.state before.all }' Comment
'\n\n' Text.Whitespace
'FUNCTION {sort.format.title}' Comment
'\n' Text.Whitespace
"{ 't :=" Comment
'\n' Text.Whitespace
'"A " #2' Comment
'\n ' Text.Whitespace
'"An " #3' Comment
'\n ' Text.Whitespace
'"The " #4 t chop.word' Comment
'\n ' Text.Whitespace
'chop.word' Comment
'\n' Text.Whitespace
'chop.word' Comment
'\n' Text.Whitespace
'sortify' Comment
'\n' Text.Whitespace
'#1 global.max$ substring$' Comment
'\n' Text.Whitespace
'}' Comment
'\n\n' Text.Whitespace
'ITERATE {call.type$}' Comment
'\n' Text.Whitespace

View File

@ -0,0 +1,7 @@
---input---
@COMMENT{test}
---tokens---
'@COMMENT' Comment
'{test}' Comment
'\n' Text.Whitespace

View File

@ -0,0 +1,63 @@
---input---
This is a comment.
@ARTICLE{ruckenstein-diffusion,
author = "Liu, Hongquin" # and # "Ruckenstein, Eli",
year = 1997,
month = JAN,
pages = "888-895"
}
---tokens---
'This is a comment.' Comment
'\n\n' Text.Whitespace
'@ARTICLE' Name.Class
'{' Punctuation
'ruckenstein-diffusion' Name.Label
',' Punctuation
'\n ' Text.Whitespace
'author' Name.Attribute
' ' Text.Whitespace
'=' Punctuation
' ' Text.Whitespace
'"' Literal.String
'Liu, Hongquin' Literal.String
'"' Literal.String
' ' Text.Whitespace
'#' Punctuation
' ' Text.Whitespace
'and' Name.Variable
' ' Text.Whitespace
'#' Punctuation
' ' Text.Whitespace
'"' Literal.String
'Ruckenstein, Eli' Literal.String
'"' Literal.String
',' Punctuation
'\n ' Text.Whitespace
'year' Name.Attribute
' ' Text.Whitespace
'=' Punctuation
' ' Text.Whitespace
'1997' Literal.Number
',' Punctuation
'\n ' Text.Whitespace
'month' Name.Attribute
' ' Text.Whitespace
'=' Punctuation
' ' Text.Whitespace
'JAN' Name.Variable
',' Punctuation
'\n ' Text.Whitespace
'pages' Name.Attribute
' ' Text.Whitespace
'=' Punctuation
' ' Text.Whitespace
'"' Literal.String
'888-895' Literal.String
'"' Literal.String
'\n' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,10 @@
---input---
@PREAMBLE(""}
---tokens---
'@PREAMBLE' Name.Class
'(' Punctuation
'"' Literal.String
'"' Literal.String
'}' Error
'\n' Text.Whitespace

View File

@ -0,0 +1,10 @@
---input---
@ARTICLE xxx
---tokens---
'@ARTICLE' Name.Class
' ' Text.Whitespace
'x' Error
'x' Error
'x' Error
'\n' Text.Whitespace

View File

@ -0,0 +1,11 @@
---input---
@PREAMBLE{"% some LaTeX code here"}
---tokens---
'@PREAMBLE' Name.Class
'{' Punctuation
'"' Literal.String
'% some LaTeX code here' Literal.String
'"' Literal.String
'}' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,15 @@
---input---
@STRING(SCI = "Science")
---tokens---
'@STRING' Name.Class
'(' Punctuation
'SCI' Name.Attribute
' ' Text.Whitespace
'=' Punctuation
' ' Text.Whitespace
'"' Literal.String
'Science' Literal.String
'"' Literal.String
')' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,28 @@
---input---
Ambiv ← { ⟨1,𝕩⟩ ; ⟨2,𝕨,𝕩⟩ }
---tokens---
'Ambiv' Operator
' ' Text.Whitespace
'←' Keyword.Declaration
' ' Text.Whitespace
'{' Keyword.Type
' ' Text.Whitespace
'⟨' Punctuation
'1' Literal.Number
',' Punctuation
'𝕩' Name.Entity
'⟩' Punctuation
' ' Text.Whitespace
';' Name.Entity
' ' Text.Whitespace
'⟨' Punctuation
'2' Literal.Number
',' Punctuation
'𝕨' Name.Entity
',' Punctuation
'𝕩' Name.Entity
'⟩' Punctuation
' ' Text.Whitespace
'}' Keyword.Type
'\n' Text.Whitespace

View File

@ -0,0 +1,12 @@
---input---
'#' - 1 #This is the comment
---tokens---
"'#'" Literal.String.Single
' ' Text.Whitespace
'-' Operator
' ' Text.Whitespace
'1' Literal.Number
' ' Text.Whitespace
'#This is the comment' Comment.Single
'\n' Text.Whitespace

42
tests/bqn/test_define.txt Normal file
View File

@ -0,0 +1,42 @@
---input---
⟨alias⇐a, b⟩ ← {
b‿c⇐
a⇐2
c←÷b↩1+a
}
---tokens---
'⟨' Punctuation
'alias' Name.Variable
'⇐' Keyword.Declaration
'a' Name.Variable
',' Punctuation
' ' Text.Whitespace
'b' Name.Variable
'⟩' Punctuation
' ' Text.Whitespace
'←' Keyword.Declaration
' ' Text.Whitespace
'{' Keyword.Type
'\n ' Text.Whitespace
'b' Name.Variable
'‿' Punctuation
'c' Name.Variable
'⇐' Keyword.Declaration
'\n ' Text.Whitespace
'a' Name.Variable
'⇐' Keyword.Declaration
'2' Literal.Number
'\n ' Text.Whitespace
'c' Name.Variable
'←' Keyword.Declaration
'÷' Operator
'b' Name.Variable
'↩' Keyword.Declaration
'1' Literal.Number
'+' Operator
'a' Name.Variable
'\n' Text.Whitespace
'}' Keyword.Type
'\n' Text.Whitespace

View File

@ -0,0 +1,23 @@
---input---
⟨ט,√⟩ {𝕎𝕩}⌜ 1‿4‿9
---tokens---
'⟨' Punctuation
'×' Operator
'˜' Name.Attribute
',' Punctuation
'√' Operator
'⟩' Punctuation
' ' Text.Whitespace
'{' Keyword.Type
'𝕎' Operator
'𝕩' Name.Entity
'}' Keyword.Type
'⌜' Name.Attribute
' ' Text.Whitespace
'1' Literal.Number
'‿' Punctuation
'4' Literal.Number
'‿' Punctuation
'9' Literal.Number
'\n' Text.Whitespace

13
tests/c/builtin_types.txt Normal file
View File

@ -0,0 +1,13 @@
---input---
__int128
_BitInt(2)
---tokens---
'__int128' Keyword.Type
'\n' Text.Whitespace
'_BitInt' Keyword.Type
'(' Punctuation
'2' Literal.Number.Integer
')' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,31 @@
In the past the "*/" was marked as an error to "helpfully"
indicate a wrong comment end.
---input---
int m21=((result_0*0+result_1*/*0<-----*/1)%mod+mod)%mod;
---tokens---
'int' Keyword.Type
' ' Text.Whitespace
'm21' Name
'=' Operator
'(' Punctuation
'(' Punctuation
'result_0' Name
'*' Operator
'0' Literal.Number.Integer
'+' Operator
'result_1' Name
'*' Operator
'/*0<-----*/' Comment.Multiline
'1' Literal.Number.Integer
')' Punctuation
'%' Operator
'mod' Name
'+' Operator
'mod' Name
')' Punctuation
'%' Operator
'mod' Name
';' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,409 @@
---input---
int func1(int x, int y)
/*@requires y >= 0*/
{
return x / y;
}
int func2(int x, int y) //@requires y >= 0;
{
return x / y;
}
void func3()
//#test{};
{
fun(2,3)//test1;
;
}
int func4(int x, int y)
/*@requires y >= 0;*/
{
return x / y;
}
int func5(int x, int y)
/*@requires y >= 0
{
return x / y;
}
*/
{
return 2;
}
//@requires y >= 0;
//@requires y >= 0
/*
calling(2,5)
*/
/*
calling(2,5);
*/
int func6(int x, int y)
//@requires y >= 0
//@requires y >= 0;
/*
hello(2,3);
*/
/*
hello(2,3)
*/
{
// haha(2,3);
return x / y;
/*
callblabla(x, y);
*/
}
//@requires y >= 0;
//@requires y >= 0
/*
calling(2,5)
*/
/*
calling(2,5);
*/
int * //@# a pointer to int
func7 /* @# why a comment here? */ (
int /* the index has to be an int */ a, // index into the array
int *b //the array @!
)
/*
The end of the func params @ (@ will result error if parsed incorrectly)
*/
{
// yet another comment
return b[a];
}
---tokens---
'int' Keyword.Type
' ' Text.Whitespace
'func1' Name.Function
'(' Punctuation
'int' Keyword.Type
' ' Text.Whitespace
'x' Name
',' Punctuation
' ' Text.Whitespace
'int' Keyword.Type
' ' Text.Whitespace
'y' Name
')' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'/*@requires y >= 0*/' Comment.Multiline
'\n' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'return' Keyword
' ' Text.Whitespace
'x' Name
' ' Text.Whitespace
'/' Operator
' ' Text.Whitespace
'y' Name
';' Punctuation
'\n' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace
'\n' Text.Whitespace
'\n' Text.Whitespace
'int' Keyword.Type
' ' Text.Whitespace
'func2' Name.Function
'(' Punctuation
'int' Keyword.Type
' ' Text.Whitespace
'x' Name
',' Punctuation
' ' Text.Whitespace
'int' Keyword.Type
' ' Text.Whitespace
'y' Name
')' Punctuation
' ' Text.Whitespace
'//@requires y >= 0;\n' Comment.Single
'{' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'return' Keyword
' ' Text.Whitespace
'x' Name
' ' Text.Whitespace
'/' Operator
' ' Text.Whitespace
'y' Name
';' Punctuation
'\n' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace
'\n' Text.Whitespace
'\n' Text.Whitespace
'void' Keyword.Type
' ' Text.Whitespace
'func3' Name.Function
'(' Punctuation
')' Punctuation
'\n' Text.Whitespace
'//#test{};\n' Comment.Single
'{' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'fun' Name
'(' Punctuation
'2' Literal.Number.Integer
',' Punctuation
'3' Literal.Number.Integer
')' Punctuation
'//test1;\n' Comment.Single
' ' Text.Whitespace
';' Punctuation
'\n' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace
'\n' Text.Whitespace
'\n' Text.Whitespace
'int' Keyword.Type
' ' Text.Whitespace
'func4' Name.Function
'(' Punctuation
'int' Keyword.Type
' ' Text.Whitespace
'x' Name
',' Punctuation
' ' Text.Whitespace
'int' Keyword.Type
' ' Text.Whitespace
'y' Name
')' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'/*@requires y >= 0;*/' Comment.Multiline
'\n' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'return' Keyword
' ' Text.Whitespace
'x' Name
' ' Text.Whitespace
'/' Operator
' ' Text.Whitespace
'y' Name
';' Punctuation
'\n' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace
'\n' Text.Whitespace
'\n' Text.Whitespace
'int' Keyword.Type
' ' Text.Whitespace
'func5' Name.Function
'(' Punctuation
'int' Keyword.Type
' ' Text.Whitespace
'x' Name
',' Punctuation
' ' Text.Whitespace
'int' Keyword.Type
' ' Text.Whitespace
'y' Name
')' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'/*@requires y >= 0\n {\n return x / y;\n }\n */' Comment.Multiline
'\n' Text.Whitespace
' ' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'return' Keyword
' ' Text.Whitespace
'2' Literal.Number.Integer
';' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace
'\n' Text.Whitespace
'\n' Text.Whitespace
'//@requires y >= 0;\n' Comment.Single
'//@requires y >= 0\n' Comment.Single
'/*\ncalling(2,5)\n*/' Comment.Multiline
'\n' Text.Whitespace
'/*\ncalling(2,5);\n*/' Comment.Multiline
'\n' Text.Whitespace
'int' Keyword.Type
' ' Text.Whitespace
'func6' Name.Function
'(' Punctuation
'int' Keyword.Type
' ' Text.Whitespace
'x' Name
',' Punctuation
' ' Text.Whitespace
'int' Keyword.Type
' ' Text.Whitespace
'y' Name
')' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'//@requires y >= 0\n' Comment.Single
' ' Text.Whitespace
'//@requires y >= 0;\n' Comment.Single
' ' Text.Whitespace
'/*\n hello(2,3);\n */' Comment.Multiline
'\n' Text.Whitespace
' ' Text.Whitespace
'/*\n hello(2,3)\n */' Comment.Multiline
'\n' Text.Whitespace
' ' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'// haha(2,3);\n' Comment.Single
' ' Text.Whitespace
'return' Keyword
' ' Text.Whitespace
'x' Name
' ' Text.Whitespace
'/' Operator
' ' Text.Whitespace
'y' Name
';' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'/*\n callblabla(x, y);\n */' Comment.Multiline
'\n' Text.Whitespace
' ' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace
'//@requires y >= 0;\n' Comment.Single
'//@requires y >= 0\n' Comment.Single
'/*\ncalling(2,5)\n*/' Comment.Multiline
'\n' Text.Whitespace
'/*\ncalling(2,5);\n*/' Comment.Multiline
'\n' Text.Whitespace
'\n' Text.Whitespace
'\n' Text.Whitespace
'int' Keyword.Type
' ' Text.Whitespace
'*' Operator
' ' Text.Whitespace
'//@# a pointer to int\n' Comment.Single
'func7' Name.Function
' ' Text.Whitespace
'/* @# why a comment here? */' Comment.Multiline
' ' Text.Whitespace
'(' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'int' Keyword.Type
' ' Text.Whitespace
'/* the index has to be an int */' Comment.Multiline
' ' Text.Whitespace
'a' Name
',' Punctuation
' ' Text.Whitespace
'// index into the array\n' Comment.Single
' ' Text.Whitespace
'int' Keyword.Type
' ' Text.Whitespace
'*' Operator
'b' Name
' ' Text.Whitespace
'//the array @!\n' Comment.Single
')' Punctuation
'\n' Text.Whitespace
'/*\n The end of the func params @ (@ will result error if parsed incorrectly)\n*/' Comment.Multiline
'\n' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'// yet another comment\n' Comment.Single
' ' Text.Whitespace
'return' Keyword
' ' Text.Whitespace
'b' Name
'[' Punctuation
'a' Name
']' Punctuation
';' Punctuation
'\n' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace

31
tests/c/test_label.txt Normal file
View File

@ -0,0 +1,31 @@
---input---
int main()
{
foo:
goto foo;
}
---tokens---
'int' Keyword.Type
' ' Text.Whitespace
'main' Name.Function
'(' Punctuation
')' Punctuation
'\n' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
'foo' Name.Label
':' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'goto' Keyword
' ' Text.Whitespace
'foo' Name
';' Punctuation
'\n' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,35 @@
---input---
int main()
{
foo:return 0;
goto foo;
}
---tokens---
'int' Keyword.Type
' ' Text.Whitespace
'main' Name.Function
'(' Punctuation
')' Punctuation
'\n' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
'foo' Name.Label
':' Punctuation
'return' Keyword
' ' Text.Whitespace
'0' Literal.Number.Integer
';' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'goto' Keyword
' ' Text.Whitespace
'foo' Name
';' Punctuation
'\n' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,32 @@
---input---
int main()
{
foo :
goto foo;
}
---tokens---
'int' Keyword.Type
' ' Text.Whitespace
'main' Name.Function
'(' Punctuation
')' Punctuation
'\n' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
'foo' Name.Label
' ' Text.Whitespace
':' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'goto' Keyword
' ' Text.Whitespace
'foo' Name
';' Punctuation
'\n' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace

20
tests/c/test_numbers.txt Normal file
View File

@ -0,0 +1,20 @@
---input---
42 23.42 23. .42 023 0xdeadbeef 23e+42 42e-23
---tokens---
'42' Literal.Number.Integer
' ' Text.Whitespace
'23.42' Literal.Number.Float
' ' Text.Whitespace
'23.' Literal.Number.Float
' ' Text.Whitespace
'.42' Literal.Number.Float
' ' Text.Whitespace
'023' Literal.Number.Oct
' ' Text.Whitespace
'0xdeadbeef' Literal.Number.Hex
' ' Text.Whitespace
'23e+42' Literal.Number.Float
' ' Text.Whitespace
'42e-23' Literal.Number.Float
'\n' Text.Whitespace

View File

@ -0,0 +1,17 @@
---input---
#include <foo>
# include <foo>
---tokens---
'#' Comment.Preproc
'include' Comment.Preproc
' ' Text.Whitespace
'<foo>' Comment.PreprocFile
'\n' Comment.Preproc
'#' Comment.Preproc
' ' Text.Whitespace
'include' Comment.Preproc
' ' Text.Whitespace
'<foo>' Comment.PreprocFile
'\n' Comment.Preproc

View File

@ -0,0 +1,17 @@
---input---
#include "foo.h"
# include "foo.h"
---tokens---
'#' Comment.Preproc
'include' Comment.Preproc
' ' Text.Whitespace
'"foo.h"' Comment.PreprocFile
'\n' Comment.Preproc
'#' Comment.Preproc
' ' Text.Whitespace
'include' Comment.Preproc
' ' Text.Whitespace
'"foo.h"' Comment.PreprocFile
'\n' Comment.Preproc

View File

@ -0,0 +1,18 @@
Space around line break before macro is valid C, but failed to parse previously.
---input---
foo();
#define FOO 0
---tokens---
'foo' Name
'(' Punctuation
')' Punctuation
';' Punctuation
' ' Text.Whitespace
'\n' Text.Whitespace
' ' Text.Whitespace
'#' Comment.Preproc
'define FOO 0' Comment.Preproc
'\n' Comment.Preproc

View File

@ -0,0 +1,13 @@
Comments can precede preprocessor macros
---input---
/* Comment */ /* Another */ #define FOO 0
---tokens---
'/* Comment */' Comment.Multiline
' ' Text.Whitespace
'/* Another */' Comment.Multiline
' ' Text.Whitespace
'#' Comment.Preproc
'define FOO 0' Comment.Preproc
'\n' Comment.Preproc

View File

@ -0,0 +1,19 @@
Preprocessor macros should appear only at the beginning of the line.
Otherwise we should produce an error token.
---input---
foo(); #define FOO 0
---tokens---
'foo' Name
'(' Punctuation
')' Punctuation
';' Punctuation
' ' Text.Whitespace
'#' Error
'define' Name
' ' Text.Whitespace
'FOO' Name
' ' Text.Whitespace
'0' Literal.Number.Integer
'\n' Text.Whitespace

View File

@ -0,0 +1,41 @@
---input---
// This should not be recognized as a function declaration followed by
// garbage.
string xyz(");");
// This should not be recognized as a function definition.
string xyz("){ }");
---tokens---
'// This should not be recognized as a function declaration followed by\n' Comment.Single
'// garbage.\n' Comment.Single
'string' Name
' ' Text.Whitespace
'xyz' Name
'(' Punctuation
'"' Literal.String
');' Literal.String
'"' Literal.String
')' Punctuation
';' Punctuation
'\n' Text.Whitespace
'\n' Text.Whitespace
'// This should not be recognized as a function definition.\n' Comment.Single
'\n' Text.Whitespace
'string' Name
' ' Text.Whitespace
'xyz' Name
'(' Punctuation
'"' Literal.String
'){ }' Literal.String
'"' Literal.String
')' Punctuation
';' Punctuation
'\n' Text.Whitespace

56
tests/c/test_switch.txt Normal file
View File

@ -0,0 +1,56 @@
---input---
int main()
{
switch (0)
{
case 0:
default:
;
}
}
---tokens---
'int' Keyword.Type
' ' Text.Whitespace
'main' Name.Function
'(' Punctuation
')' Punctuation
'\n' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'switch' Keyword
' ' Text.Whitespace
'(' Punctuation
'0' Literal.Number.Integer
')' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'case' Keyword
' ' Text.Whitespace
'0' Literal.Number.Integer
':' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'default' Keyword
':' Operator
'\n' Text.Whitespace
' ' Text.Whitespace
';' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,58 @@
---input---
int main()
{
switch (0)
{
case 0 :
default :
;
}
}
---tokens---
'int' Keyword.Type
' ' Text.Whitespace
'main' Name.Function
'(' Punctuation
')' Punctuation
'\n' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'switch' Keyword
' ' Text.Whitespace
'(' Punctuation
'0' Literal.Number.Integer
')' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'case' Keyword
' ' Text.Whitespace
'0' Literal.Number.Integer
' ' Text.Whitespace
':' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'default' Keyword
' ' Text.Whitespace
':' Operator
'\n' Text.Whitespace
' ' Text.Whitespace
';' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,80 @@
---input---
/*
This
is
a
long
unterminated
comment
with
many
newlines.
It
should
take
a
reasonable
time
to
lex.
---tokens---
'/' Operator
'*' Operator
'\n' Text.Whitespace
'This' Name.Other
'\n' Text.Whitespace
'is' Keyword
'\n' Text.Whitespace
'a' Name.Other
'\n' Text.Whitespace
'long' Name.Other
'\n' Text.Whitespace
'unterminated' Name.Other
'\n' Text.Whitespace
'comment' Name.Other
'\n' Text.Whitespace
'with' Name.Other
'\n' Text.Whitespace
'many' Name.Other
'\n' Text.Whitespace
'newlines' Name.Other
'.' Punctuation
'\n' Text.Whitespace
'\n' Text.Whitespace
'It' Name.Other
'\n' Text.Whitespace
'should' Name.Other
'\n' Text.Whitespace
'take' Name.Other
'\n' Text.Whitespace
'a' Name.Other
'\n' Text.Whitespace
'reasonable' Name.Other
'\n' Text.Whitespace
'time' Name.Other
'\n' Text.Whitespace
'to' Name.Other
'\n' Text.Whitespace
'lex' Name.Other
'.' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,8 @@
---input---
<!--- cfcomment --->
---tokens---
'<!---' Comment.Multiline
' cfcomment ' Comment.Multiline
'--->' Comment.Multiline
'\n' Text

View File

@ -0,0 +1,12 @@
---input---
<!--- nested <!--- cfcomment ---> --->
---tokens---
'<!---' Comment.Multiline
' nested ' Comment.Multiline
'<!---' Comment.Multiline
' cfcomment ' Comment.Multiline
'--->' Comment.Multiline
' ' Comment.Multiline
'--->' Comment.Multiline
'\n' Text

View File

@ -0,0 +1,14 @@
# This demonstrates the case that "This isn't really guarding" comment
# refers to.
---input---
/a/x;
---tokens---
'' Text
'/' Operator
'a' Name.Other
'/' Operator
'x' Name.Other
';' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,13 @@
---input---
a?/foo/:1/2;
---tokens---
'a' Name.Other
'?' Operator
'/foo/' Literal.String.Regex
':' Operator
'1' Literal.Number.Integer
'/' Operator
'2' Literal.Number.Integer
';' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,14 @@
# Test that missing backslash means it's no prompt.
---input---
$ echo "> not a prompt"
> not a prompt
---tokens---
'$ ' Generic.Prompt
'echo' Name.Builtin
' ' Text.Whitespace
'"> not a prompt"' Literal.String.Double
'\n' Text.Whitespace
'> not a prompt\n' Generic.Output

View File

@ -0,0 +1,21 @@
# Test that output that looks like a prompt is not detected as such.
---input---
$ cat \
> test.txt
line1
> file content, not prompt!
---tokens---
'$ ' Generic.Prompt
'cat' Text
' ' Text.Whitespace
'\\\n' Literal.String.Escape
'> ' Generic.Prompt
'test.txt' Text
'\n' Text.Whitespace
'line1\n' Generic.Output
'> file content, not prompt!\n' Generic.Output

View File

@ -0,0 +1,15 @@
---input---
$ ls\
> /does/not/exist
ls: cannot access ...
---tokens---
'$ ' Generic.Prompt
'ls' Text
'\\\n' Literal.String.Escape
'> ' Generic.Prompt
'/does/not/exist' Text
'\n' Text.Whitespace
'ls: cannot access ...\n' Generic.Output

View File

@ -0,0 +1,6 @@
---input---
$# comment
---tokens---
'$' Generic.Prompt
'# comment\n' Comment.Single

View File

@ -0,0 +1,16 @@
---input---
$ echo \
hi
hi
---tokens---
'$ ' Generic.Prompt
'echo' Name.Builtin
' ' Text.Whitespace
'\\\n' Literal.String.Escape
' ' Text.Whitespace
'hi' Text
'\n' Text.Whitespace
'hi\n' Generic.Output

View File

@ -0,0 +1,16 @@
---input---
$ echo \
> hi
hi
---tokens---
'$ ' Generic.Prompt
'echo' Name.Builtin
' ' Text.Whitespace
'\\\n' Literal.String.Escape
'> ' Generic.Prompt
'hi' Text
'\n' Text.Whitespace
'hi\n' Generic.Output

View File

@ -0,0 +1,16 @@
---input---
$ ls \
hi
hi
---tokens---
'$ ' Generic.Prompt
'ls' Text
' ' Text.Whitespace
'\\\n' Literal.String.Escape
' ' Text.Whitespace
'hi' Text
'\n' Text.Whitespace
'hi\n' Generic.Output

View File

@ -0,0 +1,16 @@
---input---
$ ls \
> hi
hi
---tokens---
'$ ' Generic.Prompt
'ls' Text
' ' Text.Whitespace
'\\\n' Literal.String.Escape
'> ' Generic.Prompt
'hi' Text
'\n' Text.Whitespace
'hi\n' Generic.Output

View File

@ -0,0 +1,11 @@
---input---
(env) [~/project]$ foo -h
---tokens---
'(env)' Generic.Prompt.VirtualEnv
' ' Text
'[~/project]$ ' Generic.Prompt
'foo' Text
' ' Text.Whitespace
'-h' Text
'\n' Text.Whitespace

View File

@ -0,0 +1,15 @@
---input---
Check (α ≻ β).
---tokens---
'Check' Keyword.Namespace
' ' Text
'(' Operator
'α' Name
' ' Text
'≻' Name.Builtin.Pseudo
' ' Text
'β' Name
')' Operator
'.' Operator
'\n' Text

View File

@ -0,0 +1,46 @@
---input---
and
and_eq
bitand
bitor
compl
not
not_eq
or
or_eq
xor
xor_eq
---tokens---
'and' Keyword
'\n' Text.Whitespace
'and_eq' Keyword
'\n' Text.Whitespace
'bitand' Keyword
'\n' Text.Whitespace
'bitor' Keyword
'\n' Text.Whitespace
'compl' Keyword
'\n' Text.Whitespace
'not' Keyword
'\n' Text.Whitespace
'not_eq' Keyword
'\n' Text.Whitespace
'or' Keyword
'\n' Text.Whitespace
'or_eq' Keyword
'\n' Text.Whitespace
'xor' Keyword
'\n' Text.Whitespace
'xor_eq' Keyword
'\n' Text.Whitespace

View File

@ -0,0 +1,17 @@
---input---
__restrict
__int128
_BitInt(2)
---tokens---
'__restrict' Keyword
'\n' Text.Whitespace
'__int128' Keyword.Type
'\n' Text.Whitespace
'_BitInt' Keyword.Type
'(' Punctuation
'2' Literal.Number.Integer
')' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,6 @@
---input---
/* foo */
---tokens---
'/* foo */' Comment.Multiline
'\n' Text.Whitespace

View File

@ -0,0 +1,5 @@
---input---
/* foo
---tokens---
'/* foo\n' Comment.Multiline

View File

@ -0,0 +1,146 @@
---input---
namespace 𝐨𝐩𝐭𝐢𝐨𝐧 {
int _hello();
}
int cześć = 2;
class 𝐨𝐩𝐭𝐢𝐨𝐧𝐬 final {
𝐨𝐩𝐭𝐢𝐨𝐧𝐬() {
爴:
int a = 𝐨𝐩𝐭𝐢𝐨𝐧::hello();
};
static 𝐨𝐩𝐭𝐢𝐨𝐧𝐬 𝔡𝔢𝔣𝔞𝔲𝔩𝔱;
static 𝐨𝐩𝐭𝐢𝐨𝐧𝐬 𝔢𝔵𝔠𝔢𝔭𝔱𝔦𝔬𝔫𝔰;
};
enum class { red, green = 15, blue };
---tokens---
'namespace' Keyword
' ' Text.Whitespace
'𝐨𝐩𝐭𝐢𝐨𝐧' Name.Namespace
' ' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'int' Keyword.Type
' ' Text.Whitespace
'_hello' Name.Function
'(' Punctuation
')' Punctuation
';' Punctuation
'\n' Text.Whitespace
'}' Punctuation
'\n' Text.Whitespace
'\n' Text.Whitespace
'int' Keyword.Type
' ' Text.Whitespace
'cześć' Name
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'2' Literal.Number.Integer
';' Punctuation
'\n' Text.Whitespace
'\n' Text.Whitespace
'class' Keyword
' ' Text.Whitespace
'𝐨𝐩𝐭𝐢𝐨𝐧𝐬' Name.Class
' ' Text.Whitespace
'final' Keyword
' ' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'𝐨𝐩𝐭𝐢𝐨𝐧𝐬' Name
'(' Punctuation
')' Punctuation
' ' Text.Whitespace
'{' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'爴' Name.Label
':' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'int' Keyword.Type
' ' Text.Whitespace
'a' Name
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'𝐨𝐩𝐭𝐢𝐨𝐧' Name
':' Operator
':' Operator
'hello' Name
'(' Punctuation
')' Punctuation
';' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'}' Punctuation
';' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'\n' Text.Whitespace
' ' Text.Whitespace
'static' Keyword
' ' Text.Whitespace
'𝐨𝐩𝐭𝐢𝐨𝐧𝐬' Name
' ' Text.Whitespace
'𝔡𝔢𝔣𝔞𝔲𝔩𝔱' Name
';' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'static' Keyword
' ' Text.Whitespace
'𝐨𝐩𝐭𝐢𝐨𝐧𝐬' Name
' ' Text.Whitespace
'𝔢𝔵𝔠𝔢𝔭𝔱𝔦𝔬𝔫𝔰' Name
';' Punctuation
'\n' Text.Whitespace
'}' Punctuation
';' Punctuation
'\n' Text.Whitespace
'\n' Text.Whitespace
'enum' Keyword
' ' Text.Whitespace
'class' Keyword
' ' Text.Whitespace
'' Name.Class
' ' Text.Whitespace
'{' Punctuation
' ' Text.Whitespace
'red' Name
',' Punctuation
' ' Text.Whitespace
'green' Name
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'15' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'blue' Name
' ' Text.Whitespace
'}' Punctuation
';' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,16 @@
---input---
@[FOO::Bar::Baz(opt: "xx")]
---tokens---
'@[' Operator
'FOO::Bar::Baz' Name.Decorator
'(' Punctuation
'opt' Literal.String.Symbol
':' Punctuation
' ' Text.Whitespace
'"' Literal.String.Double
'xx' Literal.String.Double
'"' Literal.String.Double
')' Punctuation
']' Operator
'\n' Text.Whitespace

View File

@ -0,0 +1,11 @@
---input---
[5][5]?
---tokens---
'[' Operator
'5' Literal.Number.Integer
']' Operator
'[' Operator
'5' Literal.Number.Integer
']?' Operator
'\n' Text.Whitespace

View File

@ -0,0 +1,25 @@
---input---
'a'
'я'
'\u{1234}'
'
'
'abc'
---tokens---
"'a'" Literal.String.Char
'\n' Text.Whitespace
"'я'" Literal.String.Char
'\n' Text.Whitespace
"'\\u{1234}'" Literal.String.Char
'\n' Text.Whitespace
"'\n'" Literal.String.Char
'\n' Text.Whitespace
"'" Error
'abc' Name
"'" Error
'\n' Text.Whitespace

View File

@ -0,0 +1,14 @@
---input---
HTTP
HTTP::Server.new
---tokens---
'HTTP' Name.Constant
'\n' Text.Whitespace
'HTTP' Name
'::' Operator
'Server' Name
'.' Operator
'new' Name
'\n' Text.Whitespace

View File

@ -0,0 +1,27 @@
---input---
%()
%[]
%{}
%<>
%||
---tokens---
'%(' Literal.String.Other
')' Literal.String.Other
'\n' Text.Whitespace
'%[' Literal.String.Other
']' Literal.String.Other
'\n' Text.Whitespace
'%{' Literal.String.Other
'}' Literal.String.Other
'\n' Text.Whitespace
'%<' Literal.String.Other
'>' Literal.String.Other
'\n' Text.Whitespace
'%|' Literal.String.Other
'|' Literal.String.Other
'\n' Text.Whitespace

View File

@ -0,0 +1,19 @@
---input---
str.gsub(%r{\\\\}, "/")
---tokens---
'str' Name
'.' Operator
'gsub' Name
'(' Punctuation
'%r{' Literal.String.Regex
'\\\\' Literal.String.Regex
'\\\\' Literal.String.Regex
'}' Literal.String.Regex
',' Punctuation
' ' Text.Whitespace
'"' Literal.String.Double
'/' Literal.String.Double
'"' Literal.String.Double
')' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,9 @@
---input---
"\#{a + b}"
---tokens---
'"' Literal.String.Double
'\\#' Literal.String.Escape
'{a + b}' Literal.String.Double
'"' Literal.String.Double
'\n' Text.Whitespace

View File

@ -0,0 +1,56 @@
---input---
"A#{ (3..5).group_by { |x| x/2}.map do |k,v| "#{k}" end.join }" + "Z"
---tokens---
'"' Literal.String.Double
'A' Literal.String.Double
'#{' Literal.String.Interpol
' ' Text.Whitespace
'(' Punctuation
'3' Literal.Number.Integer
'..' Operator
'5' Literal.Number.Integer
')' Punctuation
'.' Operator
'group_by' Name
' ' Text.Whitespace
'{' Literal.String.Interpol
' ' Text.Whitespace
'|' Operator
'x' Name
'|' Operator
' ' Text.Whitespace
'x' Name
'/' Operator
'2' Literal.Number.Integer
'}' Literal.String.Interpol
'.' Operator
'map' Name
' ' Text.Whitespace
'do' Keyword
' ' Text.Whitespace
'|' Operator
'k' Name
',' Punctuation
'v' Name
'|' Operator
' ' Text.Whitespace
'"' Literal.String.Double
'#{' Literal.String.Interpol
'k' Name
'}' Literal.String.Interpol
'"' Literal.String.Double
' ' Text.Whitespace
'end' Keyword
'.' Operator
'join' Name
' ' Text.Whitespace
'}' Literal.String.Interpol
'"' Literal.String.Double
' ' Text.Whitespace
'+' Operator
' ' Text.Whitespace
'"' Literal.String.Double
'Z' Literal.String.Double
'"' Literal.String.Double
'\n' Text.Whitespace

View File

@ -0,0 +1,58 @@
---input---
@[Link("some")]
lib LibSome
@[CallConvention("X86_StdCall")]
fun foo="some.foo"(thing : Void*) : LibC::Int
end
---tokens---
'@[' Operator
'Link' Name.Decorator
'(' Punctuation
'"' Literal.String.Double
'some' Literal.String.Double
'"' Literal.String.Double
')' Punctuation
']' Operator
'\n' Text.Whitespace
'lib' Keyword
' ' Text.Whitespace
'LibSome' Name.Namespace
'\n' Text.Whitespace
'@[' Operator
'CallConvention' Name.Decorator
'(' Punctuation
'"' Literal.String.Double
'X86_StdCall' Literal.String.Double
'"' Literal.String.Double
')' Punctuation
']' Operator
'\n' Text.Whitespace
'fun' Keyword
' ' Text.Whitespace
'foo' Name.Function
'=' Operator
'"' Literal.String.Double
'some.foo' Literal.String.Double
'"' Literal.String.Double
'(' Punctuation
'thing' Name
' ' Text.Whitespace
':' Punctuation
' ' Text.Whitespace
'Void' Name
'*' Operator
')' Punctuation
' ' Text.Whitespace
':' Punctuation
' ' Text.Whitespace
'LibC' Name
'::' Operator
'Int' Name
'\n' Text.Whitespace
'end' Keyword
'\n' Text.Whitespace

View File

@ -0,0 +1,76 @@
---input---
def<=>(other : self) : Int
{%for field in %w(first_name middle_name last_name)%}
cmp={{field.id}}<=>other.{{field.id}}
return cmp if cmp!=0
{%end%}
0
end
---tokens---
'def' Keyword
'<=>' Name.Function
'(' Punctuation
'other' Name
' ' Text.Whitespace
':' Punctuation
' ' Text.Whitespace
'self' Keyword
')' Punctuation
' ' Text.Whitespace
':' Punctuation
' ' Text.Whitespace
'Int' Name
'\n' Text.Whitespace
'{%' Literal.String.Interpol
'for' Keyword
' ' Text.Whitespace
'field' Name
' ' Text.Whitespace
'in' Keyword
' ' Text.Whitespace
'%w(' Literal.String.Other
'first_name middle_name last_name' Literal.String.Other
')' Literal.String.Other
'%}' Literal.String.Interpol
'\n' Text.Whitespace
'cmp' Name
'=' Operator
'{{' Literal.String.Interpol
'field' Name
'.' Operator
'id' Name
'}}' Literal.String.Interpol
'<=>' Operator
'other' Name
'.' Operator
'{{' Literal.String.Interpol
'field' Name
'.' Operator
'id' Name
'}}' Literal.String.Interpol
'\n' Text.Whitespace
'return' Keyword
' ' Text.Whitespace
'cmp' Name
' ' Text.Whitespace
'if' Keyword
' ' Text.Whitespace
'cmp' Name
'!=' Operator
'0' Literal.Number.Integer
'\n' Text.Whitespace
'{%' Literal.String.Interpol
'end' Keyword
'%}' Literal.String.Interpol
'\n' Text.Whitespace
'0' Literal.Number.Integer
'\n' Text.Whitespace
'end' Keyword
'\n' Text.Whitespace

View File

@ -0,0 +1,84 @@
---input---
# Integers
0
1
1_000_000
1u8
11231231231121312i64
# Floats
0.0
1.0_f32
1_f32
0f64
1e+4
1e111
1_234.567_890
# Error
01
0b2
0x129g2
0o12358
---tokens---
'# Integers' Comment.Single
'\n' Text.Whitespace
'0' Literal.Number.Integer
'\n' Text.Whitespace
'1' Literal.Number.Integer
'\n' Text.Whitespace
'1_000_000' Literal.Number.Integer
'\n' Text.Whitespace
'1u8' Literal.Number.Integer
'\n' Text.Whitespace
'11231231231121312i64' Literal.Number.Integer
'\n\n' Text.Whitespace
'# Floats' Comment.Single
'\n' Text.Whitespace
'0.0' Literal.Number.Float
'\n' Text.Whitespace
'1.0_f32' Literal.Number.Float
'\n' Text.Whitespace
'1_f32' Literal.Number.Float
'\n' Text.Whitespace
'0f64' Literal.Number.Float
'\n' Text.Whitespace
'1e+4' Literal.Number.Float
'\n' Text.Whitespace
'1e111' Literal.Number.Float
'\n' Text.Whitespace
'1_234.567_890' Literal.Number.Float
'\n\n' Text.Whitespace
'# Error' Comment.Single
'\n' Text.Whitespace
'0' Error
'1' Literal.Number.Integer
'\n' Text.Whitespace
'0' Error
'b2' Name
'\n' Text.Whitespace
'0' Error
'x129g2' Name
'\n' Text.Whitespace
'0' Error
'o12358' Name
'\n' Text.Whitespace

View File

@ -0,0 +1,18 @@
---input---
([] of Int32).[]?(5)
---tokens---
'(' Punctuation
'[' Operator
']' Operator
' ' Text.Whitespace
'of' Keyword
' ' Text.Whitespace
'Int32' Name
')' Punctuation
'.' Operator
'[]?' Name.Operator
'(' Punctuation
'5' Literal.Number.Integer
')' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,41 @@
---input---
%(hello ("world"))
%[hello ["world"]]
%{hello "world"}
%<hello <"world">>
%|hello "world"|
---tokens---
'%(' Literal.String.Other
'hello ' Literal.String.Other
'(' Literal.String.Other
'"world"' Literal.String.Other
')' Literal.String.Other
')' Literal.String.Other
'\n' Text.Whitespace
'%[' Literal.String.Other
'hello ' Literal.String.Other
'[' Literal.String.Other
'"world"' Literal.String.Other
']' Literal.String.Other
']' Literal.String.Other
'\n' Text.Whitespace
'%{' Literal.String.Other
'hello "world"' Literal.String.Other
'}' Literal.String.Other
'\n' Text.Whitespace
'%<' Literal.String.Other
'hello ' Literal.String.Other
'<' Literal.String.Other
'"world"' Literal.String.Other
'>' Literal.String.Other
'>' Literal.String.Other
'\n' Text.Whitespace
'%|' Literal.String.Other
'hello "world"' Literal.String.Other
'|' Literal.String.Other
'\n' Text.Whitespace

View File

@ -0,0 +1,31 @@
---input---
%Q(hello \n #{name})
%q(hello \n #{name})
%w(foo\nbar baz)
---tokens---
'%Q(' Literal.String.Other
'hello ' Literal.String.Other
'\\n' Literal.String.Escape
' ' Literal.String.Other
'#{' Literal.String.Interpol
'name' Name
'}' Literal.String.Interpol
')' Literal.String.Other
'\n' Text.Whitespace
'%q(' Literal.String.Other
'hello ' Literal.String.Other
'\\' Literal.String.Other
'n ' Literal.String.Other
'#' Literal.String.Other
'{name}' Literal.String.Other
')' Literal.String.Other
'\n' Text.Whitespace
'%w(' Literal.String.Other
'foo' Literal.String.Other
'\\' Literal.String.Other
'nbar baz' Literal.String.Other
')' Literal.String.Other
'\n' Text.Whitespace

View File

@ -0,0 +1,20 @@
---input---
record Cls do
def_equals s
end
---tokens---
'record' Name.Builtin.Pseudo
' ' Text.Whitespace
'Cls' Name
' ' Text.Whitespace
'do' Keyword
'\n' Text.Whitespace
'def_equals' Name.Builtin.Pseudo
' ' Text.Whitespace
's' Name
'\n' Text.Whitespace
'end' Keyword
'\n' Text.Whitespace

View File

@ -0,0 +1,50 @@
---input---
def f(x : T, line = __LINE__) forall T
if x.is_a?(String)
pp! x
end
end
---tokens---
'def' Keyword
' ' Text.Whitespace
'f' Name.Function
'(' Punctuation
'x' Name
' ' Text.Whitespace
':' Punctuation
' ' Text.Whitespace
'T' Name
',' Punctuation
' ' Text.Whitespace
'line' Name
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'__LINE__' Keyword.Pseudo
')' Punctuation
' ' Text.Whitespace
'forall' Keyword.Pseudo
' ' Text.Whitespace
'T' Name
'\n' Text.Whitespace
'if' Keyword
' ' Text.Whitespace
'x' Name
'.is_a?' Keyword.Pseudo
'(' Punctuation
'String' Name
')' Punctuation
'\n' Text.Whitespace
'pp!' Name.Builtin.Pseudo
' ' Text.Whitespace
'x' Name
'\n' Text.Whitespace
'end' Keyword
'\n' Text.Whitespace
'end' Keyword
'\n' Text.Whitespace

View File

@ -0,0 +1,8 @@
---input---
1...3
---tokens---
'1' Literal.Number.Integer
'...' Operator
'3' Literal.Number.Integer
'\n' Text.Whitespace

View File

@ -0,0 +1,10 @@
---input---
1 .. 3
---tokens---
'1' Literal.Number.Integer
' ' Text.Whitespace
'..' Operator
' ' Text.Whitespace
'3' Literal.Number.Integer
'\n' Text.Whitespace

View File

@ -0,0 +1,58 @@
---input---
"a\nz"
"a\az"
"a\xffz"
"a\u1234z"
"a\000z"
"a\u{0}z"
"a\u{10AfF9}z"
---tokens---
'"' Literal.String.Double
'a' Literal.String.Double
'\\n' Literal.String.Escape
'z' Literal.String.Double
'"' Literal.String.Double
'\n' Text.Whitespace
'"' Literal.String.Double
'a' Literal.String.Double
'\\a' Literal.String.Escape
'z' Literal.String.Double
'"' Literal.String.Double
'\n' Text.Whitespace
'"' Literal.String.Double
'a' Literal.String.Double
'\\xff' Literal.String.Escape
'z' Literal.String.Double
'"' Literal.String.Double
'\n' Text.Whitespace
'"' Literal.String.Double
'a' Literal.String.Double
'\\u1234' Literal.String.Escape
'z' Literal.String.Double
'"' Literal.String.Double
'\n' Text.Whitespace
'"' Literal.String.Double
'a' Literal.String.Double
'\\000' Literal.String.Escape
'z' Literal.String.Double
'"' Literal.String.Double
'\n' Text.Whitespace
'"' Literal.String.Double
'a' Literal.String.Double
'\\u{0}' Literal.String.Escape
'z' Literal.String.Double
'"' Literal.String.Double
'\n' Text.Whitespace
'"' Literal.String.Double
'a' Literal.String.Double
'\\u{10AfF9}' Literal.String.Escape
'z' Literal.String.Double
'"' Literal.String.Double
'\n' Text.Whitespace

View File

@ -0,0 +1,20 @@
---input---
:sym_bol
:あ
:question?
:"symbol"
---tokens---
':sym_bol' Literal.String.Symbol
'\n' Text.Whitespace
':あ' Literal.String.Symbol
'\n' Text.Whitespace
':question?' Literal.String.Symbol
'\n' Text.Whitespace
':"' Literal.String.Symbol
'symbol' Literal.String.Symbol
'"' Literal.String.Symbol
'\n' Text.Whitespace

View File

@ -0,0 +1,11 @@
---input---
{{
characters$MACRO.
}}
---tokens---
'{{' Literal.String
'\ncharacters$MACRO.\n' Literal.String
'}}' Literal.String
'\n' Text.Whitespace

View File

@ -0,0 +1,16 @@
---input---
/*
* comment
*/
; comment
// comment
---tokens---
'/*\n * comment\n */' Comment.Multiline
'\n' Text.Whitespace
'; comment' Comment.Single
'\n' Text.Whitespace
'// comment' Comment.Single
'\n' Text.Whitespace

View File

@ -0,0 +1,122 @@
---input---
"\\"
{{\\}}
"\a"
{{\a}}
"\b"
{{\b}}
"\n"
{{\n}}
"\r"
{{\r}}
"\t"
{{\t}}
"\""
{{\"}}
"\012"
{{\012}}
"\345"
{{\345}}
"\67"
{{\67}}
---tokens---
'"' Literal.String
'\\\\' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'{{' Literal.String
'\\\\' Literal.String.Escape
'}}' Literal.String
'\n' Text.Whitespace
'"' Literal.String
'\\a' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'{{' Literal.String
'\\a' Literal.String.Escape
'}}' Literal.String
'\n' Text.Whitespace
'"' Literal.String
'\\b' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'{{' Literal.String
'\\b' Literal.String.Escape
'}}' Literal.String
'\n' Text.Whitespace
'"' Literal.String
'\\n' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'{{' Literal.String
'\\n' Literal.String.Escape
'}}' Literal.String
'\n' Text.Whitespace
'"' Literal.String
'\\r' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'{{' Literal.String
'\\r' Literal.String.Escape
'}}' Literal.String
'\n' Text.Whitespace
'"' Literal.String
'\\t' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'{{' Literal.String
'\\t' Literal.String.Escape
'}}' Literal.String
'\n' Text.Whitespace
'"' Literal.String
'\\"' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'{{' Literal.String
'\\"' Literal.String.Escape
'}}' Literal.String
'\n' Text.Whitespace
'"' Literal.String
'\\012' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'{{' Literal.String
'\\012' Literal.String.Escape
'}}' Literal.String
'\n' Text.Whitespace
'"' Literal.String
'\\345' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'{{' Literal.String
'\\345' Literal.String.Escape
'}}' Literal.String
'\n' Text.Whitespace
'"' Literal.String
'\\67' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'{{' Literal.String
'\\67' Literal.String.Escape
'}}' Literal.String
'\n' Text.Whitespace

View File

@ -0,0 +1,44 @@
---input---
#define MACRO(ARG1#ARG2) #macro_body#
#define/**/
MACRO(ARG1'ARG2' ARG3)/**/
#\#macro
body\##
---tokens---
'#define' Comment.Preproc
' ' Text.Whitespace
'MACRO' Comment.Preproc
'(' Punctuation
'ARG1' Comment.Preproc
'#' Punctuation
'ARG2' Comment.Preproc
')' Punctuation
' ' Text.Whitespace
'#' Punctuation
'macro_body' Comment.Preproc
'#' Punctuation
'\n' Text.Whitespace
'#define' Comment.Preproc
'/**/' Comment.Multiline
'\n' Text.Whitespace
'MACRO' Comment.Preproc
'(' Punctuation
'ARG1' Comment.Preproc
"'" Punctuation
'ARG2' Comment.Preproc
"'" Punctuation
' ' Text.Whitespace
'ARG3' Comment.Preproc
')' Punctuation
'/**/' Comment.Multiline
'\n' Text.Whitespace
'#' Punctuation
'\\#' Comment.Preproc
'macro\nbody' Comment.Preproc
'\\#' Comment.Preproc
'#' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,40 @@
---input---
$MACRO.(((x#y\)))' "(#'x)\)x\))"# {{x\))x)\)(#'}});
---tokens---
'$MACRO.' Comment.Preproc
'(' Punctuation
'(' Comment.Preproc
'(' Comment.Preproc
'x#y\\)' Comment.Preproc
')' Comment.Preproc
')' Comment.Preproc
"'" Punctuation
' ' Comment.Preproc
'"' Literal.String
'(' Error
'#' Error
"'" Error
'x' Literal.String
')' Error
'\\)' Comment.Preproc
'x' Literal.String
'\\)' Comment.Preproc
')' Error
'"' Literal.String
'#' Punctuation
' ' Comment.Preproc
'{{' Literal.String
'x' Literal.String
'\\)' Comment.Preproc
')' Error
'x' Literal.String
')' Error
'\\)' Comment.Preproc
'(' Error
'#' Error
"'" Error
'}}' Literal.String
')' Punctuation
';' Comment.Single
'\n' Text.Whitespace

View File

@ -0,0 +1,30 @@
---input---
0dbfs
A4
kr
ksmps
nchnls
nchnls_i
sr
---tokens---
'0dbfs' Name.Variable.Global
'\n' Text.Whitespace
'A4' Name.Variable.Global
'\n' Text.Whitespace
'kr' Name.Variable.Global
'\n' Text.Whitespace
'ksmps' Name.Variable.Global
'\n' Text.Whitespace
'nchnls' Name.Variable.Global
'\n' Text.Whitespace
'nchnls_i' Name.Variable.Global
'\n' Text.Whitespace
'sr' Name.Variable.Global
'\n' Text.Whitespace

View File

@ -0,0 +1,176 @@
---input---
goto aLabel
igoto aLabel
kgoto aLabel
reinit aLabel
rigoto aLabel
tigoto aLabel
cggoto 1==0, aLabel
cigoto 1==0, aLabel
cingoto 1==0, aLabel
ckgoto 1==0, aLabel
cngoto 1==0, aLabel
cnkgoto 1==0, aLabel
timout 0, 0, aLabel
loop_ge 0, 0, 0, aLabel
loop_gt 0, 0, 0, aLabel
loop_le 0, 0, 0, aLabel
loop_lt 0, 0, 0, aLabel
---tokens---
'goto' Keyword
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'igoto' Keyword
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'kgoto' Keyword
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'reinit' Keyword.Pseudo
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'rigoto' Keyword.Pseudo
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'tigoto' Keyword.Pseudo
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'cggoto' Keyword.Pseudo
' ' Text.Whitespace
'1' Literal.Number.Integer
'==' Operator
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'cigoto' Keyword.Pseudo
' ' Text.Whitespace
'1' Literal.Number.Integer
'==' Operator
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'cingoto' Keyword.Pseudo
' ' Text.Whitespace
'1' Literal.Number.Integer
'==' Operator
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'ckgoto' Keyword.Pseudo
' ' Text.Whitespace
'1' Literal.Number.Integer
'==' Operator
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'cngoto' Keyword.Pseudo
' ' Text.Whitespace
'1' Literal.Number.Integer
'==' Operator
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'cnkgoto' Keyword.Pseudo
' ' Text.Whitespace
'1' Literal.Number.Integer
'==' Operator
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'timout' Keyword.Pseudo
' ' Text.Whitespace
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'loop_ge' Keyword.Pseudo
' ' Text.Whitespace
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'loop_gt' Keyword.Pseudo
' ' Text.Whitespace
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'loop_le' Keyword.Pseudo
' ' Text.Whitespace
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace
'loop_lt' Keyword.Pseudo
' ' Text.Whitespace
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'0' Literal.Number.Integer
',' Punctuation
' ' Text.Whitespace
'aLabel' Name.Label
'\n' Text.Whitespace

View File

@ -0,0 +1,14 @@
---input---
#include/**/"file.udo"
#include/**/|file.udo|
---tokens---
'#include' Comment.Preproc
'/**/' Comment.Multiline
'"file.udo"' Literal.String
'\n' Text.Whitespace
'#include' Comment.Preproc
'/**/' Comment.Multiline
'|file.udo|' Literal.String
'\n' Text.Whitespace

View File

@ -0,0 +1,11 @@
---input---
#includestr/**/"$MACRO..udo"
---tokens---
'#includestr' Comment.Preproc
'/**/' Comment.Multiline
'"' Literal.String
'$MACRO.' Comment.Preproc
'.udo' Literal.String
'"' Literal.String
'\n' Text.Whitespace

View File

@ -0,0 +1,42 @@
---input---
instr/**/1,/**/N_a_M_e_,/**/+Name/**///
iDuration = p3
outc:a(aSignal)
endin
---tokens---
'instr' Keyword.Declaration
'/**/' Comment.Multiline
'1' Name.Function
',' Punctuation
'/**/' Comment.Multiline
'N_a_M_e_' Name.Function
',' Punctuation
'/**/' Comment.Multiline
'+' Punctuation
'Name' Name.Function
'/**/' Comment.Multiline
'//' Comment.Single
'\n' Text.Whitespace
' ' Text.Whitespace
'i' Keyword.Type
'Duration' Name
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'p3' Name.Variable.Instance
'\n' Text.Whitespace
' ' Text.Whitespace
'outc' Name.Builtin
':' Punctuation
'a' Keyword.Type
'(' Punctuation
'a' Keyword.Type
'Signal' Name
')' Punctuation
'\n' Text.Whitespace
'endin' Keyword.Declaration
'\n' Text.Whitespace

View File

@ -0,0 +1,62 @@
---input---
do
else
elseif
endif
enduntil
fi
if
ithen
kthen
od
then
until
while
return
rireturn
---tokens---
'do' Keyword
'\n' Text.Whitespace
'else' Keyword
'\n' Text.Whitespace
'elseif' Keyword
'\n' Text.Whitespace
'endif' Keyword
'\n' Text.Whitespace
'enduntil' Keyword
'\n' Text.Whitespace
'fi' Keyword
'\n' Text.Whitespace
'if' Keyword
'\n' Text.Whitespace
'ithen' Keyword
'\n' Text.Whitespace
'kthen' Keyword
'\n' Text.Whitespace
'od' Keyword
'\n' Text.Whitespace
'then' Keyword
'\n' Text.Whitespace
'until' Keyword
'\n' Text.Whitespace
'while' Keyword
'\n' Text.Whitespace
'return' Keyword.Pseudo
'\n' Text.Whitespace
'rireturn' Keyword.Pseudo
'\n' Text.Whitespace

View File

@ -0,0 +1,13 @@
---input---
aLabel:
label2:
---tokens---
'aLabel' Name.Label
':' Punctuation
'\n' Text.Whitespace
' ' Text.Whitespace
'label2' Name.Label
':' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,20 @@
---input---
#ifdef MACRO
#ifndef MACRO
#undef MACRO
---tokens---
'#ifdef' Comment.Preproc
' ' Text.Whitespace
'MACRO' Comment.Preproc
'\n' Text.Whitespace
'#ifndef' Comment.Preproc
' ' Text.Whitespace
'MACRO' Comment.Preproc
'\n' Text.Whitespace
'#undef' Comment.Preproc
' ' Text.Whitespace
'MACRO' Comment.Preproc
'\n' Text.Whitespace

View File

@ -0,0 +1,9 @@
---input---
kG:V
---tokens---
'k' Keyword.Type
'G' Name
':' Punctuation
'V' Name
'\n' Text.Whitespace

View File

@ -0,0 +1,52 @@
---input---
123 0123456789
0xabcdef0123456789 0XABCDEF
1e2
3e+4
5e-6
7E8
9E+0
1E-2
3.
4.56
.789
---tokens---
'123' Literal.Number.Integer
' ' Text.Whitespace
'0123456789' Literal.Number.Integer
'\n' Text.Whitespace
'0x' Keyword.Type
'abcdef0123456789' Literal.Number.Hex
' ' Text.Whitespace
'0X' Keyword.Type
'ABCDEF' Literal.Number.Hex
'\n' Text.Whitespace
'1e2' Literal.Number.Float
'\n' Text.Whitespace
'3e+4' Literal.Number.Float
'\n' Text.Whitespace
'5e-6' Literal.Number.Float
'\n' Text.Whitespace
'7E8' Literal.Number.Float
'\n' Text.Whitespace
'9E+0' Literal.Number.Float
'\n' Text.Whitespace
'1E-2' Literal.Number.Float
'\n' Text.Whitespace
'3.' Literal.Number.Float
'\n' Text.Whitespace
'4.56' Literal.Number.Float
'\n' Text.Whitespace
'.789' Literal.Number.Float
'\n' Text.Whitespace

View File

@ -0,0 +1,30 @@
---input---
# define MACRO#macro_body#
#define/**/
MACRO/**/
#\#macro
body\##
---tokens---
'# \tdefine' Comment.Preproc
' ' Text.Whitespace
'MACRO' Comment.Preproc
'#' Punctuation
'macro_body' Comment.Preproc
'#' Punctuation
'\n' Text.Whitespace
'#define' Comment.Preproc
'/**/' Comment.Multiline
'\n' Text.Whitespace
'MACRO' Comment.Preproc
'/**/' Comment.Multiline
'\n' Text.Whitespace
'#' Punctuation
'\\#' Comment.Preproc
'macro\nbody' Comment.Preproc
'\\#' Comment.Preproc
'#' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,114 @@
---input---
+
-
~
¬
!
*
/
^
%
<<
>>
<
>
<=
>=
==
!=
&
#
|
&&
||
?
:
+=
-=
*=
/=
---tokens---
'+' Operator
'\n' Text.Whitespace
'-' Operator
'\n' Text.Whitespace
'~' Operator
'\n' Text.Whitespace
'¬' Operator
'\n' Text.Whitespace
'!' Operator
'\n' Text.Whitespace
'*' Operator
'\n' Text.Whitespace
'/' Operator
'\n' Text.Whitespace
'^' Operator
'\n' Text.Whitespace
'%' Operator
'\n' Text.Whitespace
'<<' Operator
'\n' Text.Whitespace
'>>' Operator
'\n' Text.Whitespace
'<' Operator
'\n' Text.Whitespace
'>' Operator
'\n' Text.Whitespace
'<=' Operator
'\n' Text.Whitespace
'>=' Operator
'\n' Text.Whitespace
'==' Operator
'\n' Text.Whitespace
'!=' Operator
'\n' Text.Whitespace
'&' Operator
'\n' Text.Whitespace
'#' Operator
'\n' Text.Whitespace
'|' Operator
'\n' Text.Whitespace
'&&' Operator
'\n' Text.Whitespace
'||' Operator
'\n' Text.Whitespace
'?' Operator
'\n' Text.Whitespace
':' Operator
'\n' Text.Whitespace
'+=' Operator
'\n' Text.Whitespace
'-=' Operator
'\n' Text.Whitespace
'*=' Operator
'\n' Text.Whitespace
'/=' Operator
'\n' Text.Whitespace

View File

@ -0,0 +1,26 @@
---input---
#else
#end
#endif
###
@ 12345
@@ 67890
---tokens---
'#else' Comment.Preproc
'\n' Text.Whitespace
'#end' Comment.Preproc
'\n' Text.Whitespace
'#endif' Comment.Preproc
'\n' Text.Whitespace
'###' Comment.Preproc
'\n' Text.Whitespace
'@ \t12345' Comment.Preproc
'\n' Text.Whitespace
'@@ \t67890' Comment.Preproc
'\n' Text.Whitespace

View File

@ -0,0 +1,290 @@
---input---
printks "%!"
printks "%%"
printks "%n"
printks "%N"
printks "%r"
printks "%R"
printks "%t"
printks "%T"
printks "\\a"
printks "\\A"
printks "\\b"
printks "\\B"
printks "\\n"
printks "\\N"
printks "\\r"
printks "\\R"
printks "\\t"
printks "\\T"
prints "%!"
prints "%%"
prints "%n"
prints "%N"
prints "%r"
prints "%R"
prints "%t"
prints "%T"
prints "\\a"
prints "\\A"
prints "\\b"
prints "\\B"
prints "\\n"
prints "\\N"
prints "\\r"
prints "\\R"
prints "\\t"
prints "\\T"
---tokens---
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%!' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%%' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%n' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%N' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%r' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%R' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%t' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%T' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\a' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\A' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\b' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\B' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\n' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\N' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\r' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\R' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\t' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'printks' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\T' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%!' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%%' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%n' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%N' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%r' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%R' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%t' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'%T' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\a' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\A' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\b' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\B' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\n' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\N' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\r' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\R' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\t' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'prints' Name.Builtin
' ' Text.Whitespace
'"' Literal.String
'\\\\T' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace

Some files were not shown because too many files have changed in this diff Show More