mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-19 22:53:05 -03:00
Reorganize tests into a real spec suite
This commit is contained in:
13
spec/tests/c/builtin_types.txt
Normal file
13
spec/tests/c/builtin_types.txt
Normal 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
|
31
spec/tests/c/test_comment_end.txt
Normal file
31
spec/tests/c/test_comment_end.txt
Normal 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
|
409
spec/tests/c/test_function_comments.txt
Normal file
409
spec/tests/c/test_function_comments.txt
Normal 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
spec/tests/c/test_label.txt
Normal file
31
spec/tests/c/test_label.txt
Normal 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
|
35
spec/tests/c/test_label_followed_by_statement.txt
Normal file
35
spec/tests/c/test_label_followed_by_statement.txt
Normal 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
|
32
spec/tests/c/test_label_space_before_colon.txt
Normal file
32
spec/tests/c/test_label_space_before_colon.txt
Normal 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
spec/tests/c/test_numbers.txt
Normal file
20
spec/tests/c/test_numbers.txt
Normal 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
|
17
spec/tests/c/test_preproc_file.txt
Normal file
17
spec/tests/c/test_preproc_file.txt
Normal 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
|
17
spec/tests/c/test_preproc_file2.txt
Normal file
17
spec/tests/c/test_preproc_file2.txt
Normal 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
|
18
spec/tests/c/test_preproc_file3.txt
Normal file
18
spec/tests/c/test_preproc_file3.txt
Normal 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
|
13
spec/tests/c/test_preproc_file4.txt
Normal file
13
spec/tests/c/test_preproc_file4.txt
Normal 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
|
19
spec/tests/c/test_preproc_file5.txt
Normal file
19
spec/tests/c/test_preproc_file5.txt
Normal 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
|
41
spec/tests/c/test_string_resembling_decl_end.txt
Normal file
41
spec/tests/c/test_string_resembling_decl_end.txt
Normal 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
spec/tests/c/test_switch.txt
Normal file
56
spec/tests/c/test_switch.txt
Normal 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
|
58
spec/tests/c/test_switch_space_before_colon.txt
Normal file
58
spec/tests/c/test_switch_space_before_colon.txt
Normal 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
|
Reference in New Issue
Block a user