diff options
Diffstat (limited to 'tests/snippets')
444 files changed, 14753 insertions, 0 deletions
diff --git a/tests/snippets/apacheconf/test_directive_no_args.txt b/tests/snippets/apacheconf/test_directive_no_args.txt new file mode 100644 index 0000000..a2f3354 --- /dev/null +++ b/tests/snippets/apacheconf/test_directive_no_args.txt @@ -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 diff --git a/tests/snippets/apacheconf/test_fix_lock_absolute_path.txt b/tests/snippets/apacheconf/test_fix_lock_absolute_path.txt new file mode 100644 index 0000000..a274834 --- /dev/null +++ b/tests/snippets/apacheconf/test_fix_lock_absolute_path.txt @@ -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 diff --git a/tests/snippets/apacheconf/test_include_globs.txt b/tests/snippets/apacheconf/test_include_globs.txt new file mode 100644 index 0000000..495242e --- /dev/null +++ b/tests/snippets/apacheconf/test_include_globs.txt @@ -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 diff --git a/tests/snippets/apacheconf/test_malformed_scoped_directive_closing_tag.txt b/tests/snippets/apacheconf/test_malformed_scoped_directive_closing_tag.txt new file mode 100644 index 0000000..c65628b --- /dev/null +++ b/tests/snippets/apacheconf/test_malformed_scoped_directive_closing_tag.txt @@ -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 diff --git a/tests/snippets/apacheconf/test_multi_include_globs.txt b/tests/snippets/apacheconf/test_multi_include_globs.txt new file mode 100644 index 0000000..abf5bb0 --- /dev/null +++ b/tests/snippets/apacheconf/test_multi_include_globs.txt @@ -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 diff --git a/tests/snippets/apacheconf/test_multi_include_globs_root.txt b/tests/snippets/apacheconf/test_multi_include_globs_root.txt new file mode 100644 index 0000000..5df63e4 --- /dev/null +++ b/tests/snippets/apacheconf/test_multi_include_globs_root.txt @@ -0,0 +1,8 @@ +---input--- +Include /*conf/*.conf + +---tokens--- +'Include' Name.Builtin +' ' Text.Whitespace +'/*conf/*.conf' Literal.String.Other +'\n' Text.Whitespace diff --git a/tests/snippets/apacheconf/test_multiline_argument.txt b/tests/snippets/apacheconf/test_multiline_argument.txt new file mode 100644 index 0000000..4163970 --- /dev/null +++ b/tests/snippets/apacheconf/test_multiline_argument.txt @@ -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 diff --git a/tests/snippets/apacheconf/test_multiline_comment.txt b/tests/snippets/apacheconf/test_multiline_comment.txt new file mode 100644 index 0000000..cdcfe01 --- /dev/null +++ b/tests/snippets/apacheconf/test_multiline_comment.txt @@ -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 diff --git a/tests/snippets/apacheconf/test_normal_scoped_directive.txt b/tests/snippets/apacheconf/test_normal_scoped_directive.txt new file mode 100644 index 0000000..f00496d --- /dev/null +++ b/tests/snippets/apacheconf/test_normal_scoped_directive.txt @@ -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 diff --git a/tests/snippets/apl/test_leading_underscore.txt b/tests/snippets/apl/test_leading_underscore.txt new file mode 100644 index 0000000..c11258d --- /dev/null +++ b/tests/snippets/apl/test_leading_underscore.txt @@ -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 diff --git a/tests/snippets/asm/test_cpuid.txt b/tests/snippets/asm/test_cpuid.txt new file mode 100644 index 0000000..8256618 --- /dev/null +++ b/tests/snippets/asm/test_cpuid.txt @@ -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 diff --git a/tests/snippets/bibtex/test_basic_bst.txt b/tests/snippets/bibtex/test_basic_bst.txt new file mode 100644 index 0000000..c519ae0 --- /dev/null +++ b/tests/snippets/bibtex/test_basic_bst.txt @@ -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 diff --git a/tests/snippets/bibtex/test_comment.txt b/tests/snippets/bibtex/test_comment.txt new file mode 100644 index 0000000..6e98d64 --- /dev/null +++ b/tests/snippets/bibtex/test_comment.txt @@ -0,0 +1,7 @@ +---input--- +@COMMENT{test} + +---tokens--- +'@COMMENT' Comment +'{test}' Comment +'\n' Text.Whitespace diff --git a/tests/snippets/bibtex/test_entry.txt b/tests/snippets/bibtex/test_entry.txt new file mode 100644 index 0000000..c712a2f --- /dev/null +++ b/tests/snippets/bibtex/test_entry.txt @@ -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 diff --git a/tests/snippets/bibtex/test_mismatched_brace.txt b/tests/snippets/bibtex/test_mismatched_brace.txt new file mode 100644 index 0000000..6c1deda --- /dev/null +++ b/tests/snippets/bibtex/test_mismatched_brace.txt @@ -0,0 +1,10 @@ +---input--- +@PREAMBLE(""} + +---tokens--- +'@PREAMBLE' Name.Class +'(' Punctuation +'"' Literal.String +'"' Literal.String +'}' Error +'\n' Text.Whitespace diff --git a/tests/snippets/bibtex/test_missing_body.txt b/tests/snippets/bibtex/test_missing_body.txt new file mode 100644 index 0000000..24dad98 --- /dev/null +++ b/tests/snippets/bibtex/test_missing_body.txt @@ -0,0 +1,10 @@ +---input--- +@ARTICLE xxx + +---tokens--- +'@ARTICLE' Name.Class +' ' Text.Whitespace +'x' Error +'x' Error +'x' Error +'\n' Text.Whitespace diff --git a/tests/snippets/bibtex/test_preamble.txt b/tests/snippets/bibtex/test_preamble.txt new file mode 100644 index 0000000..9625f96 --- /dev/null +++ b/tests/snippets/bibtex/test_preamble.txt @@ -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 diff --git a/tests/snippets/bibtex/test_string.txt b/tests/snippets/bibtex/test_string.txt new file mode 100644 index 0000000..f76a31b --- /dev/null +++ b/tests/snippets/bibtex/test_string.txt @@ -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 diff --git a/tests/snippets/c/test_comment_end.txt b/tests/snippets/c/test_comment_end.txt new file mode 100644 index 0000000..2a21d65 --- /dev/null +++ b/tests/snippets/c/test_comment_end.txt @@ -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 diff --git a/tests/snippets/c/test_function_comments.txt b/tests/snippets/c/test_function_comments.txt new file mode 100644 index 0000000..e8d8a69 --- /dev/null +++ b/tests/snippets/c/test_function_comments.txt @@ -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 diff --git a/tests/snippets/c/test_label.txt b/tests/snippets/c/test_label.txt new file mode 100644 index 0000000..6f4ee80 --- /dev/null +++ b/tests/snippets/c/test_label.txt @@ -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 diff --git a/tests/snippets/c/test_label_followed_by_statement.txt b/tests/snippets/c/test_label_followed_by_statement.txt new file mode 100644 index 0000000..6dc8468 --- /dev/null +++ b/tests/snippets/c/test_label_followed_by_statement.txt @@ -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 diff --git a/tests/snippets/c/test_label_space_before_colon.txt b/tests/snippets/c/test_label_space_before_colon.txt new file mode 100644 index 0000000..2c3d065 --- /dev/null +++ b/tests/snippets/c/test_label_space_before_colon.txt @@ -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 diff --git a/tests/snippets/c/test_numbers.txt b/tests/snippets/c/test_numbers.txt new file mode 100644 index 0000000..75af6fd --- /dev/null +++ b/tests/snippets/c/test_numbers.txt @@ -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 diff --git a/tests/snippets/c/test_preproc_file.txt b/tests/snippets/c/test_preproc_file.txt new file mode 100644 index 0000000..2b5449e --- /dev/null +++ b/tests/snippets/c/test_preproc_file.txt @@ -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 diff --git a/tests/snippets/c/test_preproc_file2.txt b/tests/snippets/c/test_preproc_file2.txt new file mode 100644 index 0000000..5d6ef3b --- /dev/null +++ b/tests/snippets/c/test_preproc_file2.txt @@ -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 diff --git a/tests/snippets/c/test_preproc_file3.txt b/tests/snippets/c/test_preproc_file3.txt new file mode 100644 index 0000000..b36db4c --- /dev/null +++ b/tests/snippets/c/test_preproc_file3.txt @@ -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 diff --git a/tests/snippets/c/test_preproc_file4.txt b/tests/snippets/c/test_preproc_file4.txt new file mode 100644 index 0000000..db1592d --- /dev/null +++ b/tests/snippets/c/test_preproc_file4.txt @@ -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 diff --git a/tests/snippets/c/test_preproc_file5.txt b/tests/snippets/c/test_preproc_file5.txt new file mode 100644 index 0000000..f4a727b --- /dev/null +++ b/tests/snippets/c/test_preproc_file5.txt @@ -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 diff --git a/tests/snippets/c/test_string_resembling_decl_end.txt b/tests/snippets/c/test_string_resembling_decl_end.txt new file mode 100644 index 0000000..17ce223 --- /dev/null +++ b/tests/snippets/c/test_string_resembling_decl_end.txt @@ -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 diff --git a/tests/snippets/c/test_switch.txt b/tests/snippets/c/test_switch.txt new file mode 100644 index 0000000..d1c1148 --- /dev/null +++ b/tests/snippets/c/test_switch.txt @@ -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 diff --git a/tests/snippets/c/test_switch_space_before_colon.txt b/tests/snippets/c/test_switch_space_before_colon.txt new file mode 100644 index 0000000..583f77c --- /dev/null +++ b/tests/snippets/c/test_switch_space_before_colon.txt @@ -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 diff --git a/tests/snippets/cfm/test_basic_comment.txt b/tests/snippets/cfm/test_basic_comment.txt new file mode 100644 index 0000000..c07a72a --- /dev/null +++ b/tests/snippets/cfm/test_basic_comment.txt @@ -0,0 +1,8 @@ +---input--- +<!--- cfcomment ---> + +---tokens--- +'<!---' Comment.Multiline +' cfcomment ' Comment.Multiline +'--->' Comment.Multiline +'\n' Text diff --git a/tests/snippets/cfm/test_nested_comment.txt b/tests/snippets/cfm/test_nested_comment.txt new file mode 100644 index 0000000..f8aaf4c --- /dev/null +++ b/tests/snippets/cfm/test_nested_comment.txt @@ -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 diff --git a/tests/snippets/coffeescript/test_beware_infinite_loop.txt b/tests/snippets/coffeescript/test_beware_infinite_loop.txt new file mode 100644 index 0000000..886b706 --- /dev/null +++ b/tests/snippets/coffeescript/test_beware_infinite_loop.txt @@ -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 diff --git a/tests/snippets/coffeescript/test_mixed_slashes.txt b/tests/snippets/coffeescript/test_mixed_slashes.txt new file mode 100644 index 0000000..8701fad --- /dev/null +++ b/tests/snippets/coffeescript/test_mixed_slashes.txt @@ -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 diff --git a/tests/snippets/conftest.py b/tests/snippets/conftest.py new file mode 100644 index 0000000..02e6255 --- /dev/null +++ b/tests/snippets/conftest.py @@ -0,0 +1,32 @@ +""" + Generated lexer tests + ~~~~~~~~~~~~~~~~~~~~~ + + Checks that lexers output the expected tokens for each sample + under lexers/*/test_*.txt. + + After making a change, rather than updating the samples manually, + run `pytest --update-goldens tests/lexers`. + + To add a new sample, create a new file matching this pattern. + The directory must match the alias of the lexer to be used. + Populate only the input, then just `--update-goldens`. + + :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import pathlib +import pytest + +from tests.conftest import LexerInlineTestItem + + +def pytest_collect_file(parent, path): + if path.ext == '.txt': + return LexerTestFile.from_parent(parent, path=pathlib.Path(path)) + + +class LexerTestFile(pytest.File): + def collect(self): + yield LexerInlineTestItem.from_parent(self, name='') diff --git a/tests/snippets/console/fake_ps2_prompt.txt b/tests/snippets/console/fake_ps2_prompt.txt new file mode 100644 index 0000000..683b36d --- /dev/null +++ b/tests/snippets/console/fake_ps2_prompt.txt @@ -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 diff --git a/tests/snippets/console/prompt_in_output.txt b/tests/snippets/console/prompt_in_output.txt new file mode 100644 index 0000000..993bc75 --- /dev/null +++ b/tests/snippets/console/prompt_in_output.txt @@ -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 diff --git a/tests/snippets/console/ps2_prompt.txt b/tests/snippets/console/ps2_prompt.txt new file mode 100644 index 0000000..175a473 --- /dev/null +++ b/tests/snippets/console/ps2_prompt.txt @@ -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 diff --git a/tests/snippets/console/test_comment_after_prompt.txt b/tests/snippets/console/test_comment_after_prompt.txt new file mode 100644 index 0000000..f115715 --- /dev/null +++ b/tests/snippets/console/test_comment_after_prompt.txt @@ -0,0 +1,6 @@ +---input--- +$# comment + +---tokens--- +'$' Generic.Prompt +'# comment\n' Comment.Single diff --git a/tests/snippets/console/test_newline_in_echo_no_ps2.txt b/tests/snippets/console/test_newline_in_echo_no_ps2.txt new file mode 100644 index 0000000..57a1190 --- /dev/null +++ b/tests/snippets/console/test_newline_in_echo_no_ps2.txt @@ -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 diff --git a/tests/snippets/console/test_newline_in_echo_ps2.txt b/tests/snippets/console/test_newline_in_echo_ps2.txt new file mode 100644 index 0000000..b90eead --- /dev/null +++ b/tests/snippets/console/test_newline_in_echo_ps2.txt @@ -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 diff --git a/tests/snippets/console/test_newline_in_ls_no_ps2.txt b/tests/snippets/console/test_newline_in_ls_no_ps2.txt new file mode 100644 index 0000000..3366bc0 --- /dev/null +++ b/tests/snippets/console/test_newline_in_ls_no_ps2.txt @@ -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 diff --git a/tests/snippets/console/test_newline_in_ls_ps2.txt b/tests/snippets/console/test_newline_in_ls_ps2.txt new file mode 100644 index 0000000..bf1bae5 --- /dev/null +++ b/tests/snippets/console/test_newline_in_ls_ps2.txt @@ -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 diff --git a/tests/snippets/console/test_virtualenv.txt b/tests/snippets/console/test_virtualenv.txt new file mode 100644 index 0000000..420b07a --- /dev/null +++ b/tests/snippets/console/test_virtualenv.txt @@ -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 diff --git a/tests/snippets/coq/test_unicode.txt b/tests/snippets/coq/test_unicode.txt new file mode 100644 index 0000000..2007f7d --- /dev/null +++ b/tests/snippets/coq/test_unicode.txt @@ -0,0 +1,15 @@ +---input--- +Check (α ≻ β). + +---tokens--- +'Check' Keyword.Namespace +' ' Text +'(' Operator +'α' Name +' ' Text +'≻' Name.Builtin.Pseudo +' ' Text +'β' Name +')' Operator +'.' Operator +'\n' Text diff --git a/tests/snippets/cpp/test_good_comment.txt b/tests/snippets/cpp/test_good_comment.txt new file mode 100644 index 0000000..115516d --- /dev/null +++ b/tests/snippets/cpp/test_good_comment.txt @@ -0,0 +1,6 @@ +---input--- +/* foo */ + +---tokens--- +'/* foo */' Comment.Multiline +'\n' Text.Whitespace diff --git a/tests/snippets/cpp/test_open_comment.txt b/tests/snippets/cpp/test_open_comment.txt new file mode 100644 index 0000000..3799214 --- /dev/null +++ b/tests/snippets/cpp/test_open_comment.txt @@ -0,0 +1,5 @@ +---input--- +/* foo + +---tokens--- +'/* foo\n' Comment.Multiline diff --git a/tests/snippets/cpp/test_unicode_identifiers.txt b/tests/snippets/cpp/test_unicode_identifiers.txt new file mode 100644 index 0000000..c2f3e03 --- /dev/null +++ b/tests/snippets/cpp/test_unicode_identifiers.txt @@ -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 diff --git a/tests/snippets/crystal/test_annotation.txt b/tests/snippets/crystal/test_annotation.txt new file mode 100644 index 0000000..b585fa1 --- /dev/null +++ b/tests/snippets/crystal/test_annotation.txt @@ -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 diff --git a/tests/snippets/crystal/test_array_access.txt b/tests/snippets/crystal/test_array_access.txt new file mode 100644 index 0000000..6b36c51 --- /dev/null +++ b/tests/snippets/crystal/test_array_access.txt @@ -0,0 +1,11 @@ +---input--- +[5][5]? + +---tokens--- +'[' Operator +'5' Literal.Number.Integer +']' Operator +'[' Operator +'5' Literal.Number.Integer +']?' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_chars.txt b/tests/snippets/crystal/test_chars.txt new file mode 100644 index 0000000..c254bfb --- /dev/null +++ b/tests/snippets/crystal/test_chars.txt @@ -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 diff --git a/tests/snippets/crystal/test_constant_and_module.txt b/tests/snippets/crystal/test_constant_and_module.txt new file mode 100644 index 0000000..f8d33ff --- /dev/null +++ b/tests/snippets/crystal/test_constant_and_module.txt @@ -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 diff --git a/tests/snippets/crystal/test_escaped_bracestring.txt b/tests/snippets/crystal/test_escaped_bracestring.txt new file mode 100644 index 0000000..14718b9 --- /dev/null +++ b/tests/snippets/crystal/test_escaped_bracestring.txt @@ -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 diff --git a/tests/snippets/crystal/test_escaped_interpolation.txt b/tests/snippets/crystal/test_escaped_interpolation.txt new file mode 100644 index 0000000..c623464 --- /dev/null +++ b/tests/snippets/crystal/test_escaped_interpolation.txt @@ -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 diff --git a/tests/snippets/crystal/test_interpolation_nested_curly.txt b/tests/snippets/crystal/test_interpolation_nested_curly.txt new file mode 100644 index 0000000..f4a69f7 --- /dev/null +++ b/tests/snippets/crystal/test_interpolation_nested_curly.txt @@ -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 diff --git a/tests/snippets/crystal/test_lib.txt b/tests/snippets/crystal/test_lib.txt new file mode 100644 index 0000000..6f6f107 --- /dev/null +++ b/tests/snippets/crystal/test_lib.txt @@ -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 diff --git a/tests/snippets/crystal/test_macro.txt b/tests/snippets/crystal/test_macro.txt new file mode 100644 index 0000000..765caa2 --- /dev/null +++ b/tests/snippets/crystal/test_macro.txt @@ -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 diff --git a/tests/snippets/crystal/test_operator_methods.txt b/tests/snippets/crystal/test_operator_methods.txt new file mode 100644 index 0000000..084771f --- /dev/null +++ b/tests/snippets/crystal/test_operator_methods.txt @@ -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 diff --git a/tests/snippets/crystal/test_percent_strings.txt b/tests/snippets/crystal/test_percent_strings.txt new file mode 100644 index 0000000..80f247c --- /dev/null +++ b/tests/snippets/crystal/test_percent_strings.txt @@ -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 diff --git a/tests/snippets/crystal/test_percent_strings_special.txt b/tests/snippets/crystal/test_percent_strings_special.txt new file mode 100644 index 0000000..4ca1c0b --- /dev/null +++ b/tests/snippets/crystal/test_percent_strings_special.txt @@ -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 diff --git a/tests/snippets/crystal/test_pseudo_builtins.txt b/tests/snippets/crystal/test_pseudo_builtins.txt new file mode 100644 index 0000000..9c8c917 --- /dev/null +++ b/tests/snippets/crystal/test_pseudo_builtins.txt @@ -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 diff --git a/tests/snippets/crystal/test_pseudo_keywords.txt b/tests/snippets/crystal/test_pseudo_keywords.txt new file mode 100644 index 0000000..18827ad --- /dev/null +++ b/tests/snippets/crystal/test_pseudo_keywords.txt @@ -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 diff --git a/tests/snippets/crystal/test_range_syntax1.txt b/tests/snippets/crystal/test_range_syntax1.txt new file mode 100644 index 0000000..a3ba24a --- /dev/null +++ b/tests/snippets/crystal/test_range_syntax1.txt @@ -0,0 +1,8 @@ +---input--- +1...3 + +---tokens--- +'1' Literal.Number.Integer +'...' Operator +'3' Literal.Number.Integer +'\n' Text.Whitespace diff --git a/tests/snippets/crystal/test_range_syntax2.txt b/tests/snippets/crystal/test_range_syntax2.txt new file mode 100644 index 0000000..08bf4b1 --- /dev/null +++ b/tests/snippets/crystal/test_range_syntax2.txt @@ -0,0 +1,10 @@ +---input--- +1 .. 3 + +---tokens--- +'1' Literal.Number.Integer +' ' Text.Whitespace +'..' Operator +' ' Text.Whitespace +'3' Literal.Number.Integer +'\n' Text.Whitespace diff --git a/tests/snippets/csound/test_braced_strings.txt b/tests/snippets/csound/test_braced_strings.txt new file mode 100644 index 0000000..6921af9 --- /dev/null +++ b/tests/snippets/csound/test_braced_strings.txt @@ -0,0 +1,11 @@ +---input--- +{{ +characters$MACRO. +}} + +---tokens--- +'{{' Literal.String +'\ncharacters$MACRO.\n' Literal.String + +'}}' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/csound/test_comments.txt b/tests/snippets/csound/test_comments.txt new file mode 100644 index 0000000..e660c2b --- /dev/null +++ b/tests/snippets/csound/test_comments.txt @@ -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 diff --git a/tests/snippets/csound/test_escape_sequences.txt b/tests/snippets/csound/test_escape_sequences.txt new file mode 100644 index 0000000..8e7ba10 --- /dev/null +++ b/tests/snippets/csound/test_escape_sequences.txt @@ -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 diff --git a/tests/snippets/csound/test_function_like_macro_definitions.txt b/tests/snippets/csound/test_function_like_macro_definitions.txt new file mode 100644 index 0000000..555f4ad --- /dev/null +++ b/tests/snippets/csound/test_function_like_macro_definitions.txt @@ -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 diff --git a/tests/snippets/csound/test_function_like_macros.txt b/tests/snippets/csound/test_function_like_macros.txt new file mode 100644 index 0000000..955cc18 --- /dev/null +++ b/tests/snippets/csound/test_function_like_macros.txt @@ -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 diff --git a/tests/snippets/csound/test_global_value_identifiers.txt b/tests/snippets/csound/test_global_value_identifiers.txt new file mode 100644 index 0000000..4604200 --- /dev/null +++ b/tests/snippets/csound/test_global_value_identifiers.txt @@ -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 diff --git a/tests/snippets/csound/test_goto_statements.txt b/tests/snippets/csound/test_goto_statements.txt new file mode 100644 index 0000000..95a76ab --- /dev/null +++ b/tests/snippets/csound/test_goto_statements.txt @@ -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 diff --git a/tests/snippets/csound/test_include_directives.txt b/tests/snippets/csound/test_include_directives.txt new file mode 100644 index 0000000..b90f300 --- /dev/null +++ b/tests/snippets/csound/test_include_directives.txt @@ -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 diff --git a/tests/snippets/csound/test_includestr_directives.txt b/tests/snippets/csound/test_includestr_directives.txt new file mode 100644 index 0000000..0511c5d --- /dev/null +++ b/tests/snippets/csound/test_includestr_directives.txt @@ -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 diff --git a/tests/snippets/csound/test_instrument_blocks.txt b/tests/snippets/csound/test_instrument_blocks.txt new file mode 100644 index 0000000..b6b0ba9 --- /dev/null +++ b/tests/snippets/csound/test_instrument_blocks.txt @@ -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 diff --git a/tests/snippets/csound/test_keywords.txt b/tests/snippets/csound/test_keywords.txt new file mode 100644 index 0000000..eb67eca --- /dev/null +++ b/tests/snippets/csound/test_keywords.txt @@ -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 diff --git a/tests/snippets/csound/test_labels.txt b/tests/snippets/csound/test_labels.txt new file mode 100644 index 0000000..afa6be9 --- /dev/null +++ b/tests/snippets/csound/test_labels.txt @@ -0,0 +1,13 @@ +---input--- +aLabel: + label2: + +---tokens--- +'aLabel' Name.Label +':' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'label2' Name.Label +':' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/csound/test_macro_preprocessor_directives.txt b/tests/snippets/csound/test_macro_preprocessor_directives.txt new file mode 100644 index 0000000..0a576f6 --- /dev/null +++ b/tests/snippets/csound/test_macro_preprocessor_directives.txt @@ -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 diff --git a/tests/snippets/csound/test_name.txt b/tests/snippets/csound/test_name.txt new file mode 100644 index 0000000..7ae5d58 --- /dev/null +++ b/tests/snippets/csound/test_name.txt @@ -0,0 +1,9 @@ +---input--- +kG:V + +---tokens--- +'k' Keyword.Type +'G' Name +':' Punctuation +'V' Name +'\n' Text.Whitespace diff --git a/tests/snippets/csound/test_numbers.txt b/tests/snippets/csound/test_numbers.txt new file mode 100644 index 0000000..63a8106 --- /dev/null +++ b/tests/snippets/csound/test_numbers.txt @@ -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 diff --git a/tests/snippets/csound/test_object_like_macro_definitions.txt b/tests/snippets/csound/test_object_like_macro_definitions.txt new file mode 100644 index 0000000..dd165f3 --- /dev/null +++ b/tests/snippets/csound/test_object_like_macro_definitions.txt @@ -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 diff --git a/tests/snippets/csound/test_operators.txt b/tests/snippets/csound/test_operators.txt new file mode 100644 index 0000000..1154a44 --- /dev/null +++ b/tests/snippets/csound/test_operators.txt @@ -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 diff --git a/tests/snippets/csound/test_other_preprocessor_directives.txt b/tests/snippets/csound/test_other_preprocessor_directives.txt new file mode 100644 index 0000000..95026a0 --- /dev/null +++ b/tests/snippets/csound/test_other_preprocessor_directives.txt @@ -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 diff --git a/tests/snippets/csound/test_printks_and_prints_escape_sequences.txt b/tests/snippets/csound/test_printks_and_prints_escape_sequences.txt new file mode 100644 index 0000000..3663dbb --- /dev/null +++ b/tests/snippets/csound/test_printks_and_prints_escape_sequences.txt @@ -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 diff --git a/tests/snippets/csound/test_quoted_strings.txt b/tests/snippets/csound/test_quoted_strings.txt new file mode 100644 index 0000000..d7e828a --- /dev/null +++ b/tests/snippets/csound/test_quoted_strings.txt @@ -0,0 +1,9 @@ +---input--- +"characters$MACRO." + +---tokens--- +'"' Literal.String +'characters' Literal.String +'$MACRO.' Comment.Preproc +'"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/csound/test_user_defined_opcodes.txt b/tests/snippets/csound/test_user_defined_opcodes.txt new file mode 100644 index 0000000..6320566 --- /dev/null +++ b/tests/snippets/csound/test_user_defined_opcodes.txt @@ -0,0 +1,24 @@ +---input--- +opcode/**/aUDO,/**/i[],/**/aik// + aUDO +endop + +---tokens--- +'opcode' Keyword.Declaration +'/**/' Comment.Multiline +'aUDO' Name.Function +',' Punctuation +'/**/' Comment.Multiline +'i[]' Keyword.Type +',' Punctuation +'/**/' Comment.Multiline +'aik' Keyword.Type +'//' Comment.Single +'\n' Text.Whitespace + +' ' Text.Whitespace +'aUDO' Name.Function +'\n' Text.Whitespace + +'endop' Keyword.Declaration +'\n' Text.Whitespace diff --git a/tests/snippets/doscon/test_gt_only.txt b/tests/snippets/doscon/test_gt_only.txt new file mode 100644 index 0000000..b37b8fa --- /dev/null +++ b/tests/snippets/doscon/test_gt_only.txt @@ -0,0 +1,11 @@ +---input--- +> py +hi + +---tokens--- +'>' Generic.Prompt +' ' Text +'py' Text +'\n' Text + +'hi\n' Generic.Output diff --git a/tests/snippets/elpi/test_catastrophic_backtracking.txt b/tests/snippets/elpi/test_catastrophic_backtracking.txt new file mode 100644 index 0000000..a14a054 --- /dev/null +++ b/tests/snippets/elpi/test_catastrophic_backtracking.txt @@ -0,0 +1,6 @@ +---input--- +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + +---tokens--- +'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' Text +'\n' Text.Whitespace diff --git a/tests/snippets/elpi/test_chr.txt b/tests/snippets/elpi/test_chr.txt new file mode 100644 index 0000000..75291a3 --- /dev/null +++ b/tests/snippets/elpi/test_chr.txt @@ -0,0 +1,54 @@ +---input--- +constraint foo, bar { + + :name "myrule" + rule (odd X) \ (even X) | true <=> fail. + +} +rule. % not a kwd + +---tokens--- +'constraint' Keyword.Declaration +' ' Text.Whitespace +'foo, bar ' Name.Function +'{' Text +'\n\n ' Text.Whitespace +':name' Keyword.Mode +' ' Text.Whitespace +'"' Literal.String.Double +'myrule' Literal.String.Double +'"' Literal.String.Double +'\n ' Text.Whitespace +'rule' Keyword.Declaration +' ' Text.Whitespace +'(' Text +'odd' Text +' ' Text.Whitespace +'X' Name.Variable +')' Operator +' ' Text.Whitespace +'\\' Keyword.Declaration +' ' Text.Whitespace +'(' Text +'even' Text +' ' Text.Whitespace +'X' Name.Variable +')' Operator +' ' Text.Whitespace +'|' Keyword.Declaration +' ' Text.Whitespace +'true' Text +' ' Text.Whitespace +'<=>' Keyword.Declaration +' ' Text.Whitespace +'fail' Text +'.' Operator +'\n\n' Text.Whitespace + +'}' Text +'\n' Text.Whitespace + +'rule' Text +'.' Operator +' ' Text.Whitespace +'% not a kwd\n' Comment diff --git a/tests/snippets/elpi/test_clause.txt b/tests/snippets/elpi/test_clause.txt new file mode 100644 index 0000000..e485753 --- /dev/null +++ b/tests/snippets/elpi/test_clause.txt @@ -0,0 +1,67 @@ +---input--- +true. +stop :- !. +of (fun F) :- pi x\ of x => of (F x). +match (uvar as Y) :- print Y. + +---tokens--- +'true' Text +'.' Operator +'\n' Text.Whitespace + +'stop' Text +' ' Text.Whitespace +':-' Keyword.Declaration +' ' Text.Whitespace +'!' Keyword.Declaration +'.' Operator +'\n' Text.Whitespace + +'of' Text +' ' Text.Whitespace +'(' Text +'fun' Text +' ' Text.Whitespace +'F' Name.Variable +')' Operator +' ' Text.Whitespace +':-' Keyword.Declaration +' ' Text.Whitespace +'pi' Keyword.Declaration +' ' Text.Whitespace +'x' Name.Variable +'\\' Text +' ' Text.Whitespace +'of' Text +' ' Text.Whitespace +'x' Text +' ' Text.Whitespace +'=>' Keyword.Declaration +' ' Text.Whitespace +'of' Text +' ' Text.Whitespace +'(' Text +'F' Name.Variable +' ' Text.Whitespace +'x' Text +')' Operator +'.' Operator +'\n' Text.Whitespace + +'match' Text +' ' Text.Whitespace +'(' Text +'uvar' Keyword.Declaration +' ' Text.Whitespace +'as' Keyword.Declaration +' ' Text.Whitespace +'Y' Name.Variable +')' Operator +' ' Text.Whitespace +':-' Keyword.Declaration +' ' Text.Whitespace +'print' Text +' ' Text.Whitespace +'Y' Name.Variable +'.' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/elpi/test_namespace.txt b/tests/snippets/elpi/test_namespace.txt new file mode 100644 index 0000000..98a35b0 --- /dev/null +++ b/tests/snippets/elpi/test_namespace.txt @@ -0,0 +1,35 @@ +---input--- +namespace foo.bar { + baz :- std.do! []. +} +shorten foo. { bar }. + +---tokens--- +'namespace' Keyword.Declaration +' ' Text.Whitespace +'foo.bar' Text +' ' Text.Whitespace +'{\n' Text + +' ' Text.Whitespace +'baz' Text +' ' Text.Whitespace +':-' Keyword.Declaration +' ' Text.Whitespace +'std.do!' Text +' ' Text.Whitespace +'[]' Keyword.Declaration +'.' Operator +'\n' Text.Whitespace + +'}\n' Text + +'shorten' Keyword.Declaration +' ' Text.Whitespace +'foo.' Text +' ' Text.Whitespace +'{ ' Text +'bar' Text +' ' Text.Whitespace +'}.' Text +'\n' Text.Whitespace diff --git a/tests/snippets/elpi/test_pred.txt b/tests/snippets/elpi/test_pred.txt new file mode 100644 index 0000000..657c8fd --- /dev/null +++ b/tests/snippets/elpi/test_pred.txt @@ -0,0 +1,60 @@ +---input--- +pred p1. +pred p2 i:int, o:list A. +pred p3 i:(bool -> prop). +:index(_ 2) pred p4 i:int, i:A. + +---tokens--- +'pred' Keyword.Declaration +' ' Text.Whitespace +'p1' Name.Function +'.' Text +'\n' Text.Whitespace + +'pred' Keyword.Declaration +' ' Text.Whitespace +'p2' Name.Function +' ' Text.Whitespace +'i:' Keyword.Mode +'int' Keyword.Type +',' Text +' ' Text.Whitespace +'o:' Keyword.Mode +'list' Keyword.Type +' ' Text.Whitespace +'A' Keyword.Type +'.' Text +'\n' Text.Whitespace + +'pred' Keyword.Declaration +' ' Text.Whitespace +'p3' Name.Function +' ' Text.Whitespace +'i:' Keyword.Mode +'(' Keyword.Type +'bool' Keyword.Type +' ' Text.Whitespace +'->' Keyword.Type +' ' Text.Whitespace +'prop' Keyword.Type +')' Keyword.Type +'.' Text +'\n' Text.Whitespace + +':index' Keyword.Mode +'(' Text.Whitespace +'_ 2' Literal.Number.Integer +')' Text +' ' Text.Whitespace +'pred' Keyword.Declaration +' ' Text.Whitespace +'p4' Name.Function +' ' Text.Whitespace +'i:' Keyword.Mode +'int' Keyword.Type +',' Text +' ' Text.Whitespace +'i:' Keyword.Mode +'A' Keyword.Type +'.' Text +'\n' Text.Whitespace diff --git a/tests/snippets/elpi/test_type.txt b/tests/snippets/elpi/test_type.txt new file mode 100644 index 0000000..8a506ce --- /dev/null +++ b/tests/snippets/elpi/test_type.txt @@ -0,0 +1,112 @@ +---input--- +kind list type -> type. +type nil list A. +type cons A -> list A -> list A. +kind tm type. +type fun (tm -> tm) -> tm. +type app tm -> tm -> tm. +pred foo i:(tm -> tm), o:tm. + +---tokens--- +'kind' Keyword.Declaration +' ' Text.Whitespace +'list' Name.Function +' ' Text.Whitespace +'type' Keyword.Type +' ' Text.Whitespace +'->' Keyword.Type +' ' Text.Whitespace +'type' Keyword.Type +'.' Text +'\n' Text.Whitespace + +'type' Keyword.Declaration +' ' Text.Whitespace +'nil' Name.Function +' ' Text.Whitespace +'list' Keyword.Type +' ' Text.Whitespace +'A' Keyword.Type +'.' Text +'\n' Text.Whitespace + +'type' Keyword.Declaration +' ' Text.Whitespace +'cons' Name.Function +' ' Text.Whitespace +'A' Keyword.Type +' ' Text.Whitespace +'->' Keyword.Type +' ' Text.Whitespace +'list' Keyword.Type +' ' Text.Whitespace +'A' Keyword.Type +' ' Text.Whitespace +'->' Keyword.Type +' ' Text.Whitespace +'list' Keyword.Type +' ' Text.Whitespace +'A' Keyword.Type +'.' Text +'\n' Text.Whitespace + +'kind' Keyword.Declaration +' ' Text.Whitespace +'tm' Name.Function +' ' Text.Whitespace +'type' Keyword.Type +'.' Text +'\n' Text.Whitespace + +'type' Keyword.Declaration +' ' Text.Whitespace +'fun' Name.Function +' ' Text.Whitespace +'(' Keyword.Type +'tm' Keyword.Type +' ' Text.Whitespace +'->' Keyword.Type +' ' Text.Whitespace +'tm' Keyword.Type +')' Keyword.Type +' ' Text.Whitespace +'->' Keyword.Type +' ' Text.Whitespace +'tm' Keyword.Type +'.' Text +'\n' Text.Whitespace + +'type' Keyword.Declaration +' ' Text.Whitespace +'app' Name.Function +' ' Text.Whitespace +'tm' Keyword.Type +' ' Text.Whitespace +'->' Keyword.Type +' ' Text.Whitespace +'tm' Keyword.Type +' ' Text.Whitespace +'->' Keyword.Type +' ' Text.Whitespace +'tm' Keyword.Type +'.' Text +'\n' Text.Whitespace + +'pred' Keyword.Declaration +' ' Text.Whitespace +'foo' Name.Function +' ' Text.Whitespace +'i:' Keyword.Mode +'(' Keyword.Type +'tm' Keyword.Type +' ' Text.Whitespace +'->' Keyword.Type +' ' Text.Whitespace +'tm' Keyword.Type +')' Keyword.Type +',' Text +' ' Text.Whitespace +'o:' Keyword.Mode +'tm' Keyword.Type +'.' Text +'\n' Text.Whitespace diff --git a/tests/snippets/ezhil/test_function.txt b/tests/snippets/ezhil/test_function.txt new file mode 100644 index 0000000..f89a357 --- /dev/null +++ b/tests/snippets/ezhil/test_function.txt @@ -0,0 +1,100 @@ +---input--- +# (C) முத்தையா அண்ணாமலை 2013, 2015 +நிரல்பாகம் gcd ( x, y ) +மு = max(x,y) + q = min(x,y) + +@( q == 0 ) ஆனால் + பின்கொடு மு +முடி +பின்கொடு gcd( மு - q , q ) +முடி + +---tokens--- +'# (C) முத்தையா அண்ணாமலை 2013, 2015' Comment.Single +'\n' Text.Whitespace + +'நிரல்பாகம்' Keyword +' ' Text.Whitespace +'gcd' Name +' ' Text.Whitespace +'(' Punctuation +' ' Text.Whitespace +'x' Name +',' Operator +' ' Text.Whitespace +'y' Name +' ' Text.Whitespace +')' Punctuation +'\n' Text.Whitespace + +'மு' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'max' Name.Builtin +'(' Punctuation +'x' Name +',' Operator +'y' Name +')' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'q' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'min' Name.Builtin +'(' Punctuation +'x' Name +',' Operator +'y' Name +')' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'@' Operator +'(' Punctuation +' ' Text.Whitespace +'q' Name +' ' Text.Whitespace +'==' Operator +' ' Text.Whitespace +'0' Literal.Number.Integer +' ' Text.Whitespace +')' Punctuation +' ' Text.Whitespace +'ஆனால்' Keyword +'\n' Text.Whitespace + +' ' Text.Whitespace +'பின்கொடு' Keyword +' ' Text.Whitespace +'மு' Name +'\n' Text.Whitespace + +'முடி' Keyword +'\n' Text.Whitespace + +'பின்கொடு' Keyword +' ' Text.Whitespace +'gcd' Name +'(' Punctuation +' ' Text.Whitespace +'மு' Name +' ' Text.Whitespace +'-' Operator +' ' Text.Whitespace +'q' Name +' ' Text.Whitespace +',' Operator +' ' Text.Whitespace +'q' Name +' ' Text.Whitespace +')' Punctuation +'\n' Text.Whitespace + +'முடி' Keyword +'\n' Text.Whitespace diff --git a/tests/snippets/ezhil/test_gcd_expr.txt b/tests/snippets/ezhil/test_gcd_expr.txt new file mode 100644 index 0000000..f4aaed9 --- /dev/null +++ b/tests/snippets/ezhil/test_gcd_expr.txt @@ -0,0 +1,21 @@ +---input--- +1^3+(5-5)*gcd(a,b) + +---tokens--- +'1' Literal.Number.Integer +'^' Operator +'3' Literal.Number.Integer +'+' Operator +'(' Punctuation +'5' Literal.Number.Integer +'-' Operator +'5' Literal.Number.Integer +')' Punctuation +'*' Operator +'gcd' Name +'(' Punctuation +'a' Name +',' Operator +'b' Name +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/ezhil/test_if_statement.txt b/tests/snippets/ezhil/test_if_statement.txt new file mode 100644 index 0000000..2fe35b7 --- /dev/null +++ b/tests/snippets/ezhil/test_if_statement.txt @@ -0,0 +1,28 @@ +---input--- +@( 0 > 3 ) ஆனால் + பதிப்பி "wont print" +முடி + +---tokens--- +'@' Operator +'(' Punctuation +' ' Text.Whitespace +'0' Literal.Number.Integer +' ' Text.Whitespace +'>' Operator +' ' Text.Whitespace +'3' Literal.Number.Integer +' ' Text.Whitespace +')' Punctuation +' ' Text.Whitespace +'ஆனால்' Keyword +'\n' Text.Whitespace + +' ' Text.Whitespace +'பதிப்பி' Keyword +' ' Text.Whitespace +'"wont print"' Literal.String +'\n' Text.Whitespace + +'முடி' Keyword +'\n' Text.Whitespace diff --git a/tests/snippets/ezhil/test_sum.txt b/tests/snippets/ezhil/test_sum.txt new file mode 100644 index 0000000..fa2063d --- /dev/null +++ b/tests/snippets/ezhil/test_sum.txt @@ -0,0 +1,8 @@ +---input--- +1+3 + +---tokens--- +'1' Literal.Number.Integer +'+' Operator +'3' Literal.Number.Integer +'\n' Text.Whitespace diff --git a/tests/snippets/fortran/test_string_cataback.txt b/tests/snippets/fortran/test_string_cataback.txt new file mode 100644 index 0000000..9f4b9f1 --- /dev/null +++ b/tests/snippets/fortran/test_string_cataback.txt @@ -0,0 +1,112 @@ +---input--- +! Bad string, there isn't an even number of backslashes. +! This should not cause catastrophic backtracking. +'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + +---tokens--- +"! Bad string, there isn't an even number of backslashes.\n" Comment + +'! This should not cause catastrophic backtracking.\n' Comment + +"'" Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +'\\' Error +"'" Error +'\n' Text.Whitespace diff --git a/tests/snippets/gas/test_comments.txt b/tests/snippets/gas/test_comments.txt new file mode 100644 index 0000000..b385d27 --- /dev/null +++ b/tests/snippets/gas/test_comments.txt @@ -0,0 +1,29 @@ +---input--- +lock addq $0, /* comments */ (%rsp) /* +// comments +*/ xorq %rax, %rax // comments + +---tokens--- +'lock' Name.Attribute +' ' Text.Whitespace +'addq' Name.Function +' ' Text.Whitespace +'$0' Name.Constant +',' Punctuation +' ' Text.Whitespace +'/* comments */' Comment.Multiline +' ' Text.Whitespace +'(' Punctuation +'%rsp' Name.Variable +')' Punctuation +' ' Text.Whitespace +'/*\n// comments\n*/' Comment.Multiline +' ' Text.Whitespace +'xorq' Name.Function +' ' Text.Whitespace +'%rax' Name.Variable +',' Punctuation +' ' Text.Whitespace +'%rax' Name.Variable +' ' Text.Whitespace +'// comments\n' Comment.Single diff --git a/tests/snippets/gdscript/test_comment.txt b/tests/snippets/gdscript/test_comment.txt new file mode 100644 index 0000000..ee78bc5 --- /dev/null +++ b/tests/snippets/gdscript/test_comment.txt @@ -0,0 +1,6 @@ +---input--- +# Comment + +---tokens--- +'# Comment' Comment.Single +'\n' Text.Whitespace diff --git a/tests/snippets/gdscript/test_export_array.txt b/tests/snippets/gdscript/test_export_array.txt new file mode 100644 index 0000000..24a313a --- /dev/null +++ b/tests/snippets/gdscript/test_export_array.txt @@ -0,0 +1,17 @@ +---input--- +export (Array, AudioStream) var streams + +---tokens--- +'export' Keyword +' ' Text.Whitespace +'(' Punctuation +'Array' Name.Builtin.Type +',' Punctuation +' ' Text.Whitespace +'AudioStream' Name +')' Punctuation +' ' Text.Whitespace +'var' Keyword +' ' Text.Whitespace +'streams' Name +'\n' Text.Whitespace diff --git a/tests/snippets/gdscript/test_function_with_types.txt b/tests/snippets/gdscript/test_function_with_types.txt new file mode 100644 index 0000000..eedf371 --- /dev/null +++ b/tests/snippets/gdscript/test_function_with_types.txt @@ -0,0 +1,33 @@ +---input--- +func abc(arg: String) -> void: + print("Hello", arg) + +---tokens--- +'func' Keyword +' ' Text.Whitespace +'abc' Name +'(' Punctuation +'arg' Name +':' Punctuation +' ' Text.Whitespace +'String' Name.Builtin.Type +')' Punctuation +' ' Text.Whitespace +'-' Operator +'>' Operator +' ' Text.Whitespace +'void' Name.Builtin.Type +':' Punctuation +'\n' Text.Whitespace + +'\t' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +'"' Literal.String.Double +'Hello' Literal.String.Double +'"' Literal.String.Double +',' Punctuation +' ' Text.Whitespace +'arg' Name +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/gdscript/test_inner_class.txt b/tests/snippets/gdscript/test_inner_class.txt new file mode 100644 index 0000000..734242b --- /dev/null +++ b/tests/snippets/gdscript/test_inner_class.txt @@ -0,0 +1,20 @@ +---input--- +class InnerClass: + var a = 5 + +---tokens--- +'class' Keyword +' ' Text.Whitespace +'InnerClass' Name +':' Punctuation +'\n' Text.Whitespace + +'\t' Text.Whitespace +'var' Keyword +' ' Text.Whitespace +'a' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'5' Literal.Number.Integer +'\n' Text.Whitespace diff --git a/tests/snippets/gdscript/test_multiline_string.txt b/tests/snippets/gdscript/test_multiline_string.txt new file mode 100644 index 0000000..b098207 --- /dev/null +++ b/tests/snippets/gdscript/test_multiline_string.txt @@ -0,0 +1,8 @@ +---input--- +""" +Multiline +""" + +---tokens--- +'"""\nMultiline\n"""' Literal.String.Doc +'\n' Text.Whitespace diff --git a/tests/snippets/gdscript/test_signal.txt b/tests/snippets/gdscript/test_signal.txt new file mode 100644 index 0000000..43aa8ec --- /dev/null +++ b/tests/snippets/gdscript/test_signal.txt @@ -0,0 +1,15 @@ +---input--- +signal sig (arg1, arg2) + +---tokens--- +'signal' Keyword +' ' Text.Whitespace +'sig' Name +' ' Text.Whitespace +'(' Punctuation +'arg1' Name +',' Punctuation +' ' Text.Whitespace +'arg2' Name +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/gdscript/test_simple_function.txt b/tests/snippets/gdscript/test_simple_function.txt new file mode 100644 index 0000000..2f444ef --- /dev/null +++ b/tests/snippets/gdscript/test_simple_function.txt @@ -0,0 +1,22 @@ +---input--- +func abc(arg): + print("Hello, World!") + +---tokens--- +'func' Keyword +' ' Text.Whitespace +'abc' Name +'(' Punctuation +'arg' Name +')' Punctuation +':' Punctuation +'\n' Text.Whitespace + +'\t' Text.Whitespace +'print' Name.Builtin +'(' Punctuation +'"' Literal.String.Double +'Hello, World!' Literal.String.Double +'"' Literal.String.Double +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/gdscript/test_variable_declaration_and_assigment.txt b/tests/snippets/gdscript/test_variable_declaration_and_assigment.txt new file mode 100644 index 0000000..b2ee890 --- /dev/null +++ b/tests/snippets/gdscript/test_variable_declaration_and_assigment.txt @@ -0,0 +1,12 @@ +---input--- +var abc = 5.4 + +---tokens--- +'var' Keyword +' ' Text.Whitespace +'abc' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'5.4' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/haskell/test_promoted_names.txt b/tests/snippets/haskell/test_promoted_names.txt new file mode 100644 index 0000000..42d7755 --- /dev/null +++ b/tests/snippets/haskell/test_promoted_names.txt @@ -0,0 +1,10 @@ +---input--- +'x ': '[] + +---tokens--- +"'x" Name +' ' Text.Whitespace +"':" Keyword.Type +' ' Text.Whitespace +"'[]" Keyword.Type +'\n' Text.Whitespace diff --git a/tests/snippets/html/multiline-comment-catastrophic-backtracking.txt b/tests/snippets/html/multiline-comment-catastrophic-backtracking.txt new file mode 100644 index 0000000..76f2fb9 --- /dev/null +++ b/tests/snippets/html/multiline-comment-catastrophic-backtracking.txt @@ -0,0 +1,34 @@ +---input--- +<!-- +this +comment +is +never +terminated +... + + + + + + + + + + + + + + + + + + + + + +... + +---tokens--- +'<' Error +'!--\nthis\ncomment\nis\nnever\nterminated\n...\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n...\n' Text diff --git a/tests/snippets/http/test_application_calendar_xml.txt b/tests/snippets/http/test_application_calendar_xml.txt new file mode 100644 index 0000000..beb6386 --- /dev/null +++ b/tests/snippets/http/test_application_calendar_xml.txt @@ -0,0 +1,28 @@ +---input--- +GET / HTTP/1.0 +Content-Type: application/calendar+xml + +<foo> + +---tokens--- +'GET' Name.Function +' ' Text +'/' Name.Namespace +' ' Text +'HTTP' Keyword.Reserved +'/' Operator +'1.0' Literal.Number +'\n' Text + +'Content-Type' Name.Attribute +'' Text +':' Operator +' ' Text +'application/calendar+xml' Literal +'\n' Text + +'\n' Text + +'<foo' Name.Tag +'>' Name.Tag +'\n' Text.Whitespace diff --git a/tests/snippets/http/test_application_xml.txt b/tests/snippets/http/test_application_xml.txt new file mode 100644 index 0000000..97b2943 --- /dev/null +++ b/tests/snippets/http/test_application_xml.txt @@ -0,0 +1,28 @@ +---input--- +GET / HTTP/1.0 +Content-Type: application/xml + +<foo> + +---tokens--- +'GET' Name.Function +' ' Text +'/' Name.Namespace +' ' Text +'HTTP' Keyword.Reserved +'/' Operator +'1.0' Literal.Number +'\n' Text + +'Content-Type' Name.Attribute +'' Text +':' Operator +' ' Text +'application/xml' Literal +'\n' Text + +'\n' Text + +'<foo' Name.Tag +'>' Name.Tag +'\n' Text.Whitespace diff --git a/tests/snippets/http/test_http_status_line.txt b/tests/snippets/http/test_http_status_line.txt new file mode 100644 index 0000000..8f8449d --- /dev/null +++ b/tests/snippets/http/test_http_status_line.txt @@ -0,0 +1,12 @@ +---input--- +HTTP/1.1 200 OK + +---tokens--- +'HTTP' Keyword.Reserved +'/' Operator +'1.1' Literal.Number +' ' Text +'200' Literal.Number +' ' Text +'OK' Name.Exception +'\n' Text diff --git a/tests/snippets/http/test_http_status_line_without_reason_phrase.txt b/tests/snippets/http/test_http_status_line_without_reason_phrase.txt new file mode 100644 index 0000000..91bfa0e --- /dev/null +++ b/tests/snippets/http/test_http_status_line_without_reason_phrase.txt @@ -0,0 +1,10 @@ +---input--- +HTTP/1.1 200 + +---tokens--- +'HTTP' Keyword.Reserved +'/' Operator +'1.1' Literal.Number +' ' Text +'200' Literal.Number +'\n' Text diff --git a/tests/snippets/http/test_http_status_line_without_reason_phrase_rfc_7230.txt b/tests/snippets/http/test_http_status_line_without_reason_phrase_rfc_7230.txt new file mode 100644 index 0000000..e0c9896 --- /dev/null +++ b/tests/snippets/http/test_http_status_line_without_reason_phrase_rfc_7230.txt @@ -0,0 +1,11 @@ +---input--- +HTTP/1.1 200 + +---tokens--- +'HTTP' Keyword.Reserved +'/' Operator +'1.1' Literal.Number +' ' Text +'200' Literal.Number +' ' Text +'\n' Text diff --git a/tests/snippets/idris/test_compiler_directive.txt b/tests/snippets/idris/test_compiler_directive.txt new file mode 100644 index 0000000..68e18cb --- /dev/null +++ b/tests/snippets/idris/test_compiler_directive.txt @@ -0,0 +1,20 @@ +---input--- +%link C "object.o" +%name Vect xs + +---tokens--- +'%link' Keyword.Reserved +' ' Text.Whitespace +'C' Keyword.Type +' ' Text.Whitespace +'"' Literal.String +'object.o' Literal.String +'"' Literal.String +'\n' Text.Whitespace + +'%name' Keyword.Reserved +' ' Text.Whitespace +'Vect' Keyword.Type +' ' Text.Whitespace +'xs' Text +'\n' Text.Whitespace diff --git a/tests/snippets/idris/test_reserved_word.txt b/tests/snippets/idris/test_reserved_word.txt new file mode 100644 index 0000000..636bc16 --- /dev/null +++ b/tests/snippets/idris/test_reserved_word.txt @@ -0,0 +1,29 @@ +---input--- +namespace Foobar + links : String + links = "abc" + +---tokens--- +'namespace' Keyword.Reserved +' ' Text.Whitespace +'Foobar' Keyword.Type +'\n' Text.Whitespace + +' ' Text.Whitespace +'links' Name.Function +' ' Text.Whitespace +':' Operator.Word +' ' Text.Whitespace +'String' Keyword.Type +'\n' Text.Whitespace + +' ' Text.Whitespace +' ' Text.Whitespace +'links' Text +' ' Text.Whitespace +'=' Operator.Word +' ' Text.Whitespace +'"' Literal.String +'abc' Literal.String +'"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/ini/test_indented_entries_1.txt b/tests/snippets/ini/test_indented_entries_1.txt new file mode 100644 index 0000000..a878176 --- /dev/null +++ b/tests/snippets/ini/test_indented_entries_1.txt @@ -0,0 +1,16 @@ +---input--- +[section] + key1=value1 + key2=value2 + +---tokens--- +'[section]' Keyword +'\n ' Text.Whitespace +'key1' Name.Attribute +'=' Operator +'value1' Literal.String +'\n ' Text.Whitespace +'key2' Name.Attribute +'=' Operator +'value2' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/ini/test_indented_entries_2.txt b/tests/snippets/ini/test_indented_entries_2.txt new file mode 100644 index 0000000..bd7c882 --- /dev/null +++ b/tests/snippets/ini/test_indented_entries_2.txt @@ -0,0 +1,20 @@ +---input--- +[section] + key1 = value1 + key2 = value2 + +---tokens--- +'[section]' Keyword +'\n ' Text.Whitespace +'key1' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'value1' Literal.String +'\n ' Text.Whitespace +'key2' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'value2' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/ini/test_indented_entries_3.txt b/tests/snippets/ini/test_indented_entries_3.txt new file mode 100644 index 0000000..4a228af --- /dev/null +++ b/tests/snippets/ini/test_indented_entries_3.txt @@ -0,0 +1,20 @@ +---input--- +[section] + key 1 = value1 + key 2 = value2 + +---tokens--- +'[section]' Keyword +'\n ' Text.Whitespace +'key 1' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'value1' Literal.String +'\n ' Text.Whitespace +'key 2' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'value2' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/j/test_deal_operator.txt b/tests/snippets/j/test_deal_operator.txt new file mode 100644 index 0000000..0156b6d --- /dev/null +++ b/tests/snippets/j/test_deal_operator.txt @@ -0,0 +1,8 @@ +---input--- +3?10 + +---tokens--- +'3' Literal.Number.Integer +'?' Operator +'10' Literal.Number.Integer +'\n' Text.Whitespace diff --git a/tests/snippets/j/test_deal_operator_fixed_seed.txt b/tests/snippets/j/test_deal_operator_fixed_seed.txt new file mode 100644 index 0000000..0a0bd77 --- /dev/null +++ b/tests/snippets/j/test_deal_operator_fixed_seed.txt @@ -0,0 +1,9 @@ +---input--- +3?.10 + +---tokens--- +'3' Literal.Number.Integer +'?' Operator +'.' Operator +'10' Literal.Number.Integer +'\n' Text.Whitespace diff --git a/tests/snippets/java/test_default.txt b/tests/snippets/java/test_default.txt new file mode 100644 index 0000000..f24fa42 --- /dev/null +++ b/tests/snippets/java/test_default.txt @@ -0,0 +1,36 @@ +---input--- +switch (x) { + case 1: break; + default: break; +} + +---tokens--- +'switch' Keyword +' ' Text.Whitespace +'(' Punctuation +'x' Name +')' Punctuation +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'case' Keyword +' ' Text.Whitespace +'1' Literal.Number.Integer +':' Punctuation +' ' Text.Whitespace +'break' Keyword +';' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'default' Keyword +':' Punctuation +' ' Text.Whitespace +'break' Keyword +';' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/java/test_enhanced_for.txt b/tests/snippets/java/test_enhanced_for.txt new file mode 100644 index 0000000..d2a8091 --- /dev/null +++ b/tests/snippets/java/test_enhanced_for.txt @@ -0,0 +1,22 @@ +---input--- +label: +for(String var2: var1) {} + +---tokens--- +'label' Name.Label +':' Punctuation +'\n' Text.Whitespace + +'for' Keyword +'(' Punctuation +'String' Name +' ' Text.Whitespace +'var2' Name +':' Punctuation +' ' Text.Whitespace +'var1' Name +')' Punctuation +' ' Text.Whitespace +'{' Punctuation +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/java/test_multiline_string.txt b/tests/snippets/java/test_multiline_string.txt new file mode 100644 index 0000000..c7325b5 --- /dev/null +++ b/tests/snippets/java/test_multiline_string.txt @@ -0,0 +1,185 @@ +---input--- +public class Quine { + public static void main(String[] args) { + String textBlockQuotes = new String(new char[]{'"', '"', '"'}); + char newLine = 10; + String teststring = "test123\n"; + String source = """ +public class Quine { + public static void main(String[] args) { + String textBlockQuotes = new String(new char[]{'"', '"', '"'}); + char newLine = 10; + String teststringinside = "hello my name is...\n\r"; + String source = %s; + System.out.println(source.formatted(textBlockQuotes + newLine + source + textBlockQuotes)); + } +} +"""; + System.out.println(source.formatted(textBlockQuotes + newLine + source + textBlockQuotes)); + String teststring2 = "Hello\n"; + } +} + +---tokens--- +'public' Keyword.Declaration +' ' Text.Whitespace +'class' Keyword.Declaration +' ' Text +'Quine' Name.Class +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +'\t' Text.Whitespace +'public' Keyword.Declaration +' ' Text.Whitespace +'static' Keyword.Declaration +' ' Text.Whitespace +'void' Keyword.Type +' ' Text.Whitespace +'main' Name.Function +'(' Punctuation +'String' Name +'[' Operator +']' Operator +' ' Text.Whitespace +'args' Name +')' Punctuation +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +'\t\t' Text.Whitespace +'String' Name +' ' Text.Whitespace +'textBlockQuotes' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'new' Keyword +' ' Text.Whitespace +'String' Name +'(' Punctuation +'new' Keyword +' ' Text.Whitespace +'char' Keyword.Type +'[' Operator +']' Operator +'{' Punctuation +'\'"\'' Literal.String.Char +',' Punctuation +' ' Text.Whitespace +'\'"\'' Literal.String.Char +',' Punctuation +' ' Text.Whitespace +'\'"\'' Literal.String.Char +'}' Punctuation +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\t\t' Text.Whitespace +'char' Keyword.Type +' ' Text.Whitespace +'newLine' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'10' Literal.Number.Integer +';' Punctuation +'\n' Text.Whitespace + +'\t\t' Text.Whitespace +'String' Name +' ' Text.Whitespace +'teststring' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"' Literal.String +'test123' Literal.String +'\\' Literal.String +'n' Literal.String +'"' Literal.String +';' Punctuation +'\n' Text.Whitespace + +'\t ' Text.Whitespace +'String' Name +' ' Text.Whitespace +'source' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"""\n' Literal.String + +"public class Quine {\n\tpublic static void main(String[] args) {\n\t\tString textBlockQuotes = new String(new char[]{'" Literal.String +'"' Literal.String +"', '" Literal.String +'"' Literal.String +"', '" Literal.String +'"' Literal.String +"'});\n\t\tchar newLine = 10;\n\t\tString teststringinside = " Literal.String +'"' Literal.String +'hello my name is...' Literal.String +'\\' Literal.String +'n' Literal.String +'\\' Literal.String +'r' Literal.String +'"' Literal.String +';\n\t\tString source = %s;\n\t\tSystem.out.println(source.formatted(textBlockQuotes + newLine + source + textBlockQuotes));\n\t}\n}\n' Literal.String + +'"""' Literal.String +';' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'System' Name +'.' Punctuation +'out' Name.Attribute +'.' Punctuation +'println' Name.Attribute +'(' Punctuation +'source' Name +'.' Punctuation +'formatted' Name.Attribute +'(' Punctuation +'textBlockQuotes' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'newLine' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'source' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'textBlockQuotes' Name +')' Punctuation +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\t' Text.Whitespace +'String' Name +' ' Text.Whitespace +'teststring2' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"' Literal.String +'Hello' Literal.String +'\\' Literal.String +'n' Literal.String +'"' Literal.String +';' Punctuation +'\n' Text.Whitespace + +'\t' Text.Whitespace +'}' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/java/test_multiline_string_only.txt b/tests/snippets/java/test_multiline_string_only.txt new file mode 100644 index 0000000..09d54ad --- /dev/null +++ b/tests/snippets/java/test_multiline_string_only.txt @@ -0,0 +1,46 @@ +---input--- + String source = """ +public class Quine { + public static void main(String[] args) { + String textBlockQuotes = new String(new char[]{'"', '"', '"'}); + char newLine = 10; + String teststringinside = "hello my name is...\n\r"; + String source = %s; + System.out.println(source.formatted(textBlockQuotes + newLine + source + textBlockQuotes)); + } +} +"""; + + +---tokens--- +'\t ' Text.Whitespace +'String' Name +' ' Text.Whitespace +'source' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"""\n' Literal.String + +"public class Quine {\n\tpublic static void main(String[] args) {\n\t\tString textBlockQuotes = new String(new char[]{'" Literal.String +'"' Literal.String +"', '" Literal.String +'"' Literal.String +"', '" Literal.String +'"' Literal.String +"'});\n\t\tchar newLine = 10;\n\t\tString teststringinside = " Literal.String +'"' Literal.String +'hello my name is...' Literal.String +'\\' Literal.String +'n' Literal.String +'\\' Literal.String +'r' Literal.String +'"' Literal.String +';\n\t\tString source = %s;\n\t\tSystem.out.println(source.formatted(textBlockQuotes + newLine + source + textBlockQuotes));\n\t}\n}\n' Literal.String + +'"""' Literal.String +';' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'\n' Text.Whitespace diff --git a/tests/snippets/java/test_numeric_literals.txt b/tests/snippets/java/test_numeric_literals.txt new file mode 100644 index 0000000..1dc933d --- /dev/null +++ b/tests/snippets/java/test_numeric_literals.txt @@ -0,0 +1,34 @@ +---input--- +0 5L 9__542_72l 0xbEEf 0X9_A 0_35 01 0b0___101_0 0. .7_17F 3e-1_3d 1f 6_01.9e+3 0x.1Fp3 0XEP8D + +---tokens--- +'0' Literal.Number.Integer +' ' Text.Whitespace +'5L' Literal.Number.Integer +' ' Text.Whitespace +'9__542_72l' Literal.Number.Integer +' ' Text.Whitespace +'0xbEEf' Literal.Number.Hex +' ' Text.Whitespace +'0X9_A' Literal.Number.Hex +' ' Text.Whitespace +'0_35' Literal.Number.Oct +' ' Text.Whitespace +'01' Literal.Number.Oct +' ' Text.Whitespace +'0b0___101_0' Literal.Number.Bin +' ' Text.Whitespace +'0.' Literal.Number.Float +' ' Text.Whitespace +'.7_17F' Literal.Number.Float +' ' Text.Whitespace +'3e-1_3d' Literal.Number.Float +' ' Text.Whitespace +'1f' Literal.Number.Float +' ' Text.Whitespace +'6_01.9e+3' Literal.Number.Float +' ' Text.Whitespace +'0x.1Fp3' Literal.Number.Float +' ' Text.Whitespace +'0XEP8D' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/java/test_record.txt b/tests/snippets/java/test_record.txt new file mode 100644 index 0000000..f4ca08b --- /dev/null +++ b/tests/snippets/java/test_record.txt @@ -0,0 +1,67 @@ +---input--- +public record RecordTest() {} +public static record RecordTest() {} +record Person(String firstName, String lastName) {} +String[] record = csvReader.getValues(); + + +---tokens--- +'public' Keyword.Declaration +' ' Text.Whitespace +'record' Keyword.Declaration +' ' Text +'RecordTest' Name.Class +'(' Punctuation +')' Punctuation +' ' Text.Whitespace +'{' Punctuation +'}' Punctuation +'\n' Text.Whitespace + +'public' Keyword.Declaration +' ' Text.Whitespace +'static' Keyword.Declaration +' ' Text.Whitespace +'record' Keyword.Declaration +' ' Text +'RecordTest' Name.Class +'(' Punctuation +')' Punctuation +' ' Text.Whitespace +'{' Punctuation +'}' Punctuation +'\n' Text.Whitespace + +'record' Keyword.Declaration +' ' Text +'Person' Name.Class +'(' Punctuation +'String' Name +' ' Text.Whitespace +'firstName' Name +',' Punctuation +' ' Text.Whitespace +'String' Name +' ' Text.Whitespace +'lastName' Name +')' Punctuation +' ' Text.Whitespace +'{' Punctuation +'}' Punctuation +'\n' Text.Whitespace + +'String' Name +'[' Operator +']' Operator +' ' Text.Whitespace +'record' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'csvReader' Name +'.' Punctuation +'getValues' Name.Attribute +'(' Punctuation +')' Punctuation +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/js/super.txt b/tests/snippets/js/super.txt new file mode 100644 index 0000000..1af2ad2 --- /dev/null +++ b/tests/snippets/js/super.txt @@ -0,0 +1,72 @@ +---input--- +super(member1, member2) + +super(member1,member2) + +super(member1, +member2) + +super (member1, member2) + +super (member1,member2) + +super (member1, +member2) + +---tokens--- +'super' Keyword +'(' Punctuation +'member1' Name.Other +',' Punctuation +' ' Text.Whitespace +'member2' Name.Other +')' Punctuation +'\n\n' Text.Whitespace + +'super' Keyword +'(' Punctuation +'member1' Name.Other +',' Punctuation +'member2' Name.Other +')' Punctuation +'\n\n' Text.Whitespace + +'super' Keyword +'(' Punctuation +'member1' Name.Other +',' Punctuation +'\n' Text.Whitespace + +'member2' Name.Other +')' Punctuation +'\n\n' Text.Whitespace + +'super' Keyword +' ' Text.Whitespace +'(' Punctuation +'member1' Name.Other +',' Punctuation +' ' Text.Whitespace +'member2' Name.Other +')' Punctuation +'\n\n' Text.Whitespace + +'super' Keyword +' ' Text.Whitespace +'(' Punctuation +'member1' Name.Other +',' Punctuation +'member2' Name.Other +')' Punctuation +'\n\n' Text.Whitespace + +'super' Keyword +' ' Text.Whitespace +'(' Punctuation +'member1' Name.Other +',' Punctuation +'\n' Text.Whitespace + +'member2' Name.Other +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/jslt/test_sample.txt b/tests/snippets/jslt/test_sample.txt new file mode 100644 index 0000000..73ad3fd --- /dev/null +++ b/tests/snippets/jslt/test_sample.txt @@ -0,0 +1,83 @@ +---input--- +import "transforms/yellow.jslt" as yellow + +// Known valid types +let valid-types = [ "SomeType" ] + +def foobar(arg) $arg.foobar + +{ + "foobar": foobar(.), + "is-valid": contains(.type, $valid-types), + *: . +} + +---tokens--- +'import' Keyword.Namespace +' ' Text.Whitespace +'"transforms/yellow.jslt"' Literal.String.Symbol +' ' Text.Whitespace +'as' Keyword.Namespace +' ' Text.Whitespace +'yellow' Name.Namespace +'\n\n' Text.Whitespace + +'// Known valid types\n' Comment.Single + +'let' Keyword.Declaration +' ' Text.Whitespace +'valid-types' Name.Variable +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'[' Punctuation +' ' Text.Whitespace +'"SomeType"' Literal.String.Double +' ' Text.Whitespace +']' Punctuation +'\n\n' Text.Whitespace + +'def' Keyword.Declaration +' ' Text.Whitespace +'foobar' Name.Function +'(' Punctuation +'arg' Name.Variable +')' Punctuation +' ' Text.Whitespace +'$arg' Name.Variable +'.' Operator +'foobar' Name +'\n\n' Text.Whitespace + +'{' Punctuation +'\n ' Text.Whitespace +'"foobar"' Literal.String.Double +':' Punctuation +' ' Text.Whitespace +'foobar' Name +'(' Punctuation +'.' Operator +')' Punctuation +',' Punctuation +'\n ' Text.Whitespace +'"is-valid"' Literal.String.Double +':' Punctuation +' ' Text.Whitespace +'contains' Name.Builtin +'(' Punctuation +'.' Operator +'type' Name +',' Punctuation +' ' Text.Whitespace +'$valid-types' Name.Variable +')' Punctuation +',' Punctuation +'\n ' Text.Whitespace +'*' Operator +':' Punctuation +' ' Text.Whitespace +'.' Operator +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/json/test_basic.txt b/tests/snippets/json/test_basic.txt new file mode 100644 index 0000000..f93b91b --- /dev/null +++ b/tests/snippets/json/test_basic.txt @@ -0,0 +1,30 @@ +---input--- +{"foo": "bar", "foo2": [1, 2, 3], "\u0123": "\u0123"} + +---tokens--- +'{' Punctuation +'"foo"' Name.Tag +':' Punctuation +' ' Text.Whitespace +'"bar"' Literal.String.Double +',' Punctuation +' ' Text.Whitespace +'"foo2"' Name.Tag +':' Punctuation +' ' Text.Whitespace +'[' Punctuation +'1' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'2' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'3' Literal.Number.Integer +'],' Punctuation +' ' Text.Whitespace +'"\\u0123"' Name.Tag +':' Punctuation +' ' Text.Whitespace +'"\\u0123"' Literal.String.Double +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/json/test_basic_bare.txt b/tests/snippets/json/test_basic_bare.txt new file mode 100644 index 0000000..785d264 --- /dev/null +++ b/tests/snippets/json/test_basic_bare.txt @@ -0,0 +1,23 @@ +---input--- +"foo": "bar", "foo2": [1, 2, 3] + +---tokens--- +'"foo"' Name.Tag +':' Punctuation +' ' Text.Whitespace +'"bar"' Literal.String.Double +',' Punctuation +' ' Text.Whitespace +'"foo2"' Name.Tag +':' Punctuation +' ' Text.Whitespace +'[' Punctuation +'1' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'2' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'3' Literal.Number.Integer +']' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/julia-repl/test_repl.txt b/tests/snippets/julia-repl/test_repl.txt new file mode 100644 index 0000000..183de17 --- /dev/null +++ b/tests/snippets/julia-repl/test_repl.txt @@ -0,0 +1,51 @@ +Tests separating Julia's commands from output in REPL-like code blocks + +---input--- +julia> f(x) = sin(π/2x) +f (generic function with 1 method) + +julia> @. f(1:2) +2-element Vector{Float64}: + 1.0 + 0.7071067811865475 + +---tokens--- +'julia>' Generic.Prompt +' ' Text.Whitespace +'f' Name +'(' Punctuation +'x' Name +')' Punctuation +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'sin' Name +'(' Punctuation +'π' Name.Builtin +'/' Operator +'2' Literal.Number.Integer +'x' Name +')' Punctuation +'\n' Text.Whitespace + +'f (generic function with 1 method)\n' Generic.Output + +'\n' Generic.Output + +'julia>' Generic.Prompt +' ' Text.Whitespace +'@.' Name.Decorator +' ' Text.Whitespace +'f' Name +'(' Punctuation +'1' Literal.Number.Integer +':' Operator +'2' Literal.Number.Integer +')' Punctuation +'\n' Text.Whitespace + +'2-element Vector{Float64}:\n' Generic.Output + +' 1.0\n' Generic.Output + +' 0.7071067811865475\n' Generic.Output diff --git a/tests/snippets/julia/test_keywords.txt b/tests/snippets/julia/test_keywords.txt new file mode 100644 index 0000000..10166d6 --- /dev/null +++ b/tests/snippets/julia/test_keywords.txt @@ -0,0 +1,101 @@ +# Test keywords are identified + +---input--- +mutable struct MutableType end +struct ImmutableType end +abstract type AbstractMyType end +primitive type MyPrimitive 32 end +(abstract, mutable, type) = true, π, missing + +abstract type AbstractMyType end +primitive type MyPrimitive 32 end +mutable struct MutableType end + +---tokens--- +'mutable' Keyword +' ' Text.Whitespace +'struct' Keyword +' ' Text +'MutableType' Keyword.Type +' ' Text.Whitespace +'end' Keyword +'\n' Text.Whitespace + +'struct' Keyword +' ' Text +'ImmutableType' Keyword.Type +' ' Text.Whitespace +'end' Keyword +'\n' Text.Whitespace + +'abstract' Keyword +' ' Text.Whitespace +'type' Keyword +' ' Text +'AbstractMyType' Keyword.Type +' ' Text.Whitespace +'end' Keyword +'\n' Text.Whitespace + +'primitive' Keyword +' ' Text.Whitespace +'type' Keyword +' ' Text +'MyPrimitive' Keyword.Type +' ' Text.Whitespace +'32' Literal.Number.Integer +' ' Text.Whitespace +'end' Keyword +'\n' Text.Whitespace + +'(' Punctuation +'abstract' Name +',' Punctuation +' ' Text.Whitespace +'mutable' Name +',' Punctuation +' ' Text.Whitespace +'type' Name +')' Punctuation +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'true' Name.Builtin +',' Punctuation +' ' Text.Whitespace +'π' Name.Builtin +',' Punctuation +' ' Text.Whitespace +'missing' Name.Builtin +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'abstract' Keyword +' ' Text.Whitespace +'type' Keyword +' ' Text +'AbstractMyType' Keyword.Type +' ' Text.Whitespace +'end' Keyword +'\n' Text.Whitespace + +'primitive' Keyword +' \t' Text.Whitespace +'type' Keyword +' ' Text +'MyPrimitive' Keyword.Type +' ' Text.Whitespace +'32' Literal.Number.Integer +' ' Text.Whitespace +'end' Keyword +'\n' Text.Whitespace + +'mutable' Keyword +' ' Text.Whitespace +'struct' Keyword +' ' Text +'MutableType' Keyword.Type +' ' Text.Whitespace +'end' Keyword +'\n' Text.Whitespace diff --git a/tests/snippets/julia/test_macros.txt b/tests/snippets/julia/test_macros.txt new file mode 100644 index 0000000..43d67e0 --- /dev/null +++ b/tests/snippets/julia/test_macros.txt @@ -0,0 +1,56 @@ +# Test that macros are parsed, including ones which are defined as symbols + +---input--- +@generated function +@. a + b +@~ a + b +@± a + b +@mymacro(a, b) +@+¹ᵀ a + +---tokens--- +'@generated' Name.Decorator +' ' Text.Whitespace +'function' Keyword +'\n' Text.Whitespace + +'@.' Name.Decorator +' ' Text.Whitespace +'a' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'b' Name +'\n' Text.Whitespace + +'@~' Name.Decorator +' ' Text.Whitespace +'a' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'b' Name +'\n' Text.Whitespace + +'@±' Name.Decorator +' ' Text.Whitespace +'a' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'b' Name +'\n' Text.Whitespace + +'@mymacro' Name.Decorator +'(' Punctuation +'a' Name +',' Punctuation +' ' Text.Whitespace +'b' Name +')' Punctuation +'\n' Text.Whitespace + +'@+¹ᵀ' Name.Decorator +' ' Text.Whitespace +'a' Name +'\n' Text.Whitespace diff --git a/tests/snippets/julia/test_names.txt b/tests/snippets/julia/test_names.txt new file mode 100644 index 0000000..62c0b55 --- /dev/null +++ b/tests/snippets/julia/test_names.txt @@ -0,0 +1,148 @@ +# Test that the range of Julia variable names are correctly identified + +---input--- +a # single character variable +a_simple_name +_leading_underscore +5implicit_mul +6_more_mul +nums1 +nums_2 +nameswith! +multiple!! +embedded!_inthemiddle +embed!1 +prime_suffix′ +for_each # starts with keyword substring + +# variables with characters > \u00A1 +ð # category Ll +Aʺ # category Lm -- \U02BA (MODIFIER LETTER DOUBLE PRIME), not \U2033 (DOUBLE PRIME) +א # category Lo +Ð # category Lu +A̅ # category Mn -- \U0305 (COMBINING OVERLINE) +ⅿ # category Nl -- \U217F (SMALL ROMAN NUMERAL ONE THOUSAND) +A₁ # category No +A² # category No +€ # category Sc +© # category So + +# number-like names +𝟙 # category Nd +𝟏 # category Nd + +---tokens--- +'a' Name +' ' Text.Whitespace +'# single character variable' Comment +'\n' Text.Whitespace + +'a_simple_name' Name +'\n' Text.Whitespace + +'_leading_underscore' Name +'\n' Text.Whitespace + +'5' Literal.Number.Integer +'implicit_mul' Name +'\n' Text.Whitespace + +'6' Literal.Number.Integer +'_more_mul' Name +'\n' Text.Whitespace + +'nums1' Name +'\n' Text.Whitespace + +'nums_2' Name +'\n' Text.Whitespace + +'nameswith!' Name +'\n' Text.Whitespace + +'multiple!!' Name +'\n' Text.Whitespace + +'embedded!_inthemiddle' Name +'\n' Text.Whitespace + +'embed!1' Name +'\n' Text.Whitespace + +'prime_suffix′' Name +'\n' Text.Whitespace + +'for_each' Name +' ' Text.Whitespace +'# starts with keyword substring' Comment +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'# variables with characters > \\u00A1' Comment +'\n' Text.Whitespace + +'ð' Name +' ' Text.Whitespace +'# category Ll' Comment +'\n' Text.Whitespace + +'Aʺ' Name +' ' Text.Whitespace +'# category Lm -- \\U02BA (MODIFIER LETTER DOUBLE PRIME), not \\U2033 (DOUBLE PRIME)' Comment +'\n' Text.Whitespace + +'א' Name +' ' Text.Whitespace +'# category Lo' Comment +'\n' Text.Whitespace + +'Ð' Name +' ' Text.Whitespace +'# category Lu' Comment +'\n' Text.Whitespace + +'A̅' Name +' ' Text.Whitespace +'# category Mn -- \\U0305 (COMBINING OVERLINE)' Comment +'\n' Text.Whitespace + +'ⅿ' Name +' ' Text.Whitespace +'# category Nl -- \\U217F (SMALL ROMAN NUMERAL ONE THOUSAND)' Comment +'\n' Text.Whitespace + +'A₁' Name +' ' Text.Whitespace +'# category No' Comment +'\n' Text.Whitespace + +'A²' Name +' ' Text.Whitespace +'# category No' Comment +'\n' Text.Whitespace + +'€' Name +' ' Text.Whitespace +'# category Sc' Comment +'\n' Text.Whitespace + +'©' Name +' ' Text.Whitespace +'# category So' Comment +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'# number-like names' Comment +'\n' Text.Whitespace + +'𝟙' Name +' ' Text.Whitespace +'# category Nd' Comment +'\n' Text.Whitespace + +'𝟏' Name +' ' Text.Whitespace +'# category Nd' Comment +'\n' Text.Whitespace diff --git a/tests/snippets/julia/test_numbers.txt b/tests/snippets/julia/test_numbers.txt new file mode 100644 index 0000000..66f1fd0 --- /dev/null +++ b/tests/snippets/julia/test_numbers.txt @@ -0,0 +1,261 @@ +# Tests identification of number forms + +---input--- +# floats + 1e1 1e+1 1e-1 +1.1e1 1.1e+1 1.1e-1 .1e1 .1_1e1 1_1.1e1 1.1_1e1 1.1_11e1 +1.1E1 1.1E+1 1.1E-1 .1E1 .1_1E1 1_1.1E1 1.1_1E1 1.1_11E1 +1.1f1 1.1f+1 1.1f-1 .1f1 .1_1f1 1_1.1f1 1.1_1f1 1.1_11f1 +1E1 1E+1 1E-1 +1f1 1f+1 1f-1 +.1 1. 1.1 1.1_1 1.1_11 .1_1 .1_11 1_1.1_1 +# hex floats +0x1p1 0xa_bp10 0x01_ap11 0x01_abp1 +0x1.1p1 0xA.Bp10 0x0.1_Ap9 0x0_1.Ap1 0x0_1.A_Bp9 + +# integers +1 01 10_1 10_11 + +# non-decimal +0xf 0xf_0 0xfff_000 +0o7 0o7_0 0o777_000 +0b1 0b1_0 0b111_000 + +# invalid in Julia - out of range values +0xg 0o8 0b2 0x1pA +# invalid in Julia - no trailing underscores +1_ 1.1_ 0xf_ 0o7_ 0b1_ 0xF_p1 +# parsed as juxtaposed numeral + variable in Julia (no underscores in exponents) +1e1_1 1E1_1 1f1_1 0xfp1_1 + +# not floats -- range-like expression parts +1..1 ..1 1.. + +---tokens--- +'# floats' Comment +'\n' Text.Whitespace + +' ' Text.Whitespace +'1e1' Literal.Number.Float +' ' Text.Whitespace +'1e+1' Literal.Number.Float +' ' Text.Whitespace +'1e-1' Literal.Number.Float +'\n' Text.Whitespace + +'1.1e1' Literal.Number.Float +' ' Text.Whitespace +'1.1e+1' Literal.Number.Float +' ' Text.Whitespace +'1.1e-1' Literal.Number.Float +' ' Text.Whitespace +'.1e1' Literal.Number.Float +' ' Text.Whitespace +'.1_1e1' Literal.Number.Float +' ' Text.Whitespace +'1_1.1e1' Literal.Number.Float +' ' Text.Whitespace +'1.1_1e1' Literal.Number.Float +' ' Text.Whitespace +'1.1_11e1' Literal.Number.Float +'\n' Text.Whitespace + +'1.1E1' Literal.Number.Float +' ' Text.Whitespace +'1.1E+1' Literal.Number.Float +' ' Text.Whitespace +'1.1E-1' Literal.Number.Float +' ' Text.Whitespace +'.1E1' Literal.Number.Float +' ' Text.Whitespace +'.1_1E1' Literal.Number.Float +' ' Text.Whitespace +'1_1.1E1' Literal.Number.Float +' ' Text.Whitespace +'1.1_1E1' Literal.Number.Float +' ' Text.Whitespace +'1.1_11E1' Literal.Number.Float +'\n' Text.Whitespace + +'1.1f1' Literal.Number.Float +' ' Text.Whitespace +'1.1f+1' Literal.Number.Float +' ' Text.Whitespace +'1.1f-1' Literal.Number.Float +' ' Text.Whitespace +'.1f1' Literal.Number.Float +' ' Text.Whitespace +'.1_1f1' Literal.Number.Float +' ' Text.Whitespace +'1_1.1f1' Literal.Number.Float +' ' Text.Whitespace +'1.1_1f1' Literal.Number.Float +' ' Text.Whitespace +'1.1_11f1' Literal.Number.Float +'\n' Text.Whitespace + +'1E1' Literal.Number.Float +' ' Text.Whitespace +'1E+1' Literal.Number.Float +' ' Text.Whitespace +'1E-1' Literal.Number.Float +'\n' Text.Whitespace + +'1f1' Literal.Number.Float +' ' Text.Whitespace +'1f+1' Literal.Number.Float +' ' Text.Whitespace +'1f-1' Literal.Number.Float +'\n' Text.Whitespace + +'.1' Literal.Number.Float +' ' Text.Whitespace +'1.' Literal.Number.Float +' ' Text.Whitespace +'1.1' Literal.Number.Float +' ' Text.Whitespace +'1.1_1' Literal.Number.Float +' ' Text.Whitespace +'1.1_11' Literal.Number.Float +' ' Text.Whitespace +'.1_1' Literal.Number.Float +' ' Text.Whitespace +'.1_11' Literal.Number.Float +' ' Text.Whitespace +'1_1.1_1' Literal.Number.Float +'\n' Text.Whitespace + +'# hex floats' Comment +'\n' Text.Whitespace + +'0x1p1' Literal.Number.Float +' ' Text.Whitespace +'0xa_bp10' Literal.Number.Float +' ' Text.Whitespace +'0x01_ap11' Literal.Number.Float +' ' Text.Whitespace +'0x01_abp1' Literal.Number.Float +'\n' Text.Whitespace + +'0x1.1p1' Literal.Number.Float +' ' Text.Whitespace +'0xA.Bp10' Literal.Number.Float +' ' Text.Whitespace +'0x0.1_Ap9' Literal.Number.Float +' ' Text.Whitespace +'0x0_1.Ap1' Literal.Number.Float +' ' Text.Whitespace +'0x0_1.A_Bp9' Literal.Number.Float +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'# integers' Comment +'\n' Text.Whitespace + +'1' Literal.Number.Integer +' ' Text.Whitespace +'01' Literal.Number.Integer +' ' Text.Whitespace +'10_1' Literal.Number.Integer +' ' Text.Whitespace +'10_11' Literal.Number.Integer +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'# non-decimal' Comment +'\n' Text.Whitespace + +'0xf' Literal.Number.Hex +' ' Text.Whitespace +'0xf_0' Literal.Number.Hex +' ' Text.Whitespace +'0xfff_000' Literal.Number.Hex +'\n' Text.Whitespace + +'0o7' Literal.Number.Oct +' ' Text.Whitespace +'0o7_0' Literal.Number.Oct +' ' Text.Whitespace +'0o777_000' Literal.Number.Oct +'\n' Text.Whitespace + +'0b1' Literal.Number.Bin +' ' Text.Whitespace +'0b1_0' Literal.Number.Bin +' ' Text.Whitespace +'0b111_000' Literal.Number.Bin +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'# invalid in Julia - out of range values' Comment +'\n' Text.Whitespace + +'0' Literal.Number.Integer +'xg' Name +' ' Text.Whitespace +'0' Literal.Number.Integer +'o8' Name +' ' Text.Whitespace +'0' Literal.Number.Integer +'b2' Name +' ' Text.Whitespace +'0x1' Literal.Number.Hex +'pA' Name +'\n' Text.Whitespace + +'# invalid in Julia - no trailing underscores' Comment +'\n' Text.Whitespace + +'1' Literal.Number.Integer +'_' Name +' ' Text.Whitespace +'1.1' Literal.Number.Float +'_' Name +' ' Text.Whitespace +'0xf' Literal.Number.Hex +'_' Name +' ' Text.Whitespace +'0o7' Literal.Number.Oct +'_' Name +' ' Text.Whitespace +'0b1' Literal.Number.Bin +'_' Name +' ' Text.Whitespace +'0xF' Literal.Number.Hex +'_p1' Name +'\n' Text.Whitespace + +'# parsed as juxtaposed numeral + variable in Julia (no underscores in exponents)' Comment +'\n' Text.Whitespace + +'1e1' Literal.Number.Float +'_1' Name +' ' Text.Whitespace +'1E1' Literal.Number.Float +'_1' Name +' ' Text.Whitespace +'1f1' Literal.Number.Float +'_1' Name +' ' Text.Whitespace +'0xfp1' Literal.Number.Float +'_1' Name +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'# not floats -- range-like expression parts' Comment +'\n' Text.Whitespace + +'1' Literal.Number.Integer +'..' Operator +'1' Literal.Number.Integer +' ' Text.Whitespace +'..' Operator +'1' Literal.Number.Integer +' ' Text.Whitespace +'1' Literal.Number.Integer +'..' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/julia/test_operators.txt b/tests/snippets/julia/test_operators.txt new file mode 100644 index 0000000..c3c0f9f --- /dev/null +++ b/tests/snippets/julia/test_operators.txt @@ -0,0 +1,172 @@ +# Test that operators --- dotted and unicode --- are identified correctly. + +---input--- +a += b.c +a .÷= .~b.c +a = !b ⋆ c! +a = b ? c : d ⊕ e +a = √(5) +a -> (a...) .+ 1 +a \ b +1..2 +a = a === b +a <: T +a >: T +a::T +[adjoint]' +(identity)'' +adjoint''' +transpose'ᵀ +suffixed +¹ operator +suffixed +¹²³ operator + +---tokens--- +'a' Name +' ' Text.Whitespace +'+=' Operator +' ' Text.Whitespace +'b' Name +'.' Operator +'c' Name +'\n' Text.Whitespace + +'a' Name +' ' Text.Whitespace +'.÷=' Operator +' ' Text.Whitespace +'.~' Operator +'b' Name +'.' Operator +'c' Name +'\n' Text.Whitespace + +'a' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'!' Operator +'b' Name +' ' Text.Whitespace +'⋆' Operator +' ' Text.Whitespace +'c!' Name +'\n' Text.Whitespace + +'a' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'b' Name +' ' Text.Whitespace +'?' Operator +' ' Text.Whitespace +'c' Name +' ' Text.Whitespace +':' Operator +' ' Text.Whitespace +'d' Name +' ' Text.Whitespace +'⊕' Operator +' ' Text.Whitespace +'e' Name +'\n' Text.Whitespace + +'a' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'√' Operator +'(' Punctuation +'5' Literal.Number.Integer +')' Punctuation +'\n' Text.Whitespace + +'a' Name +' ' Text.Whitespace +'->' Operator +' ' Text.Whitespace +'(' Punctuation +'a' Name +'...' Operator +')' Punctuation +' ' Text.Whitespace +'.+' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +'\n' Text.Whitespace + +'a' Name +' ' Text.Whitespace +'\\' Operator +' ' Text.Whitespace +'b' Name +'\n' Text.Whitespace + +'1' Literal.Number.Integer +'..' Operator +'2' Literal.Number.Integer +'\n' Text.Whitespace + +'a' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'a' Name +' ' Text.Whitespace +'===' Operator +' ' Text.Whitespace +'b' Name +'\n' Text.Whitespace + +'a' Keyword.Type +' ' Text.Whitespace +'<:' Operator +' ' Text.Whitespace +'T' Keyword.Type +'\n' Text.Whitespace + +'a' Keyword.Type +' ' Text.Whitespace +'>:' Operator +' ' Text.Whitespace +'T' Keyword.Type +'\n' Text.Whitespace + +'a' Name +'::' Operator +'T' Keyword.Type +'\n' Text.Whitespace + +'[' Punctuation +'adjoint' Name +']' Punctuation +"'" Operator +'\n' Text.Whitespace + +'(' Punctuation +'identity' Name +')' Punctuation +"''" Operator +'\n' Text.Whitespace + +'adjoint' Name +"'''" Operator +'\n' Text.Whitespace + +'transpose' Name +"'ᵀ" Operator +'\n' Text.Whitespace + +'suffixed' Name +' ' Text.Whitespace +'+¹' Operator +' ' Text.Whitespace +'operator' Name +'\n' Text.Whitespace + +'suffixed' Name +' ' Text.Whitespace +'+¹²³' Operator +' ' Text.Whitespace +'operator' Name +'\n' Text.Whitespace diff --git a/tests/snippets/julia/test_strings.txt b/tests/snippets/julia/test_strings.txt new file mode 100644 index 0000000..d5f91bf --- /dev/null +++ b/tests/snippets/julia/test_strings.txt @@ -0,0 +1,225 @@ +# Tests string forms + +---input--- +"global function" +"An $interpolated variable" +"An $(a + 1) expression" +"""a""" +""" +global function +de e f +"inner string" +""" +raw"\\ a \" $interp $(1 + 1) \"" +raw""" +"inner string" +$interp +$(1 + 1) +""" +# commented "string" + +@sprintf "%0.2f" var +v"1.0" +var"#nonstandard#" + +r"^[abs]+$"m +arbi"trary"suff +arbi"trary"1234 + +`global function` +`abc \` \$ $interpolated` +`abc $(a + 1)` +```a``` +``` +global function +"thing" ` \$ +`now` $(now()) +``` +# commented `command` + +arbi`trary`suff +arbi`trary`1234 + +---tokens--- +'"' Literal.String +'global function' Literal.String +'"' Literal.String +'\n' Text.Whitespace + +'"' Literal.String +'An ' Literal.String +'$interpolated' Literal.String.Interpol +' variable' Literal.String +'"' Literal.String +'\n' Text.Whitespace + +'"' Literal.String +'An ' Literal.String +'$' Literal.String.Interpol +'(' Punctuation +'a' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +')' Punctuation +' expression' Literal.String +'"' Literal.String +'\n' Text.Whitespace + +'"""' Literal.String +'a' Literal.String +'"""' Literal.String +'\n' Text.Whitespace + +'"""' Literal.String +'\nglobal function\nde e f\n' Literal.String + +'"' Literal.String +'inner string' Literal.String +'"' Literal.String +'\n' Literal.String + +'"""' Literal.String +'\n' Text.Whitespace + +'raw' Literal.String.Affix +'"' Literal.String +'\\\\ a ' Literal.String +'\\"' Literal.String.Escape +' $interp $(1 + 1) ' Literal.String +'\\"' Literal.String.Escape +'"' Literal.String +'\n' Text.Whitespace + +'raw' Literal.String.Affix +'"""' Literal.String +'\n"inner string"\n$interp\n$(1 + 1)\n' Literal.String + +'"""' Literal.String +'\n' Text.Whitespace + +'# commented "string"' Comment +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'@sprintf' Name.Decorator +' ' Text.Whitespace +'"' Literal.String +'%0.2f' Literal.String.Interpol +'"' Literal.String +' ' Text.Whitespace +'var' Name +'\n' Text.Whitespace + +'v' Literal.String.Affix +'"' Literal.String +'1.0' Literal.String +'"' Literal.String +'\n' Text.Whitespace + +'var' Literal.String.Affix +'"' Literal.String +'#nonstandard#' Literal.String +'"' Literal.String +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'r' Literal.String.Affix +'"' Literal.String.Regex +'^[abs]+$' Literal.String.Regex +'"' Literal.String.Regex +'m' Literal.String.Affix +'\n' Text.Whitespace + +'arbi' Literal.String.Affix +'"' Literal.String +'trary' Literal.String +'"' Literal.String +'suff' Literal.String.Affix +'\n' Text.Whitespace + +'arbi' Literal.String.Affix +'"' Literal.String +'trary' Literal.String +'"' Literal.String +'1234' Literal.String.Affix +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'`' Literal.String.Backtick +'global function' Literal.String.Backtick +'`' Literal.String.Backtick +'\n' Text.Whitespace + +'`' Literal.String.Backtick +'abc ' Literal.String.Backtick +'\\`' Literal.String.Escape +' ' Literal.String.Backtick +'\\$' Literal.String.Escape +' ' Literal.String.Backtick +'$interpolated' Literal.String.Interpol +'`' Literal.String.Backtick +'\n' Text.Whitespace + +'`' Literal.String.Backtick +'abc ' Literal.String.Backtick +'$' Literal.String.Interpol +'(' Punctuation +'a' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +')' Punctuation +'`' Literal.String.Backtick +'\n' Text.Whitespace + +'```' Literal.String.Backtick +'a' Literal.String.Backtick +'```' Literal.String.Backtick +'\n' Text.Whitespace + +'```' Literal.String.Backtick +'\nglobal function\n"thing" ' Literal.String.Backtick +'`' Literal.String.Backtick +' ' Literal.String.Backtick +'\\$' Literal.String.Escape +'\n' Literal.String.Backtick + +'`' Literal.String.Backtick +'now' Literal.String.Backtick +'`' Literal.String.Backtick +' ' Literal.String.Backtick +'$' Literal.String.Interpol +'(' Punctuation +'now' Name +'(' Punctuation +')' Punctuation +')' Punctuation +'\n' Literal.String.Backtick + +'```' Literal.String.Backtick +'\n' Text.Whitespace + +'# commented `command`' Comment +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'arbi' Literal.String.Affix +'`' Literal.String.Backtick +'trary' Literal.String.Backtick +'`' Literal.String.Backtick +'suff' Literal.String.Affix +'\n' Text.Whitespace + +'arbi' Literal.String.Affix +'`' Literal.String.Backtick +'trary' Literal.String.Backtick +'`' Literal.String.Backtick +'1234' Literal.String.Affix +'\n' Text.Whitespace diff --git a/tests/snippets/julia/test_symbols.txt b/tests/snippets/julia/test_symbols.txt new file mode 100644 index 0000000..37b4f83 --- /dev/null +++ b/tests/snippets/julia/test_symbols.txt @@ -0,0 +1,78 @@ +# Tests that symbols are parsed as special literals + +---input--- +:abc_123 +:abc_def +:α +Val{:mysymbol} + +# non-symbols +a:b +1:b +1.:b +a::T +a<:T +a>:T +UInt(1):UInt(2) + +---tokens--- +':abc_123' Literal.String.Symbol +'\n' Text.Whitespace + +':abc_def' Literal.String.Symbol +'\n' Text.Whitespace + +':α' Literal.String.Symbol +'\n' Text.Whitespace + +'Val' Keyword.Type +'{' Punctuation +':mysymbol' Literal.String.Symbol +'}' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'# non-symbols' Comment +'\n' Text.Whitespace + +'a' Name +':' Operator +'b' Name +'\n' Text.Whitespace + +'1' Literal.Number.Integer +':' Operator +'b' Name +'\n' Text.Whitespace + +'1.' Literal.Number.Float +':' Operator +'b' Name +'\n' Text.Whitespace + +'a' Name +'::' Operator +'T' Keyword.Type +'\n' Text.Whitespace + +'a' Keyword.Type +'<:' Operator +'T' Keyword.Type +'\n' Text.Whitespace + +'a' Keyword.Type +'>:' Operator +'T' Keyword.Type +'\n' Text.Whitespace + +'UInt' Keyword.Type +'(' Punctuation +'1' Literal.Number.Integer +')' Punctuation +':' Operator +'UInt' Keyword.Type +'(' Punctuation +'2' Literal.Number.Integer +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/julia/test_types.txt b/tests/snippets/julia/test_types.txt new file mode 100644 index 0000000..16267fd --- /dev/null +++ b/tests/snippets/julia/test_types.txt @@ -0,0 +1,196 @@ +# Tests identifying names which must be types from context + +---input--- +Union{} +MyType{Nothing, Any} +f(::Union{T,S}) where S where T = 1 +f(::T) where {T} = 1 +f(::Type{<:T}) = 1 +f(::AT) where AT <: AbstractArray{MyType,1} = 1 +f(::Val{:named}) = 1 +f(::typeof(sin)) = 1 +MyInt <: Integer +Number >: MyInt +AT{T,1} <: B +B>:AT{T,1} +A <: f(B) +g(C) <: T + +---tokens--- +'Union' Keyword.Type +'{' Punctuation +'}' Punctuation +'\n' Text.Whitespace + +'MyType' Keyword.Type +'{' Punctuation +'Nothing' Keyword.Type +',' Punctuation +' ' Text.Whitespace +'Any' Keyword.Type +'}' Punctuation +'\n' Text.Whitespace + +'f' Name +'(' Punctuation +'::' Operator +'Union' Keyword.Type +'{' Punctuation +'T' Keyword.Type +',' Punctuation +'S' Keyword.Type +'}' Punctuation +')' Punctuation +' ' Text.Whitespace +'where' Keyword +' ' Text.Whitespace +'S' Keyword.Type +' ' Text.Whitespace +'where' Keyword +' ' Text.Whitespace +'T' Keyword.Type +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +'\n' Text.Whitespace + +'f' Name +'(' Punctuation +'::' Operator +'T' Keyword.Type +')' Punctuation +' ' Text.Whitespace +'where' Keyword +' ' Text.Whitespace +'{' Punctuation +'T' Keyword.Type +'}' Punctuation +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +'\n' Text.Whitespace + +'f' Name +'(' Punctuation +'::' Operator +'Type' Keyword.Type +'{' Punctuation +'<:' Operator +'T' Keyword.Type +'}' Punctuation +')' Punctuation +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +'\n' Text.Whitespace + +'f' Name +'(' Punctuation +'::' Operator +'AT' Keyword.Type +')' Punctuation +' ' Text.Whitespace +'where' Keyword +' ' Text.Whitespace +'AT' Keyword.Type +' ' Text.Whitespace +'<:' Operator +' ' Text.Whitespace +'AbstractArray' Keyword.Type +'{' Punctuation +'MyType' Keyword.Type +',' Punctuation +'1' Literal.Number.Integer +'}' Punctuation +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +'\n' Text.Whitespace + +'f' Name +'(' Punctuation +'::' Operator +'Val' Keyword.Type +'{' Punctuation +':named' Literal.String.Symbol +'}' Punctuation +')' Punctuation +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +'\n' Text.Whitespace + +'f' Name +'(' Punctuation +'::' Operator +'typeof' Name +'(' Punctuation +'sin' Name +')' Punctuation +')' Punctuation +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +'\n' Text.Whitespace + +'MyInt' Keyword.Type +' ' Text.Whitespace +'<:' Operator +' ' Text.Whitespace +'Integer' Keyword.Type +'\n' Text.Whitespace + +'Number' Keyword.Type +' ' Text.Whitespace +'>:' Operator +' ' Text.Whitespace +'MyInt' Keyword.Type +'\n' Text.Whitespace + +'AT' Keyword.Type +'{' Punctuation +'T' Keyword.Type +',' Punctuation +'1' Literal.Number.Integer +'}' Punctuation +' ' Text.Whitespace +'<:' Operator +' ' Text.Whitespace +'B' Keyword.Type +'\n' Text.Whitespace + +'B' Keyword.Type +'>:' Operator +'AT' Keyword.Type +'{' Punctuation +'T' Keyword.Type +',' Punctuation +'1' Literal.Number.Integer +'}' Punctuation +'\n' Text.Whitespace + +'A' Keyword.Type +' ' Text.Whitespace +'<:' Operator +' ' Text.Whitespace +'f' Name +'(' Punctuation +'B' Name +')' Punctuation +'\n' Text.Whitespace + +'g' Name +'(' Punctuation +'C' Name +')' Punctuation +' ' Text.Whitespace +'<:' Operator +' ' Text.Whitespace +'T' Keyword.Type +'\n' Text.Whitespace diff --git a/tests/snippets/julia/test_unicode.txt b/tests/snippets/julia/test_unicode.txt new file mode 100644 index 0000000..6b2508a --- /dev/null +++ b/tests/snippets/julia/test_unicode.txt @@ -0,0 +1,37 @@ +# Test that unicode character, √, in an expression is recognized + +---input--- +s = √((1/n) * sum(count .^ 2) - mu .^2) + +---tokens--- +'s' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'√' Operator +'(' Punctuation +'(' Punctuation +'1' Literal.Number.Integer +'/' Operator +'n' Name +')' Punctuation +' ' Text.Whitespace +'*' Operator +' ' Text.Whitespace +'sum' Name +'(' Punctuation +'count' Name +' ' Text.Whitespace +'.^' Operator +' ' Text.Whitespace +'2' Literal.Number.Integer +')' Punctuation +' ' Text.Whitespace +'-' Operator +' ' Text.Whitespace +'mu' Name +' ' Text.Whitespace +'.^' Operator +'2' Literal.Number.Integer +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/kotlin/test_can_cope_generics_in_destructuring.txt b/tests/snippets/kotlin/test_can_cope_generics_in_destructuring.txt new file mode 100644 index 0000000..8fc7f3d --- /dev/null +++ b/tests/snippets/kotlin/test_can_cope_generics_in_destructuring.txt @@ -0,0 +1,27 @@ +---input--- +val (a: List<Something>, b: Set<Wobble>) = + +---tokens--- +'val' Keyword.Declaration +' ' Text.Whitespace +'(' Punctuation +'a' Name.Variable +':' Punctuation +' ' Text.Whitespace +'List' Name +'<' Operator +'Something' Name +'>' Operator +',' Punctuation +' ' Text.Whitespace +'b' Name.Variable +':' Punctuation +' ' Text.Whitespace +'Set' Name +'<' Operator +'Wobble' Name +'>' Operator +')' Punctuation +' ' Text.Whitespace +'=' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/kotlin/test_can_cope_with_backtick_names_in_functions.txt b/tests/snippets/kotlin/test_can_cope_with_backtick_names_in_functions.txt new file mode 100644 index 0000000..c89c0ef --- /dev/null +++ b/tests/snippets/kotlin/test_can_cope_with_backtick_names_in_functions.txt @@ -0,0 +1,8 @@ +---input--- +fun `wo bble` + +---tokens--- +'fun' Keyword.Declaration +' ' Text.Whitespace +'`wo bble`' Name.Function +'\n' Text.Whitespace diff --git a/tests/snippets/kotlin/test_can_cope_with_commas_and_dashes_in_backtick_Names.txt b/tests/snippets/kotlin/test_can_cope_with_commas_and_dashes_in_backtick_Names.txt new file mode 100644 index 0000000..7b2aed7 --- /dev/null +++ b/tests/snippets/kotlin/test_can_cope_with_commas_and_dashes_in_backtick_Names.txt @@ -0,0 +1,8 @@ +---input--- +fun `wo,-bble` + +---tokens--- +'fun' Keyword.Declaration +' ' Text.Whitespace +'`wo,-bble`' Name.Function +'\n' Text.Whitespace diff --git a/tests/snippets/kotlin/test_can_cope_with_destructuring.txt b/tests/snippets/kotlin/test_can_cope_with_destructuring.txt new file mode 100644 index 0000000..3db6ed9 --- /dev/null +++ b/tests/snippets/kotlin/test_can_cope_with_destructuring.txt @@ -0,0 +1,16 @@ +---input--- +val (a, b) = + +---tokens--- +'val' Keyword.Declaration +' ' Text.Whitespace +'(' Punctuation +'a' Name.Variable +',' Punctuation +' ' Text.Whitespace +'b' Name.Variable +')' Punctuation +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'\n' Text.Whitespace diff --git a/tests/snippets/kotlin/test_can_cope_with_generics.txt b/tests/snippets/kotlin/test_can_cope_with_generics.txt new file mode 100644 index 0000000..09eb61f --- /dev/null +++ b/tests/snippets/kotlin/test_can_cope_with_generics.txt @@ -0,0 +1,34 @@ +---input--- +inline fun <reified T : ContractState> VaultService.queryBy(): Vault.Page<T> { + +---tokens--- +'inline' Keyword.Declaration +' ' Text.Whitespace +'fun' Keyword.Declaration +' ' Text.Whitespace +'<' Operator +'reified' Keyword +' ' Text.Whitespace +'T' Name +' ' Text.Whitespace +':' Punctuation +' ' Text.Whitespace +'ContractState' Name +'>' Operator +' ' Text.Whitespace +'VaultService' Name +'.' Punctuation +'queryBy' Name.Function +'(' Punctuation +')' Punctuation +':' Punctuation +' ' Text.Whitespace +'Vault' Name +'.' Punctuation +'Page' Name.Attribute +'<' Operator +'T' Name +'>' Operator +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/kotlin/test_modifier_keyword.txt b/tests/snippets/kotlin/test_modifier_keyword.txt new file mode 100644 index 0000000..730c0a5 --- /dev/null +++ b/tests/snippets/kotlin/test_modifier_keyword.txt @@ -0,0 +1,18 @@ +---input--- +data class A(val data: String) + +---tokens--- +'data' Keyword.Declaration +' ' Text.Whitespace +'class' Keyword.Declaration +' ' Text.Whitespace +'A' Name.Class +'(' Punctuation +'val' Keyword.Declaration +' ' Text.Whitespace +'data' Name.Variable +':' Punctuation +' ' Text.Whitespace +'String' Keyword.Type +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/kotlin/test_should_cope_with_multiline_comments.txt b/tests/snippets/kotlin/test_should_cope_with_multiline_comments.txt new file mode 100644 index 0000000..33ec204 --- /dev/null +++ b/tests/snippets/kotlin/test_should_cope_with_multiline_comments.txt @@ -0,0 +1,12 @@ +---input--- +""" +this +is +a +comment""" + +---tokens--- +'"""' Literal.String +'\nthis\nis\na\ncomment' Literal.String +'"""' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/kotlin/test_string_interpolation.txt b/tests/snippets/kotlin/test_string_interpolation.txt new file mode 100644 index 0000000..04ea254 --- /dev/null +++ b/tests/snippets/kotlin/test_string_interpolation.txt @@ -0,0 +1,35 @@ +---input--- +val something = "something" +"Here is $something" +"Here is ${something.toUpperList()}" + +---tokens--- +'val' Keyword.Declaration +' ' Text.Whitespace +'something' Name.Variable +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"' Literal.String +'something' Literal.String +'"' Literal.String +'\n' Text.Whitespace + +'"' Literal.String +'Here is ' Literal.String +'$' Literal.String.Interpol +'something' Name +'"' Literal.String +'\n' Text.Whitespace + +'"' Literal.String +'Here is ' Literal.String +'${' Literal.String.Interpol +'something' Name +'.' Punctuation +'toUpperList' Name.Attribute +'(' Punctuation +')' Punctuation +'}' Literal.String.Interpol +'"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/less/test_single_line_comments.txt b/tests/snippets/less/test_single_line_comments.txt new file mode 100644 index 0000000..a900644 --- /dev/null +++ b/tests/snippets/less/test_single_line_comments.txt @@ -0,0 +1,21 @@ +---input--- +.font-light { + font-weight: 100; // Comment +} + +---tokens--- +'.' Punctuation +'font-light' Name.Class +' ' Text.Whitespace +'{' Punctuation +'\n ' Text.Whitespace +'font-weight' Keyword +':' Punctuation +' ' Text.Whitespace +'100' Literal.Number.Integer +';' Punctuation +' ' Text.Whitespace +'// Comment\n' Comment.Single + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/mason/test_handles_tags_correctly.txt b/tests/snippets/mason/test_handles_tags_correctly.txt new file mode 100644 index 0000000..0eb215d --- /dev/null +++ b/tests/snippets/mason/test_handles_tags_correctly.txt @@ -0,0 +1,69 @@ +---input--- +<%class> +has 'foo'; +has 'bar' => (required => 1); +has 'baz' => (isa => 'Int', default => 17); +</%class> + +---tokens--- +'<%class>' Name.Tag +'\n' Text.Whitespace + +'' Name +'has' Name +' ' Text.Whitespace +"'foo'" Literal.String +';' Punctuation +'\n' Text.Whitespace + +'' Name +'has' Name +' ' Text.Whitespace +"'bar'" Literal.String +' ' Text.Whitespace +'=' Operator +'>' Operator +' ' Text.Whitespace +'(' Punctuation +'' Name +'required' Name +' ' Text.Whitespace +'=' Operator +'>' Operator +' ' Text.Whitespace +'1' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'' Name +'has' Name +' ' Text.Whitespace +"'baz'" Literal.String +' ' Text.Whitespace +'=' Operator +'>' Operator +' ' Text.Whitespace +'(' Punctuation +'' Name +'isa' Name +' ' Text.Whitespace +'=' Operator +'>' Operator +' ' Text.Whitespace +"'Int'" Literal.String +',' Punctuation +' ' Text.Whitespace +'' Name +'default' Name +' ' Text.Whitespace +'=' Operator +'>' Operator +' ' Text.Whitespace +'17' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'</%class>' Name.Tag +'\n' Text.Whitespace diff --git a/tests/snippets/matlab/test_classes_with_properties.txt b/tests/snippets/matlab/test_classes_with_properties.txt new file mode 100644 index 0000000..7de838eb --- /dev/null +++ b/tests/snippets/matlab/test_classes_with_properties.txt @@ -0,0 +1,105 @@ +---input--- +classdef Name < dynamicprops + properties + % i am a comment + name1 + name2 + end + properties (Constant = true, SetAccess = protected) + % i too am a comment + matrix = [0, 1, 2]; + string = 'i am a string' + end + methods + % i am also a comment + function self = Name() + % i am a comment inside a constructor + end + end +end + +---tokens--- +'classdef' Keyword +' ' Text.Whitespace +'Name' Name +' ' Text.Whitespace +'<' Operator +' ' Text.Whitespace +'dynamicprops' Keyword +'\n ' Text.Whitespace +'properties' Keyword +'\n ' Text.Whitespace +'% i am a comment' Comment +'\n ' Text.Whitespace +'name1' Name +'\n ' Text.Whitespace +'name2' Name +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'properties' Keyword +' ' Text.Whitespace +'(' Punctuation +'Constant' Name.Builtin +' ' Text.Whitespace +'=' Punctuation +' ' Text.Whitespace +'true' Keyword +',' Punctuation +' ' Text.Whitespace +'SetAccess' Name.Builtin +' ' Text.Whitespace +'=' Punctuation +' ' Text.Whitespace +'protected' Keyword +')' Punctuation +'\n ' Text.Whitespace +'% i too am a comment' Comment +'\n ' Text.Whitespace +'matrix' Name +' ' Text.Whitespace +'=' Punctuation +' ' Text.Whitespace +'[' Punctuation +'0' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'1' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'2' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n ' Text.Whitespace +'string' Name +' ' Text.Whitespace +'=' Punctuation +' ' Text.Whitespace +"'" Literal.String +"i am a string'" Literal.String +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'methods' Keyword +'\n ' Text.Whitespace +'% i am also a comment' Comment +'\n ' Text.Whitespace +'function' Keyword +' ' Text.Whitespace +'self' Text +' ' Text.Whitespace +'=' Punctuation +' ' Text.Whitespace +'Name' Name.Function +'(' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'% i am a comment inside a constructor' Comment +'\n ' Text.Whitespace +'end' Keyword +'\n ' Text.Whitespace +'end' Keyword +'\n' Text.Whitespace + +'end' Keyword +'\n' Text.Whitespace diff --git a/tests/snippets/matlab/test_command_mode.txt b/tests/snippets/matlab/test_command_mode.txt new file mode 100644 index 0000000..e9a8c11 --- /dev/null +++ b/tests/snippets/matlab/test_command_mode.txt @@ -0,0 +1,12 @@ +# MATLAB allows char function arguments to not be enclosed by parentheses +# or contain quote characters, as long as they are space separated. Test +# that one common such function is formatted appropriately. + +---input--- +help sin + +---tokens--- +'help' Name.Builtin +' ' Text.Whitespace +'sin' Name.Builtin +'\n' Text.Whitespace diff --git a/tests/snippets/matlab/test_comment_after_continuation.txt b/tests/snippets/matlab/test_comment_after_continuation.txt new file mode 100644 index 0000000..baf88e3 --- /dev/null +++ b/tests/snippets/matlab/test_comment_after_continuation.txt @@ -0,0 +1,25 @@ +# Test that text after the line continuation ellipses is marked as a comment. + +---input--- +set('T',300,... a comment +'P',101325); + +---tokens--- +'set' Name.Builtin +'(' Punctuation +"'" Literal.String +"T'" Literal.String +',' Punctuation +'300' Literal.Number.Integer +',' Punctuation +'...' Keyword +' a comment' Comment +'\n' Text.Whitespace + +"'" Literal.String +"P'" Literal.String +',' Punctuation +'101325' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/matlab/test_dot_operator.txt b/tests/snippets/matlab/test_dot_operator.txt new file mode 100644 index 0000000..b858cd3 --- /dev/null +++ b/tests/snippets/matlab/test_dot_operator.txt @@ -0,0 +1,10 @@ +# 1./x is (1)(./)(x), not (1.)(/)(x) + +---input--- +1./x + +---tokens--- +'1' Literal.Number.Integer +'./' Operator +'x' Name +'\n' Text.Whitespace diff --git a/tests/snippets/matlab/test_keywords_ended_by_newline.txt b/tests/snippets/matlab/test_keywords_ended_by_newline.txt new file mode 100644 index 0000000..59dca03 --- /dev/null +++ b/tests/snippets/matlab/test_keywords_ended_by_newline.txt @@ -0,0 +1,36 @@ +# Test that keywords on their own line are marked as keywords. + +---input--- +if x > 100 + disp('x > 100') +else + disp('x < 100') +end + +---tokens--- +'if' Keyword +' ' Text.Whitespace +'x' Name +' ' Text.Whitespace +'>' Operator +' ' Text.Whitespace +'100' Literal.Number.Integer +'\n ' Text.Whitespace +'disp' Name.Builtin +'(' Punctuation +"'" Literal.String +"x > 100'" Literal.String +')' Punctuation +'\n' Text.Whitespace + +'else' Keyword +'\n ' Text.Whitespace +'disp' Name.Builtin +'(' Punctuation +"'" Literal.String +"x < 100'" Literal.String +')' Punctuation +'\n' Text.Whitespace + +'end' Keyword +'\n' Text.Whitespace diff --git a/tests/snippets/matlab/test_line_continuation.txt b/tests/snippets/matlab/test_line_continuation.txt new file mode 100644 index 0000000..1e47368 --- /dev/null +++ b/tests/snippets/matlab/test_line_continuation.txt @@ -0,0 +1,25 @@ +# Test that line continuation by ellipses does not produce generic +# output on the second line. + +---input--- +set('T',300,... +'P',101325); + +---tokens--- +'set' Name.Builtin +'(' Punctuation +"'" Literal.String +"T'" Literal.String +',' Punctuation +'300' Literal.Number.Integer +',' Punctuation +'...' Keyword +'\n' Text.Whitespace + +"'" Literal.String +"P'" Literal.String +',' Punctuation +'101325' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/matlab/test_multiple_spaces_variable_assignment.txt b/tests/snippets/matlab/test_multiple_spaces_variable_assignment.txt new file mode 100644 index 0000000..ec5ac24 --- /dev/null +++ b/tests/snippets/matlab/test_multiple_spaces_variable_assignment.txt @@ -0,0 +1,13 @@ +# Test that multiple spaces with an equal sign doesn't get formatted to a string. + +---input--- +x = 100; + +---tokens--- +'x' Name +' ' Text.Whitespace +'=' Punctuation +' ' Text.Whitespace +'100' Literal.Number.Integer +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/matlab/test_one_space_assignment.txt b/tests/snippets/matlab/test_one_space_assignment.txt new file mode 100644 index 0000000..ceafb6e --- /dev/null +++ b/tests/snippets/matlab/test_one_space_assignment.txt @@ -0,0 +1,13 @@ +# Test that one space before an equal sign is formatted correctly. + +---input--- +x = 100; + +---tokens--- +'x' Name +' ' Text.Whitespace +'=' Punctuation +' ' Text.Whitespace +'100' Literal.Number.Integer +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/matlab/test_operator_multiple_space.txt b/tests/snippets/matlab/test_operator_multiple_space.txt new file mode 100644 index 0000000..e13d3a3 --- /dev/null +++ b/tests/snippets/matlab/test_operator_multiple_space.txt @@ -0,0 +1,13 @@ +# Test that multiple spaces with an operator doesn't get formatted to a string. + +---input--- +x > 100; + +---tokens--- +'x' Name +' ' Text.Whitespace +'>' Operator +' ' Text.Whitespace +'100' Literal.Number.Integer +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/matlab/test_single_line.txt b/tests/snippets/matlab/test_single_line.txt new file mode 100644 index 0000000..72a48f8 --- /dev/null +++ b/tests/snippets/matlab/test_single_line.txt @@ -0,0 +1,18 @@ +---input--- +set('T',300,'P',101325); + +---tokens--- +'set' Name.Builtin +'(' Punctuation +"'" Literal.String +"T'" Literal.String +',' Punctuation +'300' Literal.Number.Integer +',' Punctuation +"'" Literal.String +"P'" Literal.String +',' Punctuation +'101325' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/matlabsession/test_wrong_continuation.txt b/tests/snippets/matlabsession/test_wrong_continuation.txt new file mode 100644 index 0000000..6ea3e31 --- /dev/null +++ b/tests/snippets/matlabsession/test_wrong_continuation.txt @@ -0,0 +1,18 @@ +---input--- +>> foo() +bar +... +baz + +---tokens--- +'>> ' Generic.Prompt +'foo' Name +'(' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'bar\n' Generic.Output + +'...\n' Generic.Output + +'baz\n' Generic.Output diff --git a/tests/snippets/mcfunction/commenting.txt b/tests/snippets/mcfunction/commenting.txt new file mode 100644 index 0000000..7a5a37d --- /dev/null +++ b/tests/snippets/mcfunction/commenting.txt @@ -0,0 +1,173 @@ +---input--- +#> Get: #rx.playerdb:api/v2/get +#> +#> @input +#> $in.uid rx.io +#> +#> @output +#> rx.playerdb:io player +# +# Selects data inside the database and copies to rx.playerdb:io player +# See #api/v2/select for more info.. +# +#* Note: something, something, this is important.. + +# Normal Comment + +# This **shouldn't** be a comment.. +scoreboard players operation @s obj = #fakeplayer obj + +#> single line block comment +tellraw @a "This string # has # hashtags o_O" + +---tokens--- +'#>' Comment.Multiline +' ' Text.Whitespace +'Get:' Literal.String.Doc +' ' Text.Whitespace +'#rx.playerdb:api/v2/get' Name.Function +'\n' Text + +'#>' Comment.Multiline +'\n' Text + +'#>' Comment.Multiline +' ' Text.Whitespace +'@input' Name.Decorator +'\n' Text + +'#>' Comment.Multiline +' ' Text.Whitespace +'$in.uid' Name.Variable.Magic +' ' Text.Whitespace +'rx.io' Literal.String.Doc +'\n' Text + +'#>' Comment.Multiline +'\n' Text + +'#>' Comment.Multiline +' ' Text.Whitespace +'@output' Name.Decorator +'\n' Text + +'#>' Comment.Multiline +' ' Text.Whitespace +'rx.playerdb:io' Name.Function +' ' Text.Whitespace +'player' Literal.String.Doc +'\n' Text + +'#' Comment.Multiline +'\n' Text + +'#' Comment.Multiline +' ' Text.Whitespace +'Selects' Comment.Multiline +' ' Text.Whitespace +'data' Comment.Multiline +' ' Text.Whitespace +'inside' Comment.Multiline +' ' Text.Whitespace +'the' Comment.Multiline +' ' Text.Whitespace +'database' Comment.Multiline +' ' Text.Whitespace +'and' Comment.Multiline +' ' Text.Whitespace +'copies' Comment.Multiline +' ' Text.Whitespace +'to' Comment.Multiline +' ' Text.Whitespace +'rx.playerdb:io' Name.Function +' ' Text.Whitespace +'player' Comment.Multiline +'\n' Text + +'#' Comment.Multiline +' ' Text.Whitespace +'See' Comment.Multiline +' ' Text.Whitespace +'#api/v2/select' Name.Function +' ' Text.Whitespace +'for' Comment.Multiline +' ' Text.Whitespace +'more' Comment.Multiline +' ' Text.Whitespace +'info..' Comment.Multiline +'\n' Text + +'#' Comment.Multiline +' \n' Text.Whitespace + +'#*' Comment.Multiline +' ' Text.Whitespace +'Note:' Comment.Multiline +' ' Text.Whitespace +'something,' Comment.Multiline +' ' Text.Whitespace +'something,' Comment.Multiline +' ' Text.Whitespace +'this' Comment.Multiline +' ' Text.Whitespace +'is' Comment.Multiline +' ' Text.Whitespace +'important..' Comment.Multiline +'\n' Text + +'\n#' Comment.Multiline +' ' Text.Whitespace +'Normal' Comment.Multiline +' ' Text.Whitespace +'Comment' Comment.Multiline +'\n' Text + +'\n#' Comment.Multiline +' ' Text.Whitespace +'This' Comment.Multiline +' ' Text.Whitespace +"**shouldn't**" Comment.Multiline +' ' Text.Whitespace +'be' Comment.Multiline +' ' Text.Whitespace +'a' Comment.Multiline +' ' Text.Whitespace +'comment..' Comment.Multiline +'\n' Text + +'scoreboard' Name.Builtin +' ' Text.Whitespace +'players' Keyword.Constant +' ' Text.Whitespace +'operation' Keyword.Constant +' ' Text.Whitespace +'@s' Name.Variable +' ' Text.Whitespace +'obj' Keyword.Constant +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'#fakeplayer' Name.Variable.Magic +' ' Text.Whitespace +'obj' Keyword.Constant +'\n\n' Text.Whitespace + +'#>' Comment.Multiline +' ' Text.Whitespace +'single' Literal.String.Doc +' ' Text.Whitespace +'line' Literal.String.Doc +' ' Text.Whitespace +'block' Literal.String.Doc +' ' Text.Whitespace +'comment' Literal.String.Doc +'\n' Text + +'tellraw' Name.Builtin +' ' Text.Whitespace +'@a' Name.Variable +' ' Text.Whitespace +'"' Literal.String.Double +'This string # has # hashtags o_O' Literal.String.Double +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/mcfunction/coordinates.txt b/tests/snippets/mcfunction/coordinates.txt new file mode 100644 index 0000000..d5398bc --- /dev/null +++ b/tests/snippets/mcfunction/coordinates.txt @@ -0,0 +1,188 @@ +---input--- +# normal +tp 1 2 3 +tp 100.5 80 -100.5 + +# relative +tp 10 ~ -10 +tp 10 ~10 -10 +tp 10 ~0.5 -10 +tp 10 ~.5 -10 +tp 10 ~-10 -10 +tp 10 ~-0.5 -10 +tp 10 ~-.5 -10 + +# carrot +tp 10 ^ -10 +tp 10 ^10 -10 +tp 10 ^0.5 -10 +tp 10 ^.5 -10 +tp 10 ^-10 -10 +tp 10 ^-0.5 -10 +tp 10 ^-.5 -10 + +---tokens--- +'# normal' Comment.Single +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'1' Literal.Number.Float +' ' Text.Whitespace +'2' Literal.Number.Float +' ' Text.Whitespace +'3' Literal.Number.Float +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'100.5' Literal.Number.Float +' ' Text.Whitespace +'80' Literal.Number.Float +' ' Text.Whitespace +'-100.5' Literal.Number.Float +'\n\n' Text.Whitespace + +'# relative' Comment.Single +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'10' Literal.Number.Float +' ' Text.Whitespace +'~' Operator +' ' Text.Whitespace +'-10' Literal.Number.Float +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'10' Literal.Number.Float +' ' Text.Whitespace +'~' Operator +'10' Literal.Number.Float +' ' Text.Whitespace +'-10' Literal.Number.Float +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'10' Literal.Number.Float +' ' Text.Whitespace +'~' Operator +'0.5' Literal.Number.Float +' ' Text.Whitespace +'-10' Literal.Number.Float +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'10' Literal.Number.Float +' ' Text.Whitespace +'~' Operator +'.5' Literal.Number.Float +' ' Text.Whitespace +'-10' Literal.Number.Float +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'10' Literal.Number.Float +' ' Text.Whitespace +'~' Operator +'-10' Literal.Number.Float +' ' Text.Whitespace +'-10' Literal.Number.Float +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'10' Literal.Number.Float +' ' Text.Whitespace +'~' Operator +'-0.5' Literal.Number.Float +' ' Text.Whitespace +'-10' Literal.Number.Float +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'10' Literal.Number.Float +' ' Text.Whitespace +'~' Operator +'-.5' Literal.Number.Float +' ' Text.Whitespace +'-10' Literal.Number.Float +'\n\n' Text.Whitespace + +'# carrot' Comment.Single +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'10' Literal.Number.Float +' ' Text.Whitespace +'^' Operator +' ' Text.Whitespace +'-10' Literal.Number.Float +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'10' Literal.Number.Float +' ' Text.Whitespace +'^' Operator +'10' Literal.Number.Float +' ' Text.Whitespace +'-10' Literal.Number.Float +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'10' Literal.Number.Float +' ' Text.Whitespace +'^' Operator +'0.5' Literal.Number.Float +' ' Text.Whitespace +'-10' Literal.Number.Float +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'10' Literal.Number.Float +' ' Text.Whitespace +'^' Operator +'.5' Literal.Number.Float +' ' Text.Whitespace +'-10' Literal.Number.Float +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'10' Literal.Number.Float +' ' Text.Whitespace +'^' Operator +'-10' Literal.Number.Float +' ' Text.Whitespace +'-10' Literal.Number.Float +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'10' Literal.Number.Float +' ' Text.Whitespace +'^' Operator +'-0.5' Literal.Number.Float +' ' Text.Whitespace +'-10' Literal.Number.Float +'\n' Text.Whitespace + +'tp' Name.Builtin +' ' Text.Whitespace +'10' Literal.Number.Float +' ' Text.Whitespace +'^' Operator +'-.5' Literal.Number.Float +' ' Text.Whitespace +'-10' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/mcfunction/data.txt b/tests/snippets/mcfunction/data.txt new file mode 100644 index 0000000..440d668 --- /dev/null +++ b/tests/snippets/mcfunction/data.txt @@ -0,0 +1,120 @@ +---input--- +data modify storage my:storage root set value { + key: "This NBT Compound is multiple lines", + Count: 10b, + tags: [ + 0, + 1, + ], + UUID +} + +tellraw @a { + "text": "how ever", + "color": "blue", + "extra": [ + "this is json o_O" + ] +} + +---tokens--- +'data' Name.Builtin +' ' Text.Whitespace +'modify' Keyword.Constant +' ' Text.Whitespace +'storage' Keyword.Constant +' ' Text.Whitespace +'my:storage' Name.Function +' ' Text.Whitespace +'root' Keyword.Constant +' ' Text.Whitespace +'set' Keyword.Constant +' ' Text.Whitespace +'value' Keyword.Constant +' ' Text.Whitespace +'{' Punctuation +'\n ' Text.Whitespace +'key' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'"' Literal.String.Double +'This NBT Compound is multiple lines' Literal.String.Double +'"' Literal.String.Double +',' Punctuation +'\n ' Text.Whitespace +'Count' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'10' Literal.Number.Integer +'b' Name.Attribute +',' Punctuation +'\n ' Text.Whitespace +'tags' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'[' Punctuation +'\n ' Text.Whitespace +'0' Literal.Number.Integer +',' Punctuation +'\n ' Text.Whitespace +'1' Literal.Number.Integer +',' Punctuation +'\n ' Text.Whitespace +']' Punctuation +',' Punctuation +'\n ' Text.Whitespace +'UUID' Name.Attribute +'\n' Text.Whitespace + +'}' Punctuation +'\n\n' Text.Whitespace + +'tellraw' Name.Builtin +' ' Text.Whitespace +'@a' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n ' Text.Whitespace +'"' Name.Attribute +'text' Name.Attribute +'"' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'"' Literal.String.Double +'how ever' Literal.String.Double +'"' Literal.String.Double +',' Punctuation +'\n ' Text.Whitespace +'"' Name.Attribute +'color' Name.Attribute +'"' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'"' Literal.String.Double +'blue' Literal.String.Double +'"' Literal.String.Double +',' Punctuation +'\n ' Text.Whitespace +'"' Name.Attribute +'extra' Name.Attribute +'"' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'[' Punctuation +'\n ' Text.Whitespace +'"' Name.Attribute +'this' Name.Attribute +' ' Text.Whitespace +'is' Name.Attribute +' ' Text.Whitespace +'json' Name.Attribute +' ' Text.Whitespace +'o_' Name.Attribute +'O' Name.Attribute +'"' Name.Attribute +'\n ' Text.Whitespace +']' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/mcfunction/difficult_1.txt b/tests/snippets/mcfunction/difficult_1.txt new file mode 100644 index 0000000..f9ad1bc --- /dev/null +++ b/tests/snippets/mcfunction/difficult_1.txt @@ -0,0 +1,56 @@ +---input--- +# execute as @e[nbt={ Item: {id: "minecraft:diamond", Count: 64 } }] run +# setblock ~ ~ ~ minecraft:dispenser[facing=up]{Items: [{id: "minecraft:diamond", Count: 1}]} +# tellraw @a [{"text": "hello", "color": "blue"}, {"text": "world", "color": "blue"}] + +execute as @a[advancements={minecraft:story/form_obsidian={foo=true, bar=false},minecraft:story/follow_ender_eye={foo=false, bar=true}}] run + +---tokens--- +'# execute as @e[nbt={ Item: {id: "minecraft:diamond", Count: 64 } }] run' Comment.Single +'\n' Text.Whitespace + +'# setblock ~ ~ ~ minecraft:dispenser[facing=up]{Items: [{id: "minecraft:diamond", Count: 1}]}' Comment.Single +'\n' Text.Whitespace + +'# tellraw @a [{"text": "hello", "color": "blue"}, {"text": "world", "color": "blue"}]' Comment.Single +'\n\n' Text.Whitespace + +'execute' Name.Builtin +' ' Text.Whitespace +'as' Keyword.Constant +' ' Text.Whitespace +'@a' Name.Variable +'[' Punctuation +'advancements' Name.Attribute +'=' Punctuation +'{' Punctuation +'minecraft:story/form_obsidian' Name.Attribute +'=' Punctuation +'{' Punctuation +'foo' Name.Attribute +'=' Punctuation +'true' Name.Tag +',' Punctuation +' ' Text.Whitespace +'bar' Name.Attribute +'=' Punctuation +'false' Name.Tag +'}' Punctuation +',' Punctuation +'minecraft:story/follow_ender_eye' Name.Attribute +'=' Punctuation +'{' Punctuation +'foo' Name.Attribute +'=' Punctuation +'false' Name.Tag +',' Punctuation +' ' Text.Whitespace +'bar' Name.Attribute +'=' Punctuation +'true' Name.Tag +'}' Punctuation +'}' Punctuation +']' Punctuation +' ' Text.Whitespace +'run' Keyword.Constant +'\n' Text.Whitespace diff --git a/tests/snippets/mcfunction/multiline.txt b/tests/snippets/mcfunction/multiline.txt new file mode 100644 index 0000000..1587910 --- /dev/null +++ b/tests/snippets/mcfunction/multiline.txt @@ -0,0 +1,108 @@ +---input--- +execute + as @a # For each "player", + at @s # start at their feet. + anchored eyes # Looking through their eyes, + facing 0 0 0 # face perfectly at the target + anchored feet # (go back to the feet) + positioned ^ ^ ^1 # and move one block forward. + rotated as @s # Face the direction the player + # is actually facing, + positioned ^ ^ ^-1 # and move one block back. + if entity @s[distance=..0.6] # Check if we're close to the + # player's feet. + run + say "I'm facing the target!" + +---tokens--- +'execute' Name.Builtin +'\n ' Text.Whitespace +'as' Keyword.Constant +' ' Text.Whitespace +'@a' Name.Variable +' ' Text.Whitespace +'# For each "player",' Comment.Single +'\n ' Text.Whitespace +'at' Keyword.Constant +' ' Text.Whitespace +'@s' Name.Variable +' ' Text.Whitespace +'# start at their feet.' Comment.Single +'\n ' Text.Whitespace +'anchored' Keyword.Constant +' ' Text.Whitespace +'eyes' Keyword.Constant +' ' Text.Whitespace +'# Looking through their eyes,' Comment.Single +'\n ' Text.Whitespace +'facing' Keyword.Constant +' ' Text.Whitespace +'0' Literal.Number.Float +' ' Text.Whitespace +'0' Literal.Number.Float +' ' Text.Whitespace +'0' Literal.Number.Float +' ' Text.Whitespace +'# face perfectly at the target' Comment.Single +'\n ' Text.Whitespace +'anchored' Keyword.Constant +' ' Text.Whitespace +'feet' Keyword.Constant +' ' Text.Whitespace +'# (go back to the feet)' Comment.Single +'\n ' Text.Whitespace +'positioned' Keyword.Constant +' ' Text.Whitespace +'^' Operator +' ' Text.Whitespace +'^' Operator +' ' Text.Whitespace +'^' Operator +'1' Literal.Number.Float +' ' Text.Whitespace +'# and move one block forward.' Comment.Single +'\n ' Text.Whitespace +'rotated' Keyword.Constant +' ' Text.Whitespace +'as' Keyword.Constant +' ' Text.Whitespace +'@s' Name.Variable +' ' Text.Whitespace +'# Face the direction the player' Comment.Single +'\n ' Text.Whitespace +'# is actually facing,' Comment.Single +'\n ' Text.Whitespace +'positioned' Keyword.Constant +' ' Text.Whitespace +'^' Operator +' ' Text.Whitespace +'^' Operator +' ' Text.Whitespace +'^' Operator +'-1' Literal.Number.Float +' ' Text.Whitespace +'# and move one block back.' Comment.Single +'\n ' Text.Whitespace +'if' Keyword.Constant +' ' Text.Whitespace +'entity' Keyword.Constant +' ' Text.Whitespace +'@s' Name.Variable +'[' Punctuation +'distance' Name.Attribute +'=' Punctuation +'..' Literal +'0.6' Literal.Number.Float +']' Punctuation +' ' Text.Whitespace +"# Check if we're close to the" Comment.Single +'\n ' Text.Whitespace +"# player's feet." Comment.Single +'\n ' Text.Whitespace +'run' Keyword.Constant +' \n say' Name.Builtin +' ' Text.Whitespace +'"' Literal.String.Double +"I'm facing the target!" Literal.String.Double +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/mcfunction/selectors.txt b/tests/snippets/mcfunction/selectors.txt new file mode 100644 index 0000000..ea69c78 --- /dev/null +++ b/tests/snippets/mcfunction/selectors.txt @@ -0,0 +1,73 @@ +---input--- +execute + as @a[ + advancements={ + minecraft:story/form_obsidian={ + foo=true, + bar=false + }, + minecraft:story/follow_ender_eye={ + foo=false, bar=true + } + } + ] run + say this command is nuts + +---tokens--- +'execute' Name.Builtin +'\n ' Text.Whitespace +'as' Keyword.Constant +' ' Text.Whitespace +'@a' Name.Variable +'[' Punctuation +'\n ' Text.Whitespace +'advancements' Name.Attribute +'=' Punctuation +'{' Punctuation +'\n ' Text.Whitespace +'minecraft:story/form_obsidian' Name.Attribute +'=' Punctuation +'{' Punctuation +'\n ' Text.Whitespace +'foo' Name.Attribute +'=' Punctuation +'true' Name.Tag +',' Punctuation +'\n ' Text.Whitespace +'bar' Name.Attribute +'=' Punctuation +'false' Name.Tag +'\n ' Text.Whitespace +'}' Punctuation +',' Punctuation +'\n ' Text.Whitespace +'minecraft:story/follow_ender_eye' Name.Attribute +'=' Punctuation +'{' Punctuation +'\n ' Text.Whitespace +'foo' Name.Attribute +'=' Punctuation +'false' Name.Tag +',' Punctuation +' ' Text.Whitespace +'bar' Name.Attribute +'=' Punctuation +'true' Name.Tag +'\n ' Text.Whitespace +'}' Punctuation +'\n ' Text.Whitespace +'}' Punctuation +'\n ' Text.Whitespace +']' Punctuation +' ' Text.Whitespace +'run' Keyword.Constant +'\n say' Name.Builtin +' ' Text.Whitespace +'this' Keyword.Constant +' ' Text.Whitespace +'command' Keyword.Constant +' ' Text.Whitespace +'is' Keyword.Constant +' ' Text.Whitespace +'nuts' Keyword.Constant +'\n' Text.Whitespace diff --git a/tests/snippets/mcfunction/simple.txt b/tests/snippets/mcfunction/simple.txt new file mode 100644 index 0000000..664c91c --- /dev/null +++ b/tests/snippets/mcfunction/simple.txt @@ -0,0 +1,92 @@ +---input--- +#> This command looks for a player with 10 hp and prints a message +# @param - @s = player + +execute as @a[name="rx", nbt={Health: 10.0f}] run tellraw @a {"text": "this is my cool command"} # epic + +---tokens--- +'#>' Comment.Multiline +' ' Text.Whitespace +'This' Literal.String.Doc +' ' Text.Whitespace +'command' Literal.String.Doc +' ' Text.Whitespace +'looks' Literal.String.Doc +' ' Text.Whitespace +'for' Literal.String.Doc +' ' Text.Whitespace +'a' Literal.String.Doc +' ' Text.Whitespace +'player' Literal.String.Doc +' ' Text.Whitespace +'with' Literal.String.Doc +' ' Text.Whitespace +'10' Literal.String.Doc +' ' Text.Whitespace +'hp' Literal.String.Doc +' ' Text.Whitespace +'and' Literal.String.Doc +' ' Text.Whitespace +'prints' Literal.String.Doc +' ' Text.Whitespace +'a' Literal.String.Doc +' ' Text.Whitespace +'message' Literal.String.Doc +'\n' Text + +'#' Comment.Multiline +' ' Text.Whitespace +'@param' Name.Decorator +' ' Text.Whitespace +'-' Comment.Multiline +' ' Text.Whitespace +'@s' Name.Decorator +' ' Text.Whitespace +'=' Comment.Multiline +' ' Text.Whitespace +'player' Comment.Multiline +'\n' Text + +'\n' Text.Whitespace + +'execute' Name.Builtin +' ' Text.Whitespace +'as' Keyword.Constant +' ' Text.Whitespace +'@a' Name.Variable +'[' Punctuation +'name' Name.Attribute +'=' Punctuation +'"' Literal.String.Double +'rx' Literal.String.Double +'"' Literal.String.Double +',' Punctuation +' ' Text.Whitespace +'nbt' Name.Attribute +'=' Punctuation +'{' Punctuation +'Health' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'10.0f' Literal.Number.Float +'}' Punctuation +']' Punctuation +' ' Text.Whitespace +'run' Keyword.Constant +' tellraw' Name.Builtin +' ' Text.Whitespace +'@a' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'"' Name.Attribute +'text' Name.Attribute +'"' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'"' Literal.String.Double +'this is my cool command' Literal.String.Double +'"' Literal.String.Double +'}' Punctuation +' ' Text.Whitespace +'# epic' Comment.Single +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_bold_fenced_by_asterisk.txt b/tests/snippets/md/test_bold_fenced_by_asterisk.txt new file mode 100644 index 0000000..25c899d --- /dev/null +++ b/tests/snippets/md/test_bold_fenced_by_asterisk.txt @@ -0,0 +1,15 @@ +---input--- +**bold** + +(**bold**) + +---tokens--- +'**bold**' Generic.Strong +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'(' Text +'**bold**' Generic.Strong +')' Text +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_bold_fenced_by_underscore.txt b/tests/snippets/md/test_bold_fenced_by_underscore.txt new file mode 100644 index 0000000..49c9110 --- /dev/null +++ b/tests/snippets/md/test_bold_fenced_by_underscore.txt @@ -0,0 +1,15 @@ +---input--- +__bold__ + +(__bold__) + +---tokens--- +'__bold__' Generic.Strong +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'(' Text +'__bold__' Generic.Strong +')' Text +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_bulleted_list_1.txt b/tests/snippets/md/test_bulleted_list_1.txt new file mode 100644 index 0000000..8da212c --- /dev/null +++ b/tests/snippets/md/test_bulleted_list_1.txt @@ -0,0 +1,14 @@ +---input--- +* foo +* bar + +---tokens--- +'*' Keyword +' ' Text.Whitespace +'foo' Text +'\n' Text.Whitespace + +'*' Keyword +' ' Text.Whitespace +'bar' Text +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_bulleted_list_2.txt b/tests/snippets/md/test_bulleted_list_2.txt new file mode 100644 index 0000000..040b908 --- /dev/null +++ b/tests/snippets/md/test_bulleted_list_2.txt @@ -0,0 +1,14 @@ +---input--- +- foo +- bar + +---tokens--- +'-' Keyword +' ' Text.Whitespace +'foo' Text +'\n' Text.Whitespace + +'-' Keyword +' ' Text.Whitespace +'bar' Text +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_bulleted_list_3.txt b/tests/snippets/md/test_bulleted_list_3.txt new file mode 100644 index 0000000..a59d5f7 --- /dev/null +++ b/tests/snippets/md/test_bulleted_list_3.txt @@ -0,0 +1,14 @@ +---input--- +* *foo* +* bar + +---tokens--- +'*' Keyword +' ' Text.Whitespace +'*foo*' Generic.Emph +'\n' Text.Whitespace + +'*' Keyword +' ' Text.Whitespace +'bar' Text +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_bulleted_list_4.txt b/tests/snippets/md/test_bulleted_list_4.txt new file mode 100644 index 0000000..111f9cf --- /dev/null +++ b/tests/snippets/md/test_bulleted_list_4.txt @@ -0,0 +1,19 @@ +---input--- +``` +code +``` +* *foo* +* bar + +---tokens--- +'```\ncode\n```\n' Literal.String.Backtick + +'*' Keyword +' ' Text.Whitespace +'*foo*' Generic.Emph +'\n' Text.Whitespace + +'*' Keyword +' ' Text.Whitespace +'bar' Text +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_code_block_fenced_by_backticks.txt b/tests/snippets/md/test_code_block_fenced_by_backticks.txt new file mode 100644 index 0000000..4f8fefa --- /dev/null +++ b/tests/snippets/md/test_code_block_fenced_by_backticks.txt @@ -0,0 +1,15 @@ +---input--- +``` +code +``` + +``` +multi +`line` +code +``` + +---tokens--- +'```\ncode\n```\n' Literal.String.Backtick + +'\n```\nmulti\n`line`\ncode\n```\n' Literal.String.Backtick diff --git a/tests/snippets/md/test_code_block_with_language.txt b/tests/snippets/md/test_code_block_with_language.txt new file mode 100644 index 0000000..41f2563 --- /dev/null +++ b/tests/snippets/md/test_code_block_with_language.txt @@ -0,0 +1,16 @@ +---input--- +```python +import this +``` + +---tokens--- +'```' Literal.String.Backtick +'python' Literal.String.Backtick +'\n' Text + +'import' Keyword.Namespace +' ' Text +'this' Name.Namespace +'\n' Text.Whitespace + +'```\n' Literal.String.Backtick diff --git a/tests/snippets/md/test_escape_italics.txt b/tests/snippets/md/test_escape_italics.txt new file mode 100644 index 0000000..42e1cb4 --- /dev/null +++ b/tests/snippets/md/test_escape_italics.txt @@ -0,0 +1,23 @@ +---input--- +\*no italics\* + +\_ no italics \_ + +---tokens--- +'\\*' Text +'no' Text +' ' Text +'italics' Text +'\\*' Text +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'\\_' Text +' ' Text +'no' Text +' ' Text +'italics' Text +' ' Text +'\\_' Text +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_inline_code.txt b/tests/snippets/md/test_inline_code.txt new file mode 100644 index 0000000..c9a3964 --- /dev/null +++ b/tests/snippets/md/test_inline_code.txt @@ -0,0 +1,36 @@ +---input--- +code: `code` + + `**code**` + +(`code`) + +code (`in brackets`) + +---tokens--- +'code:' Text +' ' Text +'`code`' Literal.String.Backtick +'\n' Text.Whitespace + +'\n' Text.Whitespace + +' ' Text +'`**code**`' Literal.String.Backtick +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'(' Text +'`code`' Literal.String.Backtick +')' Text +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'code' Text +' ' Text +'(' Text +'`in brackets`' Literal.String.Backtick +')' Text +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_inline_code_after_block.txt b/tests/snippets/md/test_inline_code_after_block.txt new file mode 100644 index 0000000..e1f704b --- /dev/null +++ b/tests/snippets/md/test_inline_code_after_block.txt @@ -0,0 +1,19 @@ +---input--- +``` +code +``` +* nocode +* `code` + +---tokens--- +'```\ncode\n```\n' Literal.String.Backtick + +'*' Keyword +' ' Text.Whitespace +'nocode' Text +'\n' Text.Whitespace + +'*' Keyword +' ' Text.Whitespace +'`code`' Literal.String.Backtick +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_inline_code_in_list.txt b/tests/snippets/md/test_inline_code_in_list.txt new file mode 100644 index 0000000..9cd8aa0 --- /dev/null +++ b/tests/snippets/md/test_inline_code_in_list.txt @@ -0,0 +1,26 @@ +---input--- +* `code` + +- `code` + +1. `code` + +---tokens--- +'*' Keyword +' ' Text.Whitespace +'`code`' Literal.String.Backtick +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'-' Keyword +' ' Text.Whitespace +'`code`' Literal.String.Backtick +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'1.' Keyword +' ' Text +'`code`' Literal.String.Backtick +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_invalid_bold.txt b/tests/snippets/md/test_invalid_bold.txt new file mode 100644 index 0000000..6a5db6a --- /dev/null +++ b/tests/snippets/md/test_invalid_bold.txt @@ -0,0 +1,31 @@ +---input--- +**no bold__ + +__no bold** + +*no bold* + +_no bold_ + +---tokens--- +'**no' Text +' ' Text +'bold__' Text +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'__no' Text +' ' Text +'bold**' Text +'\n' Text.Whitespace + +'\n' Text + +'*no bold*' Generic.Emph +'\n' Text.Whitespace + +'\n' Text + +'_no bold_' Generic.Emph +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_invalid_italics.txt b/tests/snippets/md/test_invalid_italics.txt new file mode 100644 index 0000000..28acb5d --- /dev/null +++ b/tests/snippets/md/test_invalid_italics.txt @@ -0,0 +1,31 @@ +---input--- +*no italics_ + +_no italics* + +**no italics** + +__no italics__ + +---tokens--- +'*no' Text +' ' Text +'italics_' Text +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'_no' Text +' ' Text +'italics*' Text +'\n' Text.Whitespace + +'\n' Text + +'**no italics**' Generic.Strong +'\n' Text.Whitespace + +'\n' Text + +'__no italics__' Generic.Strong +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_italics_and_bold.txt b/tests/snippets/md/test_italics_and_bold.txt new file mode 100644 index 0000000..bb2bf4f --- /dev/null +++ b/tests/snippets/md/test_italics_and_bold.txt @@ -0,0 +1,21 @@ +---input--- +**bold** and *italics* + +*italics* and **bold** + +---tokens--- +'**bold**' Generic.Strong +' ' Text +'and' Text +' ' Text +'*italics*' Generic.Emph +'\n' Text.Whitespace + +'\n' Text + +'*italics*' Generic.Emph +' ' Text +'and' Text +' ' Text +'**bold**' Generic.Strong +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_italics_fenced_by_asterisk.txt b/tests/snippets/md/test_italics_fenced_by_asterisk.txt new file mode 100644 index 0000000..cd8775e --- /dev/null +++ b/tests/snippets/md/test_italics_fenced_by_asterisk.txt @@ -0,0 +1,15 @@ +---input--- +*italics* + +(*italics*) + +---tokens--- +'*italics*' Generic.Emph +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'(' Text +'*italics*' Generic.Emph +')' Text +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_italics_fenced_by_underscore.txt b/tests/snippets/md/test_italics_fenced_by_underscore.txt new file mode 100644 index 0000000..5f57756 --- /dev/null +++ b/tests/snippets/md/test_italics_fenced_by_underscore.txt @@ -0,0 +1,15 @@ +---input--- +_italics_ + +(_italics_) + +---tokens--- +'_italics_' Generic.Emph +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'(' Text +'_italics_' Generic.Emph +')' Text +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_italics_no_multiline.txt b/tests/snippets/md/test_italics_no_multiline.txt new file mode 100644 index 0000000..2657ed1 --- /dev/null +++ b/tests/snippets/md/test_italics_no_multiline.txt @@ -0,0 +1,10 @@ +---input--- +*no +italics* + +---tokens--- +'*no' Text +'\n' Text.Whitespace + +'italics*' Text +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_links.txt b/tests/snippets/md/test_links.txt new file mode 100644 index 0000000..9fc46e8 --- /dev/null +++ b/tests/snippets/md/test_links.txt @@ -0,0 +1,23 @@ +---input--- +[text](link) + +![Image of foo](https://bar.baz) + +---tokens--- +'[' Text +'text' Name.Tag +']' Text +'(' Text +'link' Name.Attribute +')' Text +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'![' Text +'Image of foo' Name.Tag +']' Text +'(' Text +'https://bar.baz' Name.Attribute +')' Text +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_mentions.txt b/tests/snippets/md/test_mentions.txt new file mode 100644 index 0000000..a2def5c --- /dev/null +++ b/tests/snippets/md/test_mentions.txt @@ -0,0 +1,10 @@ +---input--- +note for @me: + +---tokens--- +'note' Text +' ' Text +'for' Text +' ' Text +'@me:' Name.Entity +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_numbered_list.txt b/tests/snippets/md/test_numbered_list.txt new file mode 100644 index 0000000..1384d6b --- /dev/null +++ b/tests/snippets/md/test_numbered_list.txt @@ -0,0 +1,14 @@ +---input--- +1. foo +2. bar + +---tokens--- +'1.' Keyword +' ' Text +'foo' Text +'\n' Text.Whitespace + +'2.' Keyword +' ' Text +'bar' Text +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_quote.txt b/tests/snippets/md/test_quote.txt new file mode 100644 index 0000000..cc64ec2 --- /dev/null +++ b/tests/snippets/md/test_quote.txt @@ -0,0 +1,10 @@ +---input--- +> a +> quote + +---tokens--- +'> ' Keyword +'a\n' Generic.Emph + +'> ' Keyword +'quote\n' Generic.Emph diff --git a/tests/snippets/md/test_reference_style_links.txt b/tests/snippets/md/test_reference_style_links.txt new file mode 100644 index 0000000..813cef3 --- /dev/null +++ b/tests/snippets/md/test_reference_style_links.txt @@ -0,0 +1,18 @@ +---input--- +[an example][id] +[id]: http://example.com + +---tokens--- +'[' Text +'an example' Name.Tag +']' Text +'[' Text +'id' Name.Label +']' Text +'\n' Text.Whitespace + +'[' Text +'id' Name.Label +']: ' Text +'http://example.com' Name.Attribute +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_strikethrough.txt b/tests/snippets/md/test_strikethrough.txt new file mode 100644 index 0000000..483c63a --- /dev/null +++ b/tests/snippets/md/test_strikethrough.txt @@ -0,0 +1,9 @@ +---input--- +~~striked~~not striked + +---tokens--- +'~~striked~~' Generic.Deleted +'not' Text +' ' Text +'striked' Text +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_task_list.txt b/tests/snippets/md/test_task_list.txt new file mode 100644 index 0000000..7a64506 --- /dev/null +++ b/tests/snippets/md/test_task_list.txt @@ -0,0 +1,34 @@ +---input--- +- [ ] sample task + +* [ ] sample task + + * [ ] sample task + +---tokens--- +'- ' Keyword +'[ ]' Keyword +' ' Text +'sample' Text +' ' Text +'task' Text +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'* ' Keyword +'[ ]' Keyword +' ' Text +'sample' Text +' ' Text +'task' Text +'\n' Text.Whitespace + +'\n ' Text.Whitespace +'* ' Keyword +'[ ]' Keyword +' ' Text +'sample' Text +' ' Text +'task' Text +'\n' Text.Whitespace diff --git a/tests/snippets/md/test_topics.txt b/tests/snippets/md/test_topics.txt new file mode 100644 index 0000000..18029cc --- /dev/null +++ b/tests/snippets/md/test_topics.txt @@ -0,0 +1,10 @@ +---input--- +message to #you: + +---tokens--- +'message' Text +' ' Text +'to' Text +' ' Text +'#you:' Name.Entity +'\n' Text.Whitespace diff --git a/tests/snippets/mips/deprecated_substrings.txt b/tests/snippets/mips/deprecated_substrings.txt new file mode 100644 index 0000000..4e7aa7d --- /dev/null +++ b/tests/snippets/mips/deprecated_substrings.txt @@ -0,0 +1,34 @@ +---input--- +beql +bnel +bgtzl +bgezl +bltzl +blezl +bltzall +bgezall + +---tokens--- +'beql' Keyword.Pseudo +'\n' Text.Whitespace + +'bnel' Keyword.Pseudo +'\n' Text.Whitespace + +'bgtzl' Keyword.Pseudo +'\n' Text.Whitespace + +'bgezl' Keyword.Pseudo +'\n' Text.Whitespace + +'bltzl' Keyword.Pseudo +'\n' Text.Whitespace + +'blezl' Keyword.Pseudo +'\n' Text.Whitespace + +'bltzall' Keyword.Pseudo +'\n' Text.Whitespace + +'bgezall' Keyword.Pseudo +'\n' Text.Whitespace diff --git a/tests/snippets/mips/keyword_substrings.txt b/tests/snippets/mips/keyword_substrings.txt new file mode 100644 index 0000000..70d68d5 --- /dev/null +++ b/tests/snippets/mips/keyword_substrings.txt @@ -0,0 +1,254 @@ +---input--- +subu +subi +sub +addu +addiu +addi +add +multu +mult +mulu +mul +maddu +madd +msubu +msub +divu +div +nor +xor +andi +and +ori +xori +or +sllv +sll +srlv +srl +srav +sra +sltiu +sltu +slti +slt +jalr +jal +jr +j +bgezal +bgez +bltzal +bltz +lbu +lb +lhu +lh +lwr +lw +swl +swr +sw +teqi +teq +tneqi +tne +tgeiu +tgeu +tgei +tge +tltiu +tltu +tlti +tlt + +---tokens--- +'subu' Keyword +'\n' Text.Whitespace + +'subi' Keyword +'\n' Text.Whitespace + +'sub' Keyword +'\n' Text.Whitespace + +'addu' Keyword +'\n' Text.Whitespace + +'addiu' Keyword +'\n' Text.Whitespace + +'addi' Keyword +'\n' Text.Whitespace + +'add' Keyword +'\n' Text.Whitespace + +'multu' Keyword +'\n' Text.Whitespace + +'mult' Keyword +'\n' Text.Whitespace + +'mulu' Keyword +'\n' Text.Whitespace + +'mul' Keyword +'\n' Text.Whitespace + +'maddu' Keyword +'\n' Text.Whitespace + +'madd' Keyword +'\n' Text.Whitespace + +'msubu' Keyword +'\n' Text.Whitespace + +'msub' Keyword +'\n' Text.Whitespace + +'divu' Keyword +'\n' Text.Whitespace + +'div' Keyword +'\n' Text.Whitespace + +'nor' Keyword +'\n' Text.Whitespace + +'xor' Keyword +'\n' Text.Whitespace + +'andi' Keyword +'\n' Text.Whitespace + +'and' Keyword +'\n' Text.Whitespace + +'ori' Keyword +'\n' Text.Whitespace + +'xori' Keyword +'\n' Text.Whitespace + +'or' Keyword +'\n' Text.Whitespace + +'sllv' Keyword +'\n' Text.Whitespace + +'sll' Keyword +'\n' Text.Whitespace + +'srlv' Keyword +'\n' Text.Whitespace + +'srl' Keyword +'\n' Text.Whitespace + +'srav' Keyword +'\n' Text.Whitespace + +'sra' Keyword +'\n' Text.Whitespace + +'sltiu' Keyword +'\n' Text.Whitespace + +'sltu' Keyword +'\n' Text.Whitespace + +'slti' Keyword +'\n' Text.Whitespace + +'slt' Keyword +'\n' Text.Whitespace + +'jalr' Keyword +'\n' Text.Whitespace + +'jal' Keyword +'\n' Text.Whitespace + +'jr' Keyword +'\n' Text.Whitespace + +'j' Keyword +'\n' Text.Whitespace + +'bgezal' Keyword +'\n' Text.Whitespace + +'bgez' Keyword +'\n' Text.Whitespace + +'bltzal' Keyword +'\n' Text.Whitespace + +'bltz' Keyword +'\n' Text.Whitespace + +'lbu' Keyword +'\n' Text.Whitespace + +'lb' Keyword +'\n' Text.Whitespace + +'lhu' Keyword +'\n' Text.Whitespace + +'lh' Keyword +'\n' Text.Whitespace + +'lwr' Keyword +'\n' Text.Whitespace + +'lw' Keyword +'\n' Text.Whitespace + +'swl' Keyword +'\n' Text.Whitespace + +'swr' Keyword +'\n' Text.Whitespace + +'sw' Keyword +'\n' Text.Whitespace + +'teqi' Keyword +'\n' Text.Whitespace + +'teq' Keyword +'\n' Text.Whitespace + +'tneqi' Keyword +'\n' Text.Whitespace + +'tne' Keyword +'\n' Text.Whitespace + +'tgeiu' Keyword +'\n' Text.Whitespace + +'tgeu' Keyword +'\n' Text.Whitespace + +'tgei' Keyword +'\n' Text.Whitespace + +'tge' Keyword +'\n' Text.Whitespace + +'tltiu' Keyword +'\n' Text.Whitespace + +'tltu' Keyword +'\n' Text.Whitespace + +'tlti' Keyword +'\n' Text.Whitespace + +'tlt' Keyword +'\n' Text.Whitespace diff --git a/tests/snippets/mips/variable_substrings.txt b/tests/snippets/mips/variable_substrings.txt new file mode 100644 index 0000000..85e845d --- /dev/null +++ b/tests/snippets/mips/variable_substrings.txt @@ -0,0 +1,102 @@ +---input--- +remu +rem +mulou +mulo +negu +neg +beqz +bgeu +bge +bgtu +bgt +bleu +ble +bltu +blt +bnez +b +ulhu +ulh +sgtu +sgt +sgeu +sge +sleu +sle + +---tokens--- +'remu' Name.Variable +'\n' Text.Whitespace + +'rem' Name.Variable +'\n' Text.Whitespace + +'mulou' Name.Variable +'\n' Text.Whitespace + +'mulo' Name.Variable +'\n' Text.Whitespace + +'negu' Name.Variable +'\n' Text.Whitespace + +'neg' Name.Variable +'\n' Text.Whitespace + +'beqz' Name.Variable +'\n' Text.Whitespace + +'bgeu' Name.Variable +'\n' Text.Whitespace + +'bge' Name.Variable +'\n' Text.Whitespace + +'bgtu' Name.Variable +'\n' Text.Whitespace + +'bgt' Name.Variable +'\n' Text.Whitespace + +'bleu' Name.Variable +'\n' Text.Whitespace + +'ble' Name.Variable +'\n' Text.Whitespace + +'bltu' Name.Variable +'\n' Text.Whitespace + +'blt' Name.Variable +'\n' Text.Whitespace + +'bnez' Name.Variable +'\n' Text.Whitespace + +'b' Name.Variable +'\n' Text.Whitespace + +'ulhu' Name.Variable +'\n' Text.Whitespace + +'ulh' Name.Variable +'\n' Text.Whitespace + +'sgtu' Name.Variable +'\n' Text.Whitespace + +'sgt' Name.Variable +'\n' Text.Whitespace + +'sgeu' Name.Variable +'\n' Text.Whitespace + +'sge' Name.Variable +'\n' Text.Whitespace + +'sleu' Name.Variable +'\n' Text.Whitespace + +'sle' Name.Variable +'\n' Text.Whitespace diff --git a/tests/snippets/nasm/checkid.txt b/tests/snippets/nasm/checkid.txt new file mode 100644 index 0000000..72f25da --- /dev/null +++ b/tests/snippets/nasm/checkid.txt @@ -0,0 +1,32 @@ +---input--- +print_brick_no_color: + inc bx + mov di, bx ; comment + jmp check_col + +---tokens--- +'print_brick_no_color:' Name.Label +'\n' Text.Whitespace + +' ' Text.Whitespace +'inc' Name.Function +' ' Text.Whitespace +'bx' Name.Builtin +'\n' Text.Whitespace + +' ' Text.Whitespace +'mov' Name.Function +' ' Text.Whitespace +'di' Name.Builtin +',' Punctuation +' ' Text.Whitespace +'bx' Name.Builtin +' ' Text.Whitespace +'; comment' Comment.Single +'\n' Text.Whitespace + +' ' Text.Whitespace +'jmp' Name.Function +' ' Text.Whitespace +'check_col' Name.Variable +'\n' Text.Whitespace diff --git a/tests/snippets/objectivec/test_literal_number_bool.txt b/tests/snippets/objectivec/test_literal_number_bool.txt new file mode 100644 index 0000000..4d6f965 --- /dev/null +++ b/tests/snippets/objectivec/test_literal_number_bool.txt @@ -0,0 +1,7 @@ +---input--- +@NO; + +---tokens--- +'@NO' Literal.Number +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/objectivec/test_literal_number_bool_expression.txt b/tests/snippets/objectivec/test_literal_number_bool_expression.txt new file mode 100644 index 0000000..36eb736 --- /dev/null +++ b/tests/snippets/objectivec/test_literal_number_bool_expression.txt @@ -0,0 +1,9 @@ +---input--- +@(YES); + +---tokens--- +'@(' Literal +'YES' Name.Builtin +')' Literal +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/objectivec/test_literal_number_expression.txt b/tests/snippets/objectivec/test_literal_number_expression.txt new file mode 100644 index 0000000..4ba2348 --- /dev/null +++ b/tests/snippets/objectivec/test_literal_number_expression.txt @@ -0,0 +1,11 @@ +---input--- +@(1+2); + +---tokens--- +'@(' Literal +'1' Literal.Number.Integer +'+' Operator +'2' Literal.Number.Integer +')' Literal +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/objectivec/test_literal_number_int.txt b/tests/snippets/objectivec/test_literal_number_int.txt new file mode 100644 index 0000000..35d947e --- /dev/null +++ b/tests/snippets/objectivec/test_literal_number_int.txt @@ -0,0 +1,9 @@ +---input--- +@(1); + +---tokens--- +'@(' Literal +'1' Literal.Number.Integer +')' Literal +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/objectivec/test_literal_number_nested_expression.txt b/tests/snippets/objectivec/test_literal_number_nested_expression.txt new file mode 100644 index 0000000..b58d37c --- /dev/null +++ b/tests/snippets/objectivec/test_literal_number_nested_expression.txt @@ -0,0 +1,15 @@ +---input--- +@(1+(2+3)); + +---tokens--- +'@(' Literal +'1' Literal.Number.Integer +'+' Operator +'(' Punctuation +'2' Literal.Number.Integer +'+' Operator +'3' Literal.Number.Integer +')' Punctuation +')' Literal +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/objectivec/test_module_import.txt b/tests/snippets/objectivec/test_module_import.txt new file mode 100644 index 0000000..c66e1c8 --- /dev/null +++ b/tests/snippets/objectivec/test_module_import.txt @@ -0,0 +1,9 @@ +---input--- +@import ModuleA; + +---tokens--- +'@import' Keyword +' ' Text.Whitespace +'ModuleA' Name +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/octave/test_multilinecomment.txt b/tests/snippets/octave/test_multilinecomment.txt new file mode 100644 index 0000000..0987f4e --- /dev/null +++ b/tests/snippets/octave/test_multilinecomment.txt @@ -0,0 +1,27 @@ +---input--- +%{ +This is a long comment + %} + #{ +This too +#} +This isnt + +---tokens--- +'%{\n' Comment.Multiline + +'This is a long comment\n' Comment.Multiline + +' %}' Comment.Multiline +'\n ' Text +'#{\n' Comment.Multiline + +'This too\n' Comment.Multiline + +'#}' Comment.Multiline +'\n' Text + +'This' Name +' ' Text +'isnt' Name +'\n' Text diff --git a/tests/snippets/omg-idl/annotation_named_params.txt b/tests/snippets/omg-idl/annotation_named_params.txt new file mode 100644 index 0000000..2758429 --- /dev/null +++ b/tests/snippets/omg-idl/annotation_named_params.txt @@ -0,0 +1,27 @@ +Asserts that annotation named parameters use Name, which is different from the +normal "scoped_name =" lexing, which uses Name.Constant. + +---input--- +@mod::anno(value = const_a) const short const_b = const_a; + +---tokens--- +'@mod::anno' Name.Decorator +'(' Punctuation +'value' Name +' ' Text.Whitespace +'=' Punctuation +' ' Text.Whitespace +'const_a' Name +')' Punctuation +' ' Text.Whitespace +'const' Keyword.Declaration +' ' Text.Whitespace +'short' Keyword.Type +' ' Text.Whitespace +'const_b' Name.Constant +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'const_a' Name +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/omg-idl/enumerators.txt b/tests/snippets/omg-idl/enumerators.txt new file mode 100644 index 0000000..e6ff1e3 --- /dev/null +++ b/tests/snippets/omg-idl/enumerators.txt @@ -0,0 +1,18 @@ +Asserts that enumerators use Name.Constant instead of just Name. + +---input--- +enum Enum_t {enum_a, enum_b}; + +---tokens--- +'enum' Keyword +' ' Text.Whitespace +'Enum_t' Name.Class +' ' Text.Whitespace +'{' Punctuation +'enum_a' Name.Constant +',' Punctuation +' ' Text.Whitespace +'enum_b' Name.Constant +'}' Punctuation +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/peg/test_basic.txt b/tests/snippets/peg/test_basic.txt new file mode 100644 index 0000000..13a9bb4 --- /dev/null +++ b/tests/snippets/peg/test_basic.txt @@ -0,0 +1,17 @@ +---input--- +rule<-("terminal"/nonterminal/[cls])* + +---tokens--- +'rule' Name.Class +'<-' Operator +'(' Punctuation +'"terminal"' Literal.String.Double +'/' Operator +'nonterminal' Name.Class +'/' Operator +'[' Punctuation +'cls' Literal.String +']' Punctuation +')' Punctuation +'*' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/peg/test_modified_strings.txt b/tests/snippets/peg/test_modified_strings.txt new file mode 100644 index 0000000..f411226 --- /dev/null +++ b/tests/snippets/peg/test_modified_strings.txt @@ -0,0 +1,21 @@ +# see for example: +# - http://textx.github.io/Arpeggio/ +# - https://nim-lang.org/docs/pegs.html +# - https://github.com/erikrose/parsimonious +# can't handle parsimonious-style regex while ~ is a cut operator + +---input--- +~"regex" i"insensitive" "multimod"ilx ("not modified") + +---tokens--- +'~' Operator +'"regex"' Literal.String.Double +' ' Text +'i"insensitive"' Literal.String.Double +' ' Text +'"multimod"ilx' Literal.String.Double +' ' Text +'(' Punctuation +'"not modified"' Literal.String.Double +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/peg/test_operators.txt b/tests/snippets/peg/test_operators.txt new file mode 100644 index 0000000..35aee32 --- /dev/null +++ b/tests/snippets/peg/test_operators.txt @@ -0,0 +1,29 @@ +# see for example: +# - https://github.com/gvanrossum/pegen +# - https://nim-lang.org/docs/pegs.html + +---input--- +rule = 'a' | 'b' +rule: 'a' ~ 'b' + +---tokens--- +'rule' Name.Class +' ' Text +'=' Operator +' ' Text +"'a'" Literal.String.Single +' ' Text +'|' Operator +' ' Text +"'b'" Literal.String.Single +'\n' Text.Whitespace + +'rule' Name.Class +':' Operator +' ' Text +"'a'" Literal.String.Single +' ' Text +'~' Operator +' ' Text +"'b'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/php/test_backslashes_in_strings.txt b/tests/snippets/php/test_backslashes_in_strings.txt new file mode 100644 index 0000000..4bdbeb5 --- /dev/null +++ b/tests/snippets/php/test_backslashes_in_strings.txt @@ -0,0 +1,28 @@ +---input--- +<?php +$pipe = popen( "flamegraph.pl --title=\"$title\" > /var/www/html/w/docs/flamegraph.svg", 'w' ); + +---tokens--- +'<?php' Comment.Preproc +'\n' Text + +'$pipe' Name.Variable +' ' Text +'=' Operator +' ' Text +'popen' Name.Builtin +'(' Punctuation +' ' Text +'"' Literal.String.Double +'flamegraph.pl --title=' Literal.String.Double +'\\"' Literal.String.Escape +'$title' Literal.String.Interpol +'\\"' Literal.String.Escape +' > /var/www/html/w/docs/flamegraph.svg' Literal.String.Double +'"' Literal.String.Double +',' Punctuation +' ' Text +"'w'" Literal.String.Single +' ' Text +');' Punctuation +'\n' Text diff --git a/tests/snippets/php/test_string_escaping_run.txt b/tests/snippets/php/test_string_escaping_run.txt new file mode 100644 index 0000000..e31fbfc --- /dev/null +++ b/tests/snippets/php/test_string_escaping_run.txt @@ -0,0 +1,16 @@ +---input--- +<?php $x="{\""; ?> + +---tokens--- +'<?php' Comment.Preproc +' ' Text +'$x' Name.Variable +'=' Operator +'"' Literal.String.Double +'{' Literal.String.Double +'\\"' Literal.String.Escape +'"' Literal.String.Double +';' Punctuation +' ' Text +'?>' Comment.Preproc +'\n' Other diff --git a/tests/snippets/powershell/test_colon_punctuation.txt b/tests/snippets/powershell/test_colon_punctuation.txt new file mode 100644 index 0000000..72733c3 --- /dev/null +++ b/tests/snippets/powershell/test_colon_punctuation.txt @@ -0,0 +1,35 @@ +---input--- +$message = (Test-Path C:\) ? "Path exists" : "Path not found" +[math]::pi + +---tokens--- +'$message' Name.Variable +' ' Text +'=' Punctuation +' ' Text +'(' Punctuation +'Test-Path' Name.Builtin +' ' Text +'C' Name +':' Punctuation +'\\' Punctuation +')' Punctuation +' ' Text +'?' Punctuation +' ' Text +'"' Literal.String.Double +'Path exists' Literal.String.Double +'"' Literal.String.Double +' ' Text +':' Punctuation +' ' Text +'"' Literal.String.Double +'Path not found' Literal.String.Double +'"' Literal.String.Double +'\n' Text + +'[math]' Name.Constant +':' Punctuation +':' Punctuation +'pi' Name +'\n' Text diff --git a/tests/snippets/powershell/test_remoting_session.txt b/tests/snippets/powershell/test_remoting_session.txt new file mode 100644 index 0000000..23fa9c2 --- /dev/null +++ b/tests/snippets/powershell/test_remoting_session.txt @@ -0,0 +1,19 @@ +---input--- +[Long-NetBIOS-Hostname]: PS C:\> Get-ChildItem + +---tokens--- +'[' Punctuation +'Long' Name +'-NetBIOS' Name +'-Hostname' Name +']' Punctuation +':' Punctuation +' ' Text +'PS ' Name.Builtin +'C' Name +':' Punctuation +'\\' Punctuation +'>' Punctuation +' ' Text +'Get-ChildItem' Name.Builtin +'\n' Text diff --git a/tests/snippets/powershell/test_session.txt b/tests/snippets/powershell/test_session.txt new file mode 100644 index 0000000..7fe8b42 --- /dev/null +++ b/tests/snippets/powershell/test_session.txt @@ -0,0 +1,28 @@ +---input--- +PS C:\> Get-ChildItem + +PS> Get-ChildItem + +PS > Get-ChildItem + +---tokens--- +'PS ' Name.Builtin +'C' Name +':' Punctuation +'\\' Punctuation +'>' Punctuation +' ' Text +'Get-ChildItem' Name.Builtin +'\n\n' Text + +'PS' Name +'>' Punctuation +' ' Text +'Get-ChildItem' Name.Builtin +'\n\n' Text + +'PS ' Name.Builtin +'>' Punctuation +' ' Text +'Get-ChildItem' Name.Builtin +'\n' Text diff --git a/tests/snippets/praat/test_broken_unquoted_string.txt b/tests/snippets/praat/test_broken_unquoted_string.txt new file mode 100644 index 0000000..e108bb8 --- /dev/null +++ b/tests/snippets/praat/test_broken_unquoted_string.txt @@ -0,0 +1,16 @@ +---input--- +printline string +... 'interpolated' string + +---tokens--- +'printline' Keyword +' ' Text.Whitespace +'string' Literal.String +'\n' Text.Whitespace + +'...' Punctuation +' ' Text.Whitespace +"'interpolated'" Literal.String.Interpol +' ' Text.Whitespace +'string' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/praat/test_function_call.txt b/tests/snippets/praat/test_function_call.txt new file mode 100644 index 0000000..608ef16 --- /dev/null +++ b/tests/snippets/praat/test_function_call.txt @@ -0,0 +1,20 @@ +---input--- +selected("Sound", i+(a*b)) + +---tokens--- +'selected' Name.Function +'(' Punctuation +'"' Literal.String +'Sound' Literal.String +'"' Literal.String +',' Punctuation +' ' Text.Whitespace +'i' Text +'+' Operator +'(' Text +'a' Text +'*' Operator +'b' Text +')' Punctuation +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/praat/test_inline_if.txt b/tests/snippets/praat/test_inline_if.txt new file mode 100644 index 0000000..e370263 --- /dev/null +++ b/tests/snippets/praat/test_inline_if.txt @@ -0,0 +1,27 @@ +---input--- +var = if true == 1 then -1 else 0 fi + +---tokens--- +'var' Text +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'true' Text +' ' Text.Whitespace +'==' Operator +' ' Text.Whitespace +'1' Literal.Number +' ' Text.Whitespace +'then' Keyword +' ' Text.Whitespace +'-' Operator +'1' Literal.Number +' ' Text.Whitespace +'else' Keyword +' ' Text.Whitespace +'0' Literal.Number +' ' Text.Whitespace +'fi' Keyword +'\n' Text.Whitespace diff --git a/tests/snippets/praat/test_interpolated_indexed_numeric_with_precision.txt b/tests/snippets/praat/test_interpolated_indexed_numeric_with_precision.txt new file mode 100644 index 0000000..0dc23e6 --- /dev/null +++ b/tests/snippets/praat/test_interpolated_indexed_numeric_with_precision.txt @@ -0,0 +1,6 @@ +---input--- +'a[3]:3' + +---tokens--- +"'a[3]:3'" Literal.String.Interpol +'\n' Text.Whitespace diff --git a/tests/snippets/praat/test_interpolated_local_numeric_with_precision.txt b/tests/snippets/praat/test_interpolated_local_numeric_with_precision.txt new file mode 100644 index 0000000..515fa9e --- /dev/null +++ b/tests/snippets/praat/test_interpolated_local_numeric_with_precision.txt @@ -0,0 +1,6 @@ +---input--- +'a.a:3' + +---tokens--- +"'a.a:3'" Literal.String.Interpol +'\n' Text.Whitespace diff --git a/tests/snippets/praat/test_interpolated_numeric_hash.txt b/tests/snippets/praat/test_interpolated_numeric_hash.txt new file mode 100644 index 0000000..3d6d0f8 --- /dev/null +++ b/tests/snippets/praat/test_interpolated_numeric_hash.txt @@ -0,0 +1,6 @@ +---input--- +'a["b"]' + +---tokens--- +'\'a["b"]\'' Literal.String.Interpol +'\n' Text.Whitespace diff --git a/tests/snippets/praat/test_interpolated_numeric_indexed.txt b/tests/snippets/praat/test_interpolated_numeric_indexed.txt new file mode 100644 index 0000000..ea436f1 --- /dev/null +++ b/tests/snippets/praat/test_interpolated_numeric_indexed.txt @@ -0,0 +1,6 @@ +---input--- +'a[3]' + +---tokens--- +"'a[3]'" Literal.String.Interpol +'\n' Text.Whitespace diff --git a/tests/snippets/praat/test_interpolated_numeric_with_precision.txt b/tests/snippets/praat/test_interpolated_numeric_with_precision.txt new file mode 100644 index 0000000..8ab410d --- /dev/null +++ b/tests/snippets/praat/test_interpolated_numeric_with_precision.txt @@ -0,0 +1,6 @@ +---input--- +'a:3' + +---tokens--- +"'a:3'" Literal.String.Interpol +'\n' Text.Whitespace diff --git a/tests/snippets/praat/test_interpolated_string_hash.txt b/tests/snippets/praat/test_interpolated_string_hash.txt new file mode 100644 index 0000000..49f5147 --- /dev/null +++ b/tests/snippets/praat/test_interpolated_string_hash.txt @@ -0,0 +1,6 @@ +---input--- +'a$["b"]' + +---tokens--- +'\'a$["b"]\'' Literal.String.Interpol +'\n' Text.Whitespace diff --git a/tests/snippets/praat/test_interpolated_string_indexed.txt b/tests/snippets/praat/test_interpolated_string_indexed.txt new file mode 100644 index 0000000..7a845d7 --- /dev/null +++ b/tests/snippets/praat/test_interpolated_string_indexed.txt @@ -0,0 +1,6 @@ +---input--- +'a$[3]' + +---tokens--- +"'a$[3]'" Literal.String.Interpol +'\n' Text.Whitespace diff --git a/tests/snippets/praat/test_interpolation_boundary.txt b/tests/snippets/praat/test_interpolation_boundary.txt new file mode 100644 index 0000000..1f3b14b --- /dev/null +++ b/tests/snippets/praat/test_interpolation_boundary.txt @@ -0,0 +1,14 @@ +---input--- +"'" + "'" + +---tokens--- +'"' Literal.String +"'" Literal.String +'"' Literal.String +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'"' Literal.String +"'" Literal.String +'"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/praat/test_numeric_assignment.txt b/tests/snippets/praat/test_numeric_assignment.txt new file mode 100644 index 0000000..55fc1e6 --- /dev/null +++ b/tests/snippets/praat/test_numeric_assignment.txt @@ -0,0 +1,11 @@ +---input--- +var = -15e4 + +---tokens--- +'var' Text +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'-' Operator +'15e4' Literal.Number +'\n' Text.Whitespace diff --git a/tests/snippets/praat/test_string_assignment.txt b/tests/snippets/praat/test_string_assignment.txt new file mode 100644 index 0000000..baff23d --- /dev/null +++ b/tests/snippets/praat/test_string_assignment.txt @@ -0,0 +1,12 @@ +---input--- +var$ = "foo" + +---tokens--- +'var$' Text +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"' Literal.String +'foo' Literal.String +'"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/praat/test_string_escaped_quotes.txt b/tests/snippets/praat/test_string_escaped_quotes.txt new file mode 100644 index 0000000..1cf6330 --- /dev/null +++ b/tests/snippets/praat/test_string_escaped_quotes.txt @@ -0,0 +1,13 @@ +---input--- +"it said ""foo""" + +---tokens--- +'"' Literal.String +'it said ' Literal.String +'"' Literal.String +'"' Literal.String +'foo' Literal.String +'"' Literal.String +'"' Literal.String +'"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/promql/test_complex_exp_single_quotes.txt b/tests/snippets/promql/test_complex_exp_single_quotes.txt new file mode 100644 index 0000000..cbbde3a --- /dev/null +++ b/tests/snippets/promql/test_complex_exp_single_quotes.txt @@ -0,0 +1,35 @@ +---input--- +(sum(rate(metric_test_app{app='turtle',proc='web'}[2m])) by(node)) + +---tokens--- +'(' Operator +'sum' Keyword +'(' Operator +'rate' Keyword.Reserved +'(' Operator +'metric_test_app' Name.Variable +'{' Punctuation +'app' Name.Label +'=' Operator +"'" Punctuation +'turtle' Literal.String +"'" Punctuation +',' Punctuation +'proc' Name.Label +'=' Operator +"'" Punctuation +'web' Literal.String +"'" Punctuation +'}' Punctuation +'[' Punctuation +'2m' Literal.String +']' Punctuation +')' Operator +')' Operator +' ' Text.Whitespace +'by' Keyword +'(' Operator +'node' Name.Variable +')' Operator +')' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/promql/test_expression_and_comment.txt b/tests/snippets/promql/test_expression_and_comment.txt new file mode 100644 index 0000000..3ee2bfa --- /dev/null +++ b/tests/snippets/promql/test_expression_and_comment.txt @@ -0,0 +1,15 @@ +---input--- +go_gc_duration_seconds{instance="localhost:9090"} # single comment + +---tokens--- +'go_gc_duration_seconds' Name.Variable +'{' Punctuation +'instance' Name.Label +'=' Operator +'"' Punctuation +'localhost:9090' Literal.String +'"' Punctuation +'}' Punctuation +' ' Text.Whitespace +'# single comment' Comment.Single +'\n' Text.Whitespace diff --git a/tests/snippets/promql/test_function_delta.txt b/tests/snippets/promql/test_function_delta.txt new file mode 100644 index 0000000..8b1f9b0 --- /dev/null +++ b/tests/snippets/promql/test_function_delta.txt @@ -0,0 +1,19 @@ +---input--- +delta(cpu_temp_celsius{host="zeus"}[2h]) + +---tokens--- +'delta' Keyword.Reserved +'(' Operator +'cpu_temp_celsius' Name.Variable +'{' Punctuation +'host' Name.Label +'=' Operator +'"' Punctuation +'zeus' Literal.String +'"' Punctuation +'}' Punctuation +'[' Punctuation +'2h' Literal.String +']' Punctuation +')' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/promql/test_function_multi_line.txt b/tests/snippets/promql/test_function_multi_line.txt new file mode 100644 index 0000000..31664cc --- /dev/null +++ b/tests/snippets/promql/test_function_multi_line.txt @@ -0,0 +1,80 @@ +---input--- +label_replace( + sum by (instance) ( + irate(node_disk_read_bytes_total[2m]) + ) / 1024 / 1024, + "device", + 'disk', + "instance", + ".*" +) + +---tokens--- +'label_replace' Keyword.Reserved +'(' Operator +'\n' Text.Whitespace + +' ' Text.Whitespace +'sum' Keyword +' ' Text.Whitespace +'by' Keyword +' ' Text.Whitespace +'(' Operator +'instance' Name.Variable +')' Operator +' ' Text.Whitespace +'(' Operator +'\n' Text.Whitespace + +' ' Text.Whitespace +'irate' Keyword.Reserved +'(' Operator +'node_disk_read_bytes_total' Name.Variable +'[' Punctuation +'2m' Literal.String +']' Punctuation +')' Operator +'\n' Text.Whitespace + +' ' Text.Whitespace +')' Operator +' ' Text.Whitespace +'/' Operator +' ' Text.Whitespace +'1024' Literal.Number.Integer +' ' Text.Whitespace +'/' Operator +' ' Text.Whitespace +'1024' Literal.Number.Integer +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'"' Punctuation +'device' Literal.String +'"' Punctuation +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +"'" Punctuation +'disk' Literal.String +"'" Punctuation +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'"' Punctuation +'instance' Literal.String +'"' Punctuation +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'"' Punctuation +'.*' Literal.String +'"' Punctuation +'\n' Text.Whitespace + +')' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/promql/test_function_multi_line_with_offset.txt b/tests/snippets/promql/test_function_multi_line_with_offset.txt new file mode 100644 index 0000000..a7462fb --- /dev/null +++ b/tests/snippets/promql/test_function_multi_line_with_offset.txt @@ -0,0 +1,87 @@ +---input--- +label_replace( + avg by(instance) + (irate(node_cpu_seconds_total{mode = "idle"}[5m] offset 3s) + ) * 100, + "device", + "cpu", + "instance", + ".*" +) + +---tokens--- +'label_replace' Keyword.Reserved +'(' Operator +'\n' Text.Whitespace + +' ' Text.Whitespace +'avg' Keyword +' ' Text.Whitespace +'by' Keyword +'(' Operator +'instance' Name.Variable +')' Operator +'\n' Text.Whitespace + +' ' Text.Whitespace +'(' Operator +'irate' Keyword.Reserved +'(' Operator +'node_cpu_seconds_total' Name.Variable +'{' Punctuation +'mode' Name.Label +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"' Punctuation +'idle' Literal.String +'"' Punctuation +'}' Punctuation +'[' Punctuation +'5m' Literal.String +']' Punctuation +' ' Text.Whitespace +'offset' Keyword +' ' Text.Whitespace +'3s' Literal.String +')' Operator +'\n' Text.Whitespace + +' ' Text.Whitespace +')' Operator +' ' Text.Whitespace +'*' Operator +' ' Text.Whitespace +'100' Literal.Number.Integer +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'"' Punctuation +'device' Literal.String +'"' Punctuation +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'"' Punctuation +'cpu' Literal.String +'"' Punctuation +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'"' Punctuation +'instance' Literal.String +'"' Punctuation +',' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'"' Punctuation +'.*' Literal.String +'"' Punctuation +'\n' Text.Whitespace + +')' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/promql/test_function_sum_with_args.txt b/tests/snippets/promql/test_function_sum_with_args.txt new file mode 100644 index 0000000..3d677e1 --- /dev/null +++ b/tests/snippets/promql/test_function_sum_with_args.txt @@ -0,0 +1,19 @@ +---input--- +sum by (app, proc) (instance_memory_usage_bytes) + +---tokens--- +'sum' Keyword +' ' Text.Whitespace +'by' Keyword +' ' Text.Whitespace +'(' Operator +'app' Name.Variable +',' Punctuation +' ' Text.Whitespace +'proc' Name.Variable +')' Operator +' ' Text.Whitespace +'(' Operator +'instance_memory_usage_bytes' Name.Variable +')' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/promql/test_matching_operator_no_regex_match.txt b/tests/snippets/promql/test_matching_operator_no_regex_match.txt new file mode 100644 index 0000000..9859739 --- /dev/null +++ b/tests/snippets/promql/test_matching_operator_no_regex_match.txt @@ -0,0 +1,16 @@ +---input--- +metric_test_app{status!~'(4|5)..'}[2m] + +---tokens--- +'metric_test_app' Name.Variable +'{' Punctuation +'status' Name.Label +'!~' Operator +"'" Punctuation +'(4|5)..' Literal.String +"'" Punctuation +'}' Punctuation +'[' Punctuation +'2m' Literal.String +']' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/promql/test_metric.txt b/tests/snippets/promql/test_metric.txt new file mode 100644 index 0000000..e4889cf --- /dev/null +++ b/tests/snippets/promql/test_metric.txt @@ -0,0 +1,6 @@ +---input--- +go_gc_duration_seconds + +---tokens--- +'go_gc_duration_seconds' Name.Variable +'\n' Text.Whitespace diff --git a/tests/snippets/promql/test_metric_multiple_labels.txt b/tests/snippets/promql/test_metric_multiple_labels.txt new file mode 100644 index 0000000..bcb0b64 --- /dev/null +++ b/tests/snippets/promql/test_metric_multiple_labels.txt @@ -0,0 +1,19 @@ +---input--- +go_gc_duration_seconds{instance="localhost:9090",job="alertmanager"} + +---tokens--- +'go_gc_duration_seconds' Name.Variable +'{' Punctuation +'instance' Name.Label +'=' Operator +'"' Punctuation +'localhost:9090' Literal.String +'"' Punctuation +',' Punctuation +'job' Name.Label +'=' Operator +'"' Punctuation +'alertmanager' Literal.String +'"' Punctuation +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/promql/test_metric_multiple_labels_with_spaces.txt b/tests/snippets/promql/test_metric_multiple_labels_with_spaces.txt new file mode 100644 index 0000000..3ca3d49 --- /dev/null +++ b/tests/snippets/promql/test_metric_multiple_labels_with_spaces.txt @@ -0,0 +1,22 @@ +---input--- +go_gc_duration_seconds{ instance="localhost:9090", job="alertmanager" } + +---tokens--- +'go_gc_duration_seconds' Name.Variable +'{' Punctuation +' ' Text.Whitespace +'instance' Name.Label +'=' Operator +'"' Punctuation +'localhost:9090' Literal.String +'"' Punctuation +',' Punctuation +' ' Text.Whitespace +'job' Name.Label +'=' Operator +'"' Punctuation +'alertmanager' Literal.String +'"' Punctuation +' ' Text.Whitespace +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/promql/test_metric_one_label.txt b/tests/snippets/promql/test_metric_one_label.txt new file mode 100644 index 0000000..8baeafb --- /dev/null +++ b/tests/snippets/promql/test_metric_one_label.txt @@ -0,0 +1,13 @@ +---input--- +go_gc_duration_seconds{instance="localhost:9090"} + +---tokens--- +'go_gc_duration_seconds' Name.Variable +'{' Punctuation +'instance' Name.Label +'=' Operator +'"' Punctuation +'localhost:9090' Literal.String +'"' Punctuation +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/properties/test_comments.txt b/tests/snippets/properties/test_comments.txt new file mode 100644 index 0000000..9bc6586 --- /dev/null +++ b/tests/snippets/properties/test_comments.txt @@ -0,0 +1,12 @@ +# Assures lines lead by either # or ! are recognized as a comment + +---input--- +! a comment +# also a comment + +---tokens--- +'! a comment' Comment.Single +'\n' Text.Whitespace + +'# also a comment' Comment.Single +'\n' Text.Whitespace diff --git a/tests/snippets/properties/test_escaped_space_in_key.txt b/tests/snippets/properties/test_escaped_space_in_key.txt new file mode 100644 index 0000000..eef0292 --- /dev/null +++ b/tests/snippets/properties/test_escaped_space_in_key.txt @@ -0,0 +1,10 @@ +---input--- +key = value + +---tokens--- +'key' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'value' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/properties/test_escaped_space_in_value.txt b/tests/snippets/properties/test_escaped_space_in_value.txt new file mode 100644 index 0000000..f76507f --- /dev/null +++ b/tests/snippets/properties/test_escaped_space_in_value.txt @@ -0,0 +1,10 @@ +---input--- +key = doubleword\ value + +---tokens--- +'key' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'doubleword\\ value' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/properties/test_just_key.txt b/tests/snippets/properties/test_just_key.txt new file mode 100644 index 0000000..2665239 --- /dev/null +++ b/tests/snippets/properties/test_just_key.txt @@ -0,0 +1,6 @@ +---input--- +justkey + +---tokens--- +'justkey' Name.Attribute +'\n' Text.Whitespace diff --git a/tests/snippets/properties/test_just_key_with_space.txt b/tests/snippets/properties/test_just_key_with_space.txt new file mode 100644 index 0000000..660c37c --- /dev/null +++ b/tests/snippets/properties/test_just_key_with_space.txt @@ -0,0 +1,6 @@ +---input--- +just\ key + +---tokens--- +'just\\ key' Name.Attribute +'\n' Text.Whitespace diff --git a/tests/snippets/properties/test_leading_whitespace_comments.txt b/tests/snippets/properties/test_leading_whitespace_comments.txt new file mode 100644 index 0000000..3a36afc --- /dev/null +++ b/tests/snippets/properties/test_leading_whitespace_comments.txt @@ -0,0 +1,6 @@ +---input--- +# comment + +---tokens--- +'# comment' Comment.Single +'\n' Text.Whitespace diff --git a/tests/snippets/properties/test_space_delimited_kv_pair.txt b/tests/snippets/properties/test_space_delimited_kv_pair.txt new file mode 100644 index 0000000..98961e4 --- /dev/null +++ b/tests/snippets/properties/test_space_delimited_kv_pair.txt @@ -0,0 +1,8 @@ +---input--- +key value + +---tokens--- +'key' Name.Attribute +' ' Text.Whitespace +'value' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/pwsh-session/test_continuation.txt b/tests/snippets/pwsh-session/test_continuation.txt new file mode 100644 index 0000000..4735d36 --- /dev/null +++ b/tests/snippets/pwsh-session/test_continuation.txt @@ -0,0 +1,124 @@ +---input--- +PS> python -m doctest ` +> -o DONT_ACCEPT_TRUE_FOR_1 ` +> -o ELLIPSIS options.txt + +PS> $Params = @{ +> Height = 50 +> Width = 50 +> Depth = 50 +> Name = 'My Widget' +> ID = '10dbe43f-0269-48b8-96cb-447a755add55' +> } + + +PS> ls | +> grep "python" + +---tokens--- +'PS> ' Generic.Prompt +'python' Name +' ' Text +'-m' Name +' ' Text +'doctest' Name +' ' Text +'`' Punctuation +'\n' Text + +'> ' Generic.Prompt +'-o' Name +' ' Text +'DONT_ACCEPT_TRUE_FOR_1' Name +' ' Text +'`' Punctuation +'\n' Text + +'> ' Generic.Prompt +'-o' Name +' ' Text +'ELLIPSIS' Name +' ' Text +'options' Name +'.' Punctuation +'txt' Name +'\n' Text + +'\n' Generic.Output + +'PS> ' Generic.Prompt +' ' Text +'$Params' Name.Variable +' ' Text +'=' Punctuation +' ' Text +'@' Punctuation +'{' Punctuation +'\n' Text + +'> ' Generic.Prompt +' ' Text +'Height' Name +' ' Text +'=' Punctuation +' ' Text +'50' Name +'\n' Text + +'> ' Generic.Prompt +' ' Text +'Width' Name +' ' Text +'=' Punctuation +' ' Text +'50' Name +'\n' Text + +'> ' Generic.Prompt +' ' Text +'Depth' Name +' ' Text +'=' Punctuation +' ' Text +'50' Name +'\n' Text + +'> ' Generic.Prompt +' ' Text +'Name' Name +' ' Text +'=' Punctuation +' ' Text +"'My Widget'" Literal.String.Single +'\n' Text + +'> ' Generic.Prompt +' ' Text +'ID' Name +' ' Text +'=' Punctuation +' ' Text +"'10dbe43f-0269-48b8-96cb-447a755add55'" Literal.String.Single +'\n' Text + +'> ' Generic.Prompt +'}' Punctuation +'\n' Text + +'\n' Generic.Output + +'\n' Generic.Output + +'PS> ' Generic.Prompt +' ' Text +'ls ' Name.Builtin +'|' Punctuation +'\n' Text + +'> ' Generic.Prompt +'grep' Name +' ' Text +'"' Literal.String.Double +'python' Literal.String.Double +'"' Literal.String.Double +'\n' Text diff --git a/tests/snippets/python/test_bytes_escape_codes.txt b/tests/snippets/python/test_bytes_escape_codes.txt new file mode 100644 index 0000000..c1a3443 --- /dev/null +++ b/tests/snippets/python/test_bytes_escape_codes.txt @@ -0,0 +1,24 @@ +---input--- +b'\\ \n \x12 \777 \u1234 \U00010348 \N{Plus-Minus Sign}' + +---tokens--- +'b' Literal.String.Affix +"'" Literal.String.Single +'\\\\' Literal.String.Escape +' ' Literal.String.Single +'\\n' Literal.String.Escape +' ' Literal.String.Single +'\\x12' Literal.String.Escape +' ' Literal.String.Single +'\\777' Literal.String.Escape +' ' Literal.String.Single +'\\' Literal.String.Single +'u1234 ' Literal.String.Single +'\\' Literal.String.Single +'U00010348 ' Literal.String.Single +'\\' Literal.String.Single +'N' Literal.String.Single +'{' Literal.String.Single +'Plus-Minus Sign}' Literal.String.Single +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_floats.txt b/tests/snippets/python/test_floats.txt new file mode 100644 index 0000000..3ae9dc9 --- /dev/null +++ b/tests/snippets/python/test_floats.txt @@ -0,0 +1,75 @@ +---input--- +123 -11 0 -0 0.5 .5 1. -0.5 +0.5 -.5 -1. 2e1 -2e1 2e -2e +2e e.3 -e.3 11.2e-3 -11.2e-3 5_6 5__6 _5 6_ 5.6_7 5.67_ + +---tokens--- +'123' Literal.Number.Integer +' ' Text +'-' Operator +'11' Literal.Number.Integer +' ' Text +'0' Literal.Number.Integer +' ' Text +'-' Operator +'0' Literal.Number.Integer +' ' Text +'0.5' Literal.Number.Float +' ' Text +'.5' Literal.Number.Float +' ' Text +'1.' Literal.Number.Float +' ' Text +'-' Operator +'0.5' Literal.Number.Float +' ' Text +'+' Operator +'0.5' Literal.Number.Float +' ' Text +'-' Operator +'.5' Literal.Number.Float +' ' Text +'-' Operator +'1.' Literal.Number.Float +' ' Text +'2e1' Literal.Number.Float +' ' Text +'-' Operator +'2e1' Literal.Number.Float +' ' Text +'2' Literal.Number.Integer +'e' Name +' ' Text +'-' Operator +'2' Literal.Number.Integer +'e' Name +' ' Text +'+' Operator +'2' Literal.Number.Integer +'e' Name +' ' Text +'e' Name +'.3' Literal.Number.Float +' ' Text +'-' Operator +'e' Name +'.3' Literal.Number.Float +' ' Text +'11.2e-3' Literal.Number.Float +' ' Text +'-' Operator +'11.2e-3' Literal.Number.Float +' ' Text +'5_6' Literal.Number.Integer +' ' Text +'5' Literal.Number.Integer +'__6' Name +' ' Text +'_5' Name +' ' Text +'6' Literal.Number.Integer +'_' Name +' ' Text +'5.6_7' Literal.Number.Float +' ' Text +'5.67' Literal.Number.Float +'_' Name +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_01a.txt b/tests/snippets/python/test_fstring_01a.txt new file mode 100644 index 0000000..a3b29a3 --- /dev/null +++ b/tests/snippets/python/test_fstring_01a.txt @@ -0,0 +1,25 @@ +---input--- +f'My name is {name}, my age next year is {age+1}, my anniversary is {anniversary:%A, %B %d, %Y}.' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'My name is ' Literal.String.Single +'{' Literal.String.Interpol +'name' Name +'}' Literal.String.Interpol +', my age next year is ' Literal.String.Single +'{' Literal.String.Interpol +'age' Name +'+' Operator +'1' Literal.Number.Integer +'}' Literal.String.Interpol +', my anniversary is ' Literal.String.Single +'{' Literal.String.Interpol +'anniversary' Name +':' Literal.String.Interpol +'%A, %B %d, %Y' Literal.String.Single +'}' Literal.String.Interpol +'.' Literal.String.Single +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_01b.txt b/tests/snippets/python/test_fstring_01b.txt new file mode 100644 index 0000000..0d2c343 --- /dev/null +++ b/tests/snippets/python/test_fstring_01b.txt @@ -0,0 +1,25 @@ +---input--- +f"My name is {name}, my age next year is {age+1}, my anniversary is {anniversary:%A, %B %d, %Y}." + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'My name is ' Literal.String.Double +'{' Literal.String.Interpol +'name' Name +'}' Literal.String.Interpol +', my age next year is ' Literal.String.Double +'{' Literal.String.Interpol +'age' Name +'+' Operator +'1' Literal.Number.Integer +'}' Literal.String.Interpol +', my anniversary is ' Literal.String.Double +'{' Literal.String.Interpol +'anniversary' Name +':' Literal.String.Interpol +'%A, %B %d, %Y' Literal.String.Double +'}' Literal.String.Interpol +'.' Literal.String.Double +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_02a.txt b/tests/snippets/python/test_fstring_02a.txt new file mode 100644 index 0000000..cfd41a9 --- /dev/null +++ b/tests/snippets/python/test_fstring_02a.txt @@ -0,0 +1,13 @@ +---input--- +f'He said his name is {name!r}.' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'He said his name is ' Literal.String.Single +'{' Literal.String.Interpol +'name' Name +'!r}' Literal.String.Interpol +'.' Literal.String.Single +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_02b.txt b/tests/snippets/python/test_fstring_02b.txt new file mode 100644 index 0000000..c72a77b --- /dev/null +++ b/tests/snippets/python/test_fstring_02b.txt @@ -0,0 +1,13 @@ +---input--- +f"He said his name is {name!r}." + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'He said his name is ' Literal.String.Double +'{' Literal.String.Interpol +'name' Name +'!r}' Literal.String.Interpol +'.' Literal.String.Double +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_03a.txt b/tests/snippets/python/test_fstring_03a.txt new file mode 100644 index 0000000..366e495 --- /dev/null +++ b/tests/snippets/python/test_fstring_03a.txt @@ -0,0 +1,14 @@ +---input--- +f'input={value:#06x}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'input=' Literal.String.Single +'{' Literal.String.Interpol +'value' Name +':' Literal.String.Interpol +'#06x' Literal.String.Single +'}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_03b.txt b/tests/snippets/python/test_fstring_03b.txt new file mode 100644 index 0000000..260e56d --- /dev/null +++ b/tests/snippets/python/test_fstring_03b.txt @@ -0,0 +1,14 @@ +---input--- +f"input={value:#06x}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'input=' Literal.String.Double +'{' Literal.String.Interpol +'value' Name +':' Literal.String.Interpol +'#06x' Literal.String.Double +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_04a.txt b/tests/snippets/python/test_fstring_04a.txt new file mode 100644 index 0000000..58516c9 --- /dev/null +++ b/tests/snippets/python/test_fstring_04a.txt @@ -0,0 +1,13 @@ +---input--- +f'{"quoted string"}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'"' Literal.String.Double +'quoted string' Literal.String.Double +'"' Literal.String.Double +'}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_04b.txt b/tests/snippets/python/test_fstring_04b.txt new file mode 100644 index 0000000..40e1ea0 --- /dev/null +++ b/tests/snippets/python/test_fstring_04b.txt @@ -0,0 +1,13 @@ +---input--- +f"{'quoted string'}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +"'" Literal.String.Single +'quoted string' Literal.String.Single +"'" Literal.String.Single +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_05a.txt b/tests/snippets/python/test_fstring_05a.txt new file mode 100644 index 0000000..77a5c10 --- /dev/null +++ b/tests/snippets/python/test_fstring_05a.txt @@ -0,0 +1,16 @@ +---input--- +f'{f"{inner}"}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +'inner' Name +'}' Literal.String.Interpol +'"' Literal.String.Double +'}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_05b.txt b/tests/snippets/python/test_fstring_05b.txt new file mode 100644 index 0000000..9a0dc5a --- /dev/null +++ b/tests/snippets/python/test_fstring_05b.txt @@ -0,0 +1,16 @@ +---input--- +f"{f'{inner}'}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'inner' Name +'}' Literal.String.Interpol +"'" Literal.String.Single +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_06a.txt b/tests/snippets/python/test_fstring_06a.txt new file mode 100644 index 0000000..b8b33c0 --- /dev/null +++ b/tests/snippets/python/test_fstring_06a.txt @@ -0,0 +1,16 @@ +# SyntaxError: f-string expression part cannot include a backslash + +---input--- +f'{\'quoted string\'}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'\\' Error +"'" Literal.String.Single +'quoted string' Literal.String.Single +"\\'" Literal.String.Escape +'}' Literal.String.Single +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_06b.txt b/tests/snippets/python/test_fstring_06b.txt new file mode 100644 index 0000000..0712321 --- /dev/null +++ b/tests/snippets/python/test_fstring_06b.txt @@ -0,0 +1,16 @@ +# SyntaxError: f-string expression part cannot include a backslash + +---input--- +f"{\"quoted string\"}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +'\\' Error +'"' Literal.String.Double +'quoted string' Literal.String.Double +'\\"' Literal.String.Escape +'}' Literal.String.Double +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_07a.txt b/tests/snippets/python/test_fstring_07a.txt new file mode 100644 index 0000000..c597ea9 --- /dev/null +++ b/tests/snippets/python/test_fstring_07a.txt @@ -0,0 +1,17 @@ +---input--- +f'{{ {4*10} }}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'{{' Literal.String.Escape +' ' Literal.String.Single +'{' Literal.String.Interpol +'4' Literal.Number.Integer +'*' Operator +'10' Literal.Number.Integer +'}' Literal.String.Interpol +' ' Literal.String.Single +'}}' Literal.String.Escape +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_07b.txt b/tests/snippets/python/test_fstring_07b.txt new file mode 100644 index 0000000..413c158 --- /dev/null +++ b/tests/snippets/python/test_fstring_07b.txt @@ -0,0 +1,17 @@ +---input--- +f"{{ {4*10} }}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'{{' Literal.String.Escape +' ' Literal.String.Double +'{' Literal.String.Interpol +'4' Literal.Number.Integer +'*' Operator +'10' Literal.Number.Integer +'}' Literal.String.Interpol +' ' Literal.String.Double +'}}' Literal.String.Escape +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_08a.txt b/tests/snippets/python/test_fstring_08a.txt new file mode 100644 index 0000000..39dd887 --- /dev/null +++ b/tests/snippets/python/test_fstring_08a.txt @@ -0,0 +1,15 @@ +---input--- +f'{{{4*10}}}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'{{' Literal.String.Escape +'{' Literal.String.Interpol +'4' Literal.Number.Integer +'*' Operator +'10' Literal.Number.Integer +'}' Literal.String.Interpol +'}}' Literal.String.Escape +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_08b.txt b/tests/snippets/python/test_fstring_08b.txt new file mode 100644 index 0000000..458c697 --- /dev/null +++ b/tests/snippets/python/test_fstring_08b.txt @@ -0,0 +1,15 @@ +---input--- +f"{{{4*10}}}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'{{' Literal.String.Escape +'{' Literal.String.Interpol +'4' Literal.Number.Integer +'*' Operator +'10' Literal.Number.Integer +'}' Literal.String.Interpol +'}}' Literal.String.Escape +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_09a.txt b/tests/snippets/python/test_fstring_09a.txt new file mode 100644 index 0000000..00f3e7f --- /dev/null +++ b/tests/snippets/python/test_fstring_09a.txt @@ -0,0 +1,14 @@ +---input--- +fr'x={4*10}' + +---tokens--- +'fr' Literal.String.Affix +"'" Literal.String.Single +'x=' Literal.String.Single +'{' Literal.String.Interpol +'4' Literal.Number.Integer +'*' Operator +'10' Literal.Number.Integer +'}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_09b.txt b/tests/snippets/python/test_fstring_09b.txt new file mode 100644 index 0000000..01d74e9 --- /dev/null +++ b/tests/snippets/python/test_fstring_09b.txt @@ -0,0 +1,14 @@ +---input--- +fr"x={4*10}" + +---tokens--- +'fr' Literal.String.Affix +'"' Literal.String.Double +'x=' Literal.String.Double +'{' Literal.String.Interpol +'4' Literal.Number.Integer +'*' Operator +'10' Literal.Number.Integer +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_10a.txt b/tests/snippets/python/test_fstring_10a.txt new file mode 100644 index 0000000..a2e11ba --- /dev/null +++ b/tests/snippets/python/test_fstring_10a.txt @@ -0,0 +1,18 @@ +---input--- +f'abc {a["x"]} def' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'abc ' Literal.String.Single +'{' Literal.String.Interpol +'a' Name +'[' Punctuation +'"' Literal.String.Double +'x' Literal.String.Double +'"' Literal.String.Double +']' Punctuation +'}' Literal.String.Interpol +' def' Literal.String.Single +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_10b.txt b/tests/snippets/python/test_fstring_10b.txt new file mode 100644 index 0000000..21d116c --- /dev/null +++ b/tests/snippets/python/test_fstring_10b.txt @@ -0,0 +1,18 @@ +---input--- +f"abc {a['x']} def" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'abc ' Literal.String.Double +'{' Literal.String.Interpol +'a' Name +'[' Punctuation +"'" Literal.String.Single +'x' Literal.String.Single +"'" Literal.String.Single +']' Punctuation +'}' Literal.String.Interpol +' def' Literal.String.Double +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_11a.txt b/tests/snippets/python/test_fstring_11a.txt new file mode 100644 index 0000000..ce20e7b --- /dev/null +++ b/tests/snippets/python/test_fstring_11a.txt @@ -0,0 +1,18 @@ +---input--- +f'''abc {a['x']} def''' + +---tokens--- +'f' Literal.String.Affix +"'''" Literal.String.Single +'abc ' Literal.String.Single +'{' Literal.String.Interpol +'a' Name +'[' Punctuation +"'" Literal.String.Single +'x' Literal.String.Single +"'" Literal.String.Single +']' Punctuation +'}' Literal.String.Interpol +' def' Literal.String.Single +"'''" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_11b.txt b/tests/snippets/python/test_fstring_11b.txt new file mode 100644 index 0000000..baf1370 --- /dev/null +++ b/tests/snippets/python/test_fstring_11b.txt @@ -0,0 +1,18 @@ +---input--- +f"""abc {a["x"]} def""" + +---tokens--- +'f' Literal.String.Affix +'"""' Literal.String.Double +'abc ' Literal.String.Double +'{' Literal.String.Interpol +'a' Name +'[' Punctuation +'"' Literal.String.Double +'x' Literal.String.Double +'"' Literal.String.Double +']' Punctuation +'}' Literal.String.Interpol +' def' Literal.String.Double +'"""' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_12a.txt b/tests/snippets/python/test_fstring_12a.txt new file mode 100644 index 0000000..9988804 --- /dev/null +++ b/tests/snippets/python/test_fstring_12a.txt @@ -0,0 +1,16 @@ +---input--- +f'''{x ++1}''' + +---tokens--- +'f' Literal.String.Affix +"'''" Literal.String.Single +'{' Literal.String.Interpol +'x' Name +'\n' Text.Whitespace + +'+' Operator +'1' Literal.Number.Integer +'}' Literal.String.Interpol +"'''" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_12b.txt b/tests/snippets/python/test_fstring_12b.txt new file mode 100644 index 0000000..878b7a0 --- /dev/null +++ b/tests/snippets/python/test_fstring_12b.txt @@ -0,0 +1,16 @@ +---input--- +f"""{x ++1}""" + +---tokens--- +'f' Literal.String.Affix +'"""' Literal.String.Double +'{' Literal.String.Interpol +'x' Name +'\n' Text.Whitespace + +'+' Operator +'1' Literal.Number.Integer +'}' Literal.String.Interpol +'"""' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_13a.txt b/tests/snippets/python/test_fstring_13a.txt new file mode 100644 index 0000000..e6e97e8 --- /dev/null +++ b/tests/snippets/python/test_fstring_13a.txt @@ -0,0 +1,17 @@ +---input--- +f'''{d[0 +]}''' + +---tokens--- +'f' Literal.String.Affix +"'''" Literal.String.Single +'{' Literal.String.Interpol +'d' Name +'[' Punctuation +'0' Literal.Number.Integer +'\n' Text.Whitespace + +']' Punctuation +'}' Literal.String.Interpol +"'''" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_13b.txt b/tests/snippets/python/test_fstring_13b.txt new file mode 100644 index 0000000..0a3aa56 --- /dev/null +++ b/tests/snippets/python/test_fstring_13b.txt @@ -0,0 +1,17 @@ +---input--- +f"""{d[0 +]}""" + +---tokens--- +'f' Literal.String.Affix +'"""' Literal.String.Double +'{' Literal.String.Interpol +'d' Name +'[' Punctuation +'0' Literal.Number.Integer +'\n' Text.Whitespace + +']' Punctuation +'}' Literal.String.Interpol +'"""' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_14a.txt b/tests/snippets/python/test_fstring_14a.txt new file mode 100644 index 0000000..a826835 --- /dev/null +++ b/tests/snippets/python/test_fstring_14a.txt @@ -0,0 +1,20 @@ +---input--- +f'result: {value:{width}.{precision}}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'result: ' Literal.String.Single +'{' Literal.String.Interpol +'value' Name +':' Literal.String.Interpol +'{' Literal.String.Interpol +'width' Name +'}' Literal.String.Interpol +'.' Literal.String.Single +'{' Literal.String.Interpol +'precision' Name +'}' Literal.String.Interpol +'}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_14b.txt b/tests/snippets/python/test_fstring_14b.txt new file mode 100644 index 0000000..3100883 --- /dev/null +++ b/tests/snippets/python/test_fstring_14b.txt @@ -0,0 +1,20 @@ +---input--- +f"result: {value:{width}.{precision}}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'result: ' Literal.String.Double +'{' Literal.String.Interpol +'value' Name +':' Literal.String.Interpol +'{' Literal.String.Interpol +'width' Name +'}' Literal.String.Interpol +'.' Literal.String.Double +'{' Literal.String.Interpol +'precision' Name +'}' Literal.String.Interpol +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_15a.txt b/tests/snippets/python/test_fstring_15a.txt new file mode 100644 index 0000000..f8f62b8 --- /dev/null +++ b/tests/snippets/python/test_fstring_15a.txt @@ -0,0 +1,42 @@ +---input--- +'a' 'b' f'{x}' '{c}' f'str<{y:^4}>' 'd' 'e' + +---tokens--- +"'" Literal.String.Single +'a' Literal.String.Single +"'" Literal.String.Single +' ' Text +"'" Literal.String.Single +'b' Literal.String.Single +"'" Literal.String.Single +' ' Text +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'x' Name +'}' Literal.String.Interpol +"'" Literal.String.Single +' ' Text +"'" Literal.String.Single +'{c}' Literal.String.Interpol +"'" Literal.String.Single +' ' Text +'f' Literal.String.Affix +"'" Literal.String.Single +'str<' Literal.String.Single +'{' Literal.String.Interpol +'y' Name +':' Literal.String.Interpol +'^4' Literal.String.Single +'}' Literal.String.Interpol +'>' Literal.String.Single +"'" Literal.String.Single +' ' Text +"'" Literal.String.Single +'d' Literal.String.Single +"'" Literal.String.Single +' ' Text +"'" Literal.String.Single +'e' Literal.String.Single +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_15b.txt b/tests/snippets/python/test_fstring_15b.txt new file mode 100644 index 0000000..7b5307c --- /dev/null +++ b/tests/snippets/python/test_fstring_15b.txt @@ -0,0 +1,42 @@ +---input--- +"a" "b" f"{x}" "{c}" f"str<{y:^4}>" "d" "e" + +---tokens--- +'"' Literal.String.Double +'a' Literal.String.Double +'"' Literal.String.Double +' ' Text +'"' Literal.String.Double +'b' Literal.String.Double +'"' Literal.String.Double +' ' Text +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +'x' Name +'}' Literal.String.Interpol +'"' Literal.String.Double +' ' Text +'"' Literal.String.Double +'{c}' Literal.String.Interpol +'"' Literal.String.Double +' ' Text +'f' Literal.String.Affix +'"' Literal.String.Double +'str<' Literal.String.Double +'{' Literal.String.Interpol +'y' Name +':' Literal.String.Interpol +'^4' Literal.String.Double +'}' Literal.String.Interpol +'>' Literal.String.Double +'"' Literal.String.Double +' ' Text +'"' Literal.String.Double +'d' Literal.String.Double +'"' Literal.String.Double +' ' Text +'"' Literal.String.Double +'e' Literal.String.Double +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_16a.txt b/tests/snippets/python/test_fstring_16a.txt new file mode 100644 index 0000000..15b11e8 --- /dev/null +++ b/tests/snippets/python/test_fstring_16a.txt @@ -0,0 +1,18 @@ +---input--- +f'{i}:{d[i]}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'i' Name +'}' Literal.String.Interpol +':' Literal.String.Single +'{' Literal.String.Interpol +'d' Name +'[' Punctuation +'i' Name +']' Punctuation +'}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_16b.txt b/tests/snippets/python/test_fstring_16b.txt new file mode 100644 index 0000000..e917516 --- /dev/null +++ b/tests/snippets/python/test_fstring_16b.txt @@ -0,0 +1,18 @@ +---input--- +f"{i}:{d[i]}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +'i' Name +'}' Literal.String.Interpol +':' Literal.String.Double +'{' Literal.String.Interpol +'d' Name +'[' Punctuation +'i' Name +']' Punctuation +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_17a.txt b/tests/snippets/python/test_fstring_17a.txt new file mode 100644 index 0000000..9eefd91 --- /dev/null +++ b/tests/snippets/python/test_fstring_17a.txt @@ -0,0 +1,14 @@ +---input--- +f'x = {x:+3}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'x = ' Literal.String.Single +'{' Literal.String.Interpol +'x' Name +':' Literal.String.Interpol +'+3' Literal.String.Single +'}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_17b.txt b/tests/snippets/python/test_fstring_17b.txt new file mode 100644 index 0000000..2d26481 --- /dev/null +++ b/tests/snippets/python/test_fstring_17b.txt @@ -0,0 +1,14 @@ +---input--- +f"x = {x:+3}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'x = ' Literal.String.Double +'{' Literal.String.Interpol +'x' Name +':' Literal.String.Interpol +'+3' Literal.String.Double +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_18a.txt b/tests/snippets/python/test_fstring_18a.txt new file mode 100644 index 0000000..5455db7 --- /dev/null +++ b/tests/snippets/python/test_fstring_18a.txt @@ -0,0 +1,25 @@ +---input--- +f'{fn(lst,2)} {fn(lst,3)}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'fn' Name +'(' Punctuation +'lst' Name +',' Punctuation +'2' Literal.Number.Integer +')' Punctuation +'}' Literal.String.Interpol +' ' Literal.String.Single +'{' Literal.String.Interpol +'fn' Name +'(' Punctuation +'lst' Name +',' Punctuation +'3' Literal.Number.Integer +')' Punctuation +'}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_18b.txt b/tests/snippets/python/test_fstring_18b.txt new file mode 100644 index 0000000..356cc3c --- /dev/null +++ b/tests/snippets/python/test_fstring_18b.txt @@ -0,0 +1,25 @@ +---input--- +f"{fn(lst,2)} {fn(lst,3)}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +'fn' Name +'(' Punctuation +'lst' Name +',' Punctuation +'2' Literal.Number.Integer +')' Punctuation +'}' Literal.String.Interpol +' ' Literal.String.Double +'{' Literal.String.Interpol +'fn' Name +'(' Punctuation +'lst' Name +',' Punctuation +'3' Literal.Number.Integer +')' Punctuation +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_19a.txt b/tests/snippets/python/test_fstring_19a.txt new file mode 100644 index 0000000..7e7cde0 --- /dev/null +++ b/tests/snippets/python/test_fstring_19a.txt @@ -0,0 +1,46 @@ +---input--- +f'mapping is { {a:b for (a, b) in ((1, 2), (3, 4))} }' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'mapping is ' Literal.String.Single +'{' Literal.String.Interpol +' ' Text.Whitespace +'{' Punctuation +'a' Name +':' Punctuation +'b' Name +' ' Text.Whitespace +'for' Keyword +' ' Text.Whitespace +'(' Punctuation +'a' Name +',' Punctuation +' ' Text.Whitespace +'b' Name +')' Punctuation +' ' Text.Whitespace +'in' Operator.Word +' ' Text.Whitespace +'(' Punctuation +'(' Punctuation +'1' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'2' Literal.Number.Integer +')' Punctuation +',' Punctuation +' ' Text.Whitespace +'(' Punctuation +'3' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'4' Literal.Number.Integer +')' Punctuation +')' Punctuation +'}' Punctuation +' ' Text.Whitespace +'}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_19b.txt b/tests/snippets/python/test_fstring_19b.txt new file mode 100644 index 0000000..3ae438a --- /dev/null +++ b/tests/snippets/python/test_fstring_19b.txt @@ -0,0 +1,46 @@ +---input--- +f"mapping is { {a:b for (a, b) in ((1, 2), (3, 4))} }" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'mapping is ' Literal.String.Double +'{' Literal.String.Interpol +' ' Text.Whitespace +'{' Punctuation +'a' Name +':' Punctuation +'b' Name +' ' Text.Whitespace +'for' Keyword +' ' Text.Whitespace +'(' Punctuation +'a' Name +',' Punctuation +' ' Text.Whitespace +'b' Name +')' Punctuation +' ' Text.Whitespace +'in' Operator.Word +' ' Text.Whitespace +'(' Punctuation +'(' Punctuation +'1' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'2' Literal.Number.Integer +')' Punctuation +',' Punctuation +' ' Text.Whitespace +'(' Punctuation +'3' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'4' Literal.Number.Integer +')' Punctuation +')' Punctuation +'}' Punctuation +' ' Text.Whitespace +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_20a.txt b/tests/snippets/python/test_fstring_20a.txt new file mode 100644 index 0000000..206e436 --- /dev/null +++ b/tests/snippets/python/test_fstring_20a.txt @@ -0,0 +1,17 @@ +---input--- +f'a={d["a"]}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'a=' Literal.String.Single +'{' Literal.String.Interpol +'d' Name +'[' Punctuation +'"' Literal.String.Double +'a' Literal.String.Double +'"' Literal.String.Double +']' Punctuation +'}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_20b.txt b/tests/snippets/python/test_fstring_20b.txt new file mode 100644 index 0000000..fb3acc4 --- /dev/null +++ b/tests/snippets/python/test_fstring_20b.txt @@ -0,0 +1,17 @@ +---input--- +f"a={d['a']}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'a=' Literal.String.Double +'{' Literal.String.Interpol +'d' Name +'[' Punctuation +"'" Literal.String.Single +'a' Literal.String.Single +"'" Literal.String.Single +']' Punctuation +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_21a.txt b/tests/snippets/python/test_fstring_21a.txt new file mode 100644 index 0000000..0107431 --- /dev/null +++ b/tests/snippets/python/test_fstring_21a.txt @@ -0,0 +1,15 @@ +---input--- +f'a={d[a]}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'a=' Literal.String.Single +'{' Literal.String.Interpol +'d' Name +'[' Punctuation +'a' Name +']' Punctuation +'}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_21b.txt b/tests/snippets/python/test_fstring_21b.txt new file mode 100644 index 0000000..f659d54 --- /dev/null +++ b/tests/snippets/python/test_fstring_21b.txt @@ -0,0 +1,15 @@ +---input--- +f"a={d[a]}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'a=' Literal.String.Double +'{' Literal.String.Interpol +'d' Name +'[' Punctuation +'a' Name +']' Punctuation +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_22a.txt b/tests/snippets/python/test_fstring_22a.txt new file mode 100644 index 0000000..a1066e9 --- /dev/null +++ b/tests/snippets/python/test_fstring_22a.txt @@ -0,0 +1,14 @@ +---input--- +fr'{header}:\s+' + +---tokens--- +'fr' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'header' Name +'}' Literal.String.Interpol +':' Literal.String.Single +'\\' Literal.String.Single +'s+' Literal.String.Single +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_22b.txt b/tests/snippets/python/test_fstring_22b.txt new file mode 100644 index 0000000..79cb6b4 --- /dev/null +++ b/tests/snippets/python/test_fstring_22b.txt @@ -0,0 +1,14 @@ +---input--- +fr"{header}:\s+" + +---tokens--- +'fr' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +'header' Name +'}' Literal.String.Interpol +':' Literal.String.Double +'\\' Literal.String.Double +'s+' Literal.String.Double +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_23a.txt b/tests/snippets/python/test_fstring_23a.txt new file mode 100644 index 0000000..ef5cbd4 --- /dev/null +++ b/tests/snippets/python/test_fstring_23a.txt @@ -0,0 +1,11 @@ +---input--- +f'{a!r}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'a' Name +'!r}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_23b.txt b/tests/snippets/python/test_fstring_23b.txt new file mode 100644 index 0000000..572fe04 --- /dev/null +++ b/tests/snippets/python/test_fstring_23b.txt @@ -0,0 +1,11 @@ +---input--- +f"{a!r}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +'a' Name +'!r}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_24a.txt b/tests/snippets/python/test_fstring_24a.txt new file mode 100644 index 0000000..d45385b --- /dev/null +++ b/tests/snippets/python/test_fstring_24a.txt @@ -0,0 +1,23 @@ +---input--- +f'{(lambda x: x*2)(3)}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'(' Punctuation +'lambda' Keyword +' ' Text.Whitespace +'x' Name +':' Punctuation +' ' Text.Whitespace +'x' Name +'*' Operator +'2' Literal.Number.Integer +')' Punctuation +'(' Punctuation +'3' Literal.Number.Integer +')' Punctuation +'}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_24b.txt b/tests/snippets/python/test_fstring_24b.txt new file mode 100644 index 0000000..5e83b19 --- /dev/null +++ b/tests/snippets/python/test_fstring_24b.txt @@ -0,0 +1,23 @@ +---input--- +f"{(lambda x: x*2)(3)}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +'(' Punctuation +'lambda' Keyword +' ' Text.Whitespace +'x' Name +':' Punctuation +' ' Text.Whitespace +'x' Name +'*' Operator +'2' Literal.Number.Integer +')' Punctuation +'(' Punctuation +'3' Literal.Number.Integer +')' Punctuation +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_25a.txt b/tests/snippets/python/test_fstring_25a.txt new file mode 100644 index 0000000..470db36 --- /dev/null +++ b/tests/snippets/python/test_fstring_25a.txt @@ -0,0 +1,24 @@ +---input--- +extra = f'{extra},waiters:{len(self._waiters)}' + +---tokens--- +'extra' Name +' ' Text +'=' Operator +' ' Text +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'extra' Name +'}' Literal.String.Interpol +',waiters:' Literal.String.Single +'{' Literal.String.Interpol +'len' Name.Builtin +'(' Punctuation +'self' Name.Builtin.Pseudo +'.' Operator +'_waiters' Name +')' Punctuation +'}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_25b.txt b/tests/snippets/python/test_fstring_25b.txt new file mode 100644 index 0000000..94893e5 --- /dev/null +++ b/tests/snippets/python/test_fstring_25b.txt @@ -0,0 +1,24 @@ +---input--- +extra = f"{extra},waiters:{len(self._waiters)}" + +---tokens--- +'extra' Name +' ' Text +'=' Operator +' ' Text +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +'extra' Name +'}' Literal.String.Interpol +',waiters:' Literal.String.Double +'{' Literal.String.Interpol +'len' Name.Builtin +'(' Punctuation +'self' Name.Builtin.Pseudo +'.' Operator +'_waiters' Name +')' Punctuation +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_26a.txt b/tests/snippets/python/test_fstring_26a.txt new file mode 100644 index 0000000..01a231d --- /dev/null +++ b/tests/snippets/python/test_fstring_26a.txt @@ -0,0 +1,20 @@ +---input--- +message.append(f" [line {lineno:2d}]") + +---tokens--- +'message' Name +'.' Operator +'append' Name +'(' Punctuation +'f' Literal.String.Affix +'"' Literal.String.Double +' [line ' Literal.String.Double +'{' Literal.String.Interpol +'lineno' Name +':' Literal.String.Interpol +'2d' Literal.String.Double +'}' Literal.String.Interpol +']' Literal.String.Double +'"' Literal.String.Double +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_26b.txt b/tests/snippets/python/test_fstring_26b.txt new file mode 100644 index 0000000..a813149 --- /dev/null +++ b/tests/snippets/python/test_fstring_26b.txt @@ -0,0 +1,20 @@ +---input--- +message.append(f' [line {lineno:2d}]') + +---tokens--- +'message' Name +'.' Operator +'append' Name +'(' Punctuation +'f' Literal.String.Affix +"'" Literal.String.Single +' [line ' Literal.String.Single +'{' Literal.String.Interpol +'lineno' Name +':' Literal.String.Interpol +'2d' Literal.String.Single +'}' Literal.String.Interpol +']' Literal.String.Single +"'" Literal.String.Single +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_27a.txt b/tests/snippets/python/test_fstring_27a.txt new file mode 100644 index 0000000..75af0c1 --- /dev/null +++ b/tests/snippets/python/test_fstring_27a.txt @@ -0,0 +1,11 @@ +---input--- +f"{foo=}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +'foo' Name +'=}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_27b.txt b/tests/snippets/python/test_fstring_27b.txt new file mode 100644 index 0000000..71e6e51 --- /dev/null +++ b/tests/snippets/python/test_fstring_27b.txt @@ -0,0 +1,11 @@ +---input--- +f'{foo=}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'foo' Name +'=}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_28a.txt b/tests/snippets/python/test_fstring_28a.txt new file mode 100644 index 0000000..cdc65db --- /dev/null +++ b/tests/snippets/python/test_fstring_28a.txt @@ -0,0 +1,11 @@ +---input--- +f'{foo=!s}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'foo' Name +'=!s}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_28b.txt b/tests/snippets/python/test_fstring_28b.txt new file mode 100644 index 0000000..99cf4f3 --- /dev/null +++ b/tests/snippets/python/test_fstring_28b.txt @@ -0,0 +1,11 @@ +---input--- +f"{foo=!s}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +'foo' Name +'=!s}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_29a.txt b/tests/snippets/python/test_fstring_29a.txt new file mode 100644 index 0000000..2100b3b --- /dev/null +++ b/tests/snippets/python/test_fstring_29a.txt @@ -0,0 +1,15 @@ +---input--- +f"{math.pi=!f:.2f}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +'math' Name +'.' Operator +'pi' Name +'=!f:' Literal.String.Interpol +'.2f' Literal.String.Double +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_29b.txt b/tests/snippets/python/test_fstring_29b.txt new file mode 100644 index 0000000..4cc18dd --- /dev/null +++ b/tests/snippets/python/test_fstring_29b.txt @@ -0,0 +1,15 @@ +---input--- +f'{math.pi=!f:.2f}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'math' Name +'.' Operator +'pi' Name +'=!f:' Literal.String.Interpol +'.2f' Literal.String.Single +'}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_30a.txt b/tests/snippets/python/test_fstring_30a.txt new file mode 100644 index 0000000..3db443e --- /dev/null +++ b/tests/snippets/python/test_fstring_30a.txt @@ -0,0 +1,16 @@ +---input--- +f"{ chr(65) =}" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +' ' Text.Whitespace +'chr' Name.Builtin +'(' Punctuation +'65' Literal.Number.Integer +')' Punctuation +' ' Text.Whitespace +'=}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_30b.txt b/tests/snippets/python/test_fstring_30b.txt new file mode 100644 index 0000000..5f082e5 --- /dev/null +++ b/tests/snippets/python/test_fstring_30b.txt @@ -0,0 +1,16 @@ +---input--- +f'{ chr(65) =}' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +' ' Text.Whitespace +'chr' Name.Builtin +'(' Punctuation +'65' Literal.Number.Integer +')' Punctuation +' ' Text.Whitespace +'=}' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_31a.txt b/tests/snippets/python/test_fstring_31a.txt new file mode 100644 index 0000000..3e9c091 --- /dev/null +++ b/tests/snippets/python/test_fstring_31a.txt @@ -0,0 +1,15 @@ +---input--- +f"{chr(65) = }" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +'chr' Name.Builtin +'(' Punctuation +'65' Literal.Number.Integer +')' Punctuation +' ' Text.Whitespace +'= }' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_31b.txt b/tests/snippets/python/test_fstring_31b.txt new file mode 100644 index 0000000..37adb3e --- /dev/null +++ b/tests/snippets/python/test_fstring_31b.txt @@ -0,0 +1,15 @@ +---input--- +f'{chr(65) = }' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'chr' Name.Builtin +'(' Punctuation +'65' Literal.Number.Integer +')' Punctuation +' ' Text.Whitespace +'= }' Literal.String.Interpol +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_32a.txt b/tests/snippets/python/test_fstring_32a.txt new file mode 100644 index 0000000..dcfc39d --- /dev/null +++ b/tests/snippets/python/test_fstring_32a.txt @@ -0,0 +1,15 @@ +---input--- +f'*{n=:30}*' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'*' Literal.String.Single +'{' Literal.String.Interpol +'n' Name +'=:' Literal.String.Interpol +'30' Literal.String.Single +'}' Literal.String.Interpol +'*' Literal.String.Single +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_32b.txt b/tests/snippets/python/test_fstring_32b.txt new file mode 100644 index 0000000..1f8a450 --- /dev/null +++ b/tests/snippets/python/test_fstring_32b.txt @@ -0,0 +1,15 @@ +---input--- +f"*{n=:30}*" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'*' Literal.String.Double +'{' Literal.String.Interpol +'n' Name +'=:' Literal.String.Interpol +'30' Literal.String.Double +'}' Literal.String.Interpol +'*' Literal.String.Double +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_33a.txt b/tests/snippets/python/test_fstring_33a.txt new file mode 100644 index 0000000..5318b55 --- /dev/null +++ b/tests/snippets/python/test_fstring_33a.txt @@ -0,0 +1,15 @@ +---input--- +f'*{n=!r:30}*' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'*' Literal.String.Single +'{' Literal.String.Interpol +'n' Name +'=!r:' Literal.String.Interpol +'30' Literal.String.Single +'}' Literal.String.Interpol +'*' Literal.String.Single +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_33b.txt b/tests/snippets/python/test_fstring_33b.txt new file mode 100644 index 0000000..a0211dd --- /dev/null +++ b/tests/snippets/python/test_fstring_33b.txt @@ -0,0 +1,15 @@ +---input--- +f"*{n=!r:30}*" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'*' Literal.String.Double +'{' Literal.String.Interpol +'n' Name +'=!r:' Literal.String.Interpol +'30' Literal.String.Double +'}' Literal.String.Interpol +'*' Literal.String.Double +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_34a.txt b/tests/snippets/python/test_fstring_34a.txt new file mode 100644 index 0000000..9b80cc9 --- /dev/null +++ b/tests/snippets/python/test_fstring_34a.txt @@ -0,0 +1,20 @@ +---input--- +f"*{f'{n=}':30}*" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'*' Literal.String.Double +'{' Literal.String.Interpol +'f' Literal.String.Affix +"'" Literal.String.Single +'{' Literal.String.Interpol +'n' Name +'=}' Literal.String.Interpol +"'" Literal.String.Single +':' Literal.String.Interpol +'30' Literal.String.Double +'}' Literal.String.Interpol +'*' Literal.String.Double +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_34b.txt b/tests/snippets/python/test_fstring_34b.txt new file mode 100644 index 0000000..5abf37f --- /dev/null +++ b/tests/snippets/python/test_fstring_34b.txt @@ -0,0 +1,20 @@ +---input--- +f'*{f"{n=}":30}*' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'*' Literal.String.Single +'{' Literal.String.Interpol +'f' Literal.String.Affix +'"' Literal.String.Double +'{' Literal.String.Interpol +'n' Name +'=}' Literal.String.Interpol +'"' Literal.String.Double +':' Literal.String.Interpol +'30' Literal.String.Single +'}' Literal.String.Interpol +'*' Literal.String.Single +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_35a.txt b/tests/snippets/python/test_fstring_35a.txt new file mode 100644 index 0000000..b4e1041 --- /dev/null +++ b/tests/snippets/python/test_fstring_35a.txt @@ -0,0 +1,15 @@ +---input--- +f'*{n=:+<30}*' + +---tokens--- +'f' Literal.String.Affix +"'" Literal.String.Single +'*' Literal.String.Single +'{' Literal.String.Interpol +'n' Name +'=:' Literal.String.Interpol +'+<30' Literal.String.Single +'}' Literal.String.Interpol +'*' Literal.String.Single +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_35b.txt b/tests/snippets/python/test_fstring_35b.txt new file mode 100644 index 0000000..773e7a4 --- /dev/null +++ b/tests/snippets/python/test_fstring_35b.txt @@ -0,0 +1,15 @@ +---input--- +f"*{n=:+<30}*" + +---tokens--- +'f' Literal.String.Affix +'"' Literal.String.Double +'*' Literal.String.Double +'{' Literal.String.Interpol +'n' Name +'=:' Literal.String.Interpol +'+<30' Literal.String.Double +'}' Literal.String.Interpol +'*' Literal.String.Double +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_36a.txt b/tests/snippets/python/test_fstring_36a.txt new file mode 100644 index 0000000..773e38e --- /dev/null +++ b/tests/snippets/python/test_fstring_36a.txt @@ -0,0 +1,16 @@ +---input--- + +f'''{foo + = !s:20}''' + +---tokens--- +'f' Literal.String.Affix +"'''" Literal.String.Single +'{' Literal.String.Interpol +'foo' Name +'\n ' Text.Whitespace +'= !s:' Literal.String.Interpol +'20' Literal.String.Single +'}' Literal.String.Interpol +"'''" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_fstring_36b.txt b/tests/snippets/python/test_fstring_36b.txt new file mode 100644 index 0000000..da79ce2 --- /dev/null +++ b/tests/snippets/python/test_fstring_36b.txt @@ -0,0 +1,16 @@ +---input--- + +f"""{foo + = !s:20}""" + +---tokens--- +'f' Literal.String.Affix +'"""' Literal.String.Double +'{' Literal.String.Interpol +'foo' Name +'\n ' Text.Whitespace +'= !s:' Literal.String.Interpol +'20' Literal.String.Double +'}' Literal.String.Interpol +'"""' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_needs_name.txt b/tests/snippets/python/test_needs_name.txt new file mode 100644 index 0000000..f121da0 --- /dev/null +++ b/tests/snippets/python/test_needs_name.txt @@ -0,0 +1,55 @@ +# Tests that '@' is recognized as an Operator + +---input--- +S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r) + +---tokens--- +'S' Name +' ' Text +'=' Operator +' ' Text +'(' Punctuation +'H' Name +' ' Text +'@' Operator +' ' Text +'beta' Name +' ' Text +'-' Operator +' ' Text +'r' Name +')' Punctuation +'.' Operator +'T' Name +' ' Text +'@' Operator +' ' Text +'inv' Name +'(' Punctuation +'H' Name +' ' Text +'@' Operator +' ' Text +'V' Name +' ' Text +'@' Operator +' ' Text +'H' Name +'.' Operator +'T' Name +')' Punctuation +' ' Text +'@' Operator +' ' Text +'(' Punctuation +'H' Name +' ' Text +'@' Operator +' ' Text +'beta' Name +' ' Text +'-' Operator +' ' Text +'r' Name +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_pep_515.txt b/tests/snippets/python/test_pep_515.txt new file mode 100644 index 0000000..38fa619 --- /dev/null +++ b/tests/snippets/python/test_pep_515.txt @@ -0,0 +1,28 @@ +# Tests that the lexer can parse numeric literals with underscores + +---input--- +1_000_000 +1_000.000_001 +1_000e1_000j +0xCAFE_F00D +0b_0011_1111_0100_1110 +0o_777_123 + +---tokens--- +'1_000_000' Literal.Number.Integer +'\n' Text.Whitespace + +'1_000.000_001' Literal.Number.Float +'\n' Text.Whitespace + +'1_000e1_000j' Literal.Number.Float +'\n' Text.Whitespace + +'0xCAFE_F00D' Literal.Number.Hex +'\n' Text.Whitespace + +'0b_0011_1111_0100_1110' Literal.Number.Bin +'\n' Text.Whitespace + +'0o_777_123' Literal.Number.Oct +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_raw_fstring.txt b/tests/snippets/python/test_raw_fstring.txt new file mode 100644 index 0000000..3381088 --- /dev/null +++ b/tests/snippets/python/test_raw_fstring.txt @@ -0,0 +1,46 @@ +# Tests that the lexer can parse raw f-strings + +---input--- +rf"m_\nu = x" + +f"m_\nu = {x}" + +rf"m_{{\nu}} = {x}" + +---tokens--- +'rf' Literal.String.Affix +'"' Literal.String.Double +'m_' Literal.String.Double +'\\' Literal.String.Double +'nu = x' Literal.String.Double +'"' Literal.String.Double +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'f' Literal.String.Affix +'"' Literal.String.Double +'m_' Literal.String.Double +'\\n' Literal.String.Escape +'u = ' Literal.String.Double +'{' Literal.String.Interpol +'x' Name +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'rf' Literal.String.Affix +'"' Literal.String.Double +'m_' Literal.String.Double +'{{' Literal.String.Escape +'\\' Literal.String.Double +'nu' Literal.String.Double +'}}' Literal.String.Escape +' = ' Literal.String.Double +'{' Literal.String.Interpol +'x' Name +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_string_escape_codes.txt b/tests/snippets/python/test_string_escape_codes.txt new file mode 100644 index 0000000..c02dc03 --- /dev/null +++ b/tests/snippets/python/test_string_escape_codes.txt @@ -0,0 +1,20 @@ +---input--- +'\\ \n \x12 \777 \u1234 \U00010348 \N{Plus-Minus Sign}' + +---tokens--- +"'" Literal.String.Single +'\\\\' Literal.String.Escape +' ' Literal.String.Single +'\\n' Literal.String.Escape +' ' Literal.String.Single +'\\x12' Literal.String.Escape +' ' Literal.String.Single +'\\777' Literal.String.Escape +' ' Literal.String.Single +'\\u1234' Literal.String.Escape +' ' Literal.String.Single +'\\U00010348' Literal.String.Escape +' ' Literal.String.Single +'\\N{Plus-Minus Sign}' Literal.String.Escape +"'" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/python/test_walrus_operator.txt b/tests/snippets/python/test_walrus_operator.txt new file mode 100644 index 0000000..9bab89d --- /dev/null +++ b/tests/snippets/python/test_walrus_operator.txt @@ -0,0 +1,21 @@ +# Tests that ':=' is recognized as an Operator + +---input--- +if (a := 2) > 4: + +---tokens--- +'if' Keyword +' ' Text +'(' Punctuation +'a' Name +' ' Text +':=' Operator +' ' Text +'2' Literal.Number.Integer +')' Punctuation +' ' Text +'>' Operator +' ' Text +'4' Literal.Number.Integer +':' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/python2/test_cls_builtin.txt b/tests/snippets/python2/test_cls_builtin.txt new file mode 100644 index 0000000..ff533c2 --- /dev/null +++ b/tests/snippets/python2/test_cls_builtin.txt @@ -0,0 +1,34 @@ +# Tests that a cls token gets interpreted as a Token.Name.Builtin.Pseudo + +---input--- +class TestClass(): + @classmethod + def hello(cls): + pass + +---tokens--- +'class' Keyword +' ' Text +'TestClass' Name.Class +'(' Punctuation +')' Punctuation +':' Punctuation +'\n' Text.Whitespace + +' ' Text +'@classmethod' Name.Decorator +'\n' Text.Whitespace + +' ' Text +'def' Keyword +' ' Text +'hello' Name.Function +'(' Punctuation +'cls' Name.Builtin.Pseudo +')' Punctuation +':' Punctuation +'\n' Text.Whitespace + +' ' Text +'pass' Keyword +'\n' Text.Whitespace diff --git a/tests/snippets/qbasic/test_keywords_with_dollar.txt b/tests/snippets/qbasic/test_keywords_with_dollar.txt new file mode 100644 index 0000000..21c4fba --- /dev/null +++ b/tests/snippets/qbasic/test_keywords_with_dollar.txt @@ -0,0 +1,22 @@ +---input--- +DIM x +x = RIGHT$("abc", 1) + +---tokens--- +'DIM' Keyword.Declaration +' ' Text.Whitespace +'x' Name.Variable.Global +'\n' Text + +'x' Name.Variable.Global +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'RIGHT$' Keyword.Reserved +'(' Punctuation +'"abc"' Literal.String.Double +',' Punctuation +' ' Text.Whitespace +'1' Literal.Number.Integer.Long +')' Punctuation +'\n' Text diff --git a/tests/snippets/r/test_call.txt b/tests/snippets/r/test_call.txt new file mode 100644 index 0000000..c35a71e --- /dev/null +++ b/tests/snippets/r/test_call.txt @@ -0,0 +1,12 @@ +---input--- +f(1, a) + +---tokens--- +'f' Name.Function +'(' Punctuation +'1' Literal.Number +',' Punctuation +' ' Text.Whitespace +'a' Name +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/r/test_custom_operator.txt b/tests/snippets/r/test_custom_operator.txt new file mode 100644 index 0000000..1b19df7 --- /dev/null +++ b/tests/snippets/r/test_custom_operator.txt @@ -0,0 +1,10 @@ +---input--- +7 % and % 8 + +---tokens--- +'7' Literal.Number +' ' Text.Whitespace +'% and %' Operator +' ' Text.Whitespace +'8' Literal.Number +'\n' Text.Whitespace diff --git a/tests/snippets/r/test_dot_indexing.txt b/tests/snippets/r/test_dot_indexing.txt new file mode 100644 index 0000000..ee0871f --- /dev/null +++ b/tests/snippets/r/test_dot_indexing.txt @@ -0,0 +1,9 @@ +---input--- +.[1] + +---tokens--- +'.' Name +'[' Punctuation +'1' Literal.Number +']' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/r/test_dot_name.txt b/tests/snippets/r/test_dot_name.txt new file mode 100644 index 0000000..01df528 --- /dev/null +++ b/tests/snippets/r/test_dot_name.txt @@ -0,0 +1,10 @@ +---input--- +. <- 1 + +---tokens--- +'.' Name +' ' Text.Whitespace +'<-' Operator +' ' Text.Whitespace +'1' Literal.Number +'\n' Text.Whitespace diff --git a/tests/snippets/r/test_indexing.txt b/tests/snippets/r/test_indexing.txt new file mode 100644 index 0000000..6491d1a --- /dev/null +++ b/tests/snippets/r/test_indexing.txt @@ -0,0 +1,9 @@ +---input--- +a[1] + +---tokens--- +'a' Name +'[' Punctuation +'1' Literal.Number +']' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/r/test_name1.txt b/tests/snippets/r/test_name1.txt new file mode 100644 index 0000000..a7651cb --- /dev/null +++ b/tests/snippets/r/test_name1.txt @@ -0,0 +1,6 @@ +---input--- +._a_2.c + +---tokens--- +'._a_2.c' Name +'\n' Text.Whitespace diff --git a/tests/snippets/r/test_name2.txt b/tests/snippets/r/test_name2.txt new file mode 100644 index 0000000..1570aec --- /dev/null +++ b/tests/snippets/r/test_name2.txt @@ -0,0 +1,8 @@ +# Invalid names are valid if backticks are used + +---input--- +`.1 blah` + +---tokens--- +'`.1 blah`' Name +'\n' Text.Whitespace diff --git a/tests/snippets/r/test_name3.txt b/tests/snippets/r/test_name3.txt new file mode 100644 index 0000000..fe5e8a4 --- /dev/null +++ b/tests/snippets/r/test_name3.txt @@ -0,0 +1,8 @@ +# Internal backticks can be escaped + +---input--- +`.1 \` blah` + +---tokens--- +'`.1 \\` blah`' Name +'\n' Text.Whitespace diff --git a/tests/snippets/ruby/test_escaped_bracestring.txt b/tests/snippets/ruby/test_escaped_bracestring.txt new file mode 100644 index 0000000..14718b9 --- /dev/null +++ b/tests/snippets/ruby/test_escaped_bracestring.txt @@ -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 diff --git a/tests/snippets/ruby/test_interpolation_nested_curly.txt b/tests/snippets/ruby/test_interpolation_nested_curly.txt new file mode 100644 index 0000000..f4a69f7 --- /dev/null +++ b/tests/snippets/ruby/test_interpolation_nested_curly.txt @@ -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 diff --git a/tests/snippets/ruby/test_operator_methods.txt b/tests/snippets/ruby/test_operator_methods.txt new file mode 100644 index 0000000..c8f7a7a --- /dev/null +++ b/tests/snippets/ruby/test_operator_methods.txt @@ -0,0 +1,9 @@ +---input--- +x.==4 + +---tokens--- +'x' Name +'.' Operator +'==' Name.Operator +'4' Literal.Number.Integer +'\n' Text.Whitespace diff --git a/tests/snippets/ruby/test_range_syntax1.txt b/tests/snippets/ruby/test_range_syntax1.txt new file mode 100644 index 0000000..f0fc15d --- /dev/null +++ b/tests/snippets/ruby/test_range_syntax1.txt @@ -0,0 +1,8 @@ +---input--- +1..3 + +---tokens--- +'1' Literal.Number.Integer +'..' Operator +'3' Literal.Number.Integer +'\n' Text.Whitespace diff --git a/tests/snippets/ruby/test_range_syntax2.txt b/tests/snippets/ruby/test_range_syntax2.txt new file mode 100644 index 0000000..a3ba24a --- /dev/null +++ b/tests/snippets/ruby/test_range_syntax2.txt @@ -0,0 +1,8 @@ +---input--- +1...3 + +---tokens--- +'1' Literal.Number.Integer +'...' Operator +'3' Literal.Number.Integer +'\n' Text.Whitespace diff --git a/tests/snippets/ruby/test_range_syntax3.txt b/tests/snippets/ruby/test_range_syntax3.txt new file mode 100644 index 0000000..08bf4b1 --- /dev/null +++ b/tests/snippets/ruby/test_range_syntax3.txt @@ -0,0 +1,10 @@ +---input--- +1 .. 3 + +---tokens--- +'1' Literal.Number.Integer +' ' Text.Whitespace +'..' Operator +' ' Text.Whitespace +'3' Literal.Number.Integer +'\n' Text.Whitespace diff --git a/tests/snippets/rust/test_attribute.txt b/tests/snippets/rust/test_attribute.txt new file mode 100644 index 0000000..2c4a889 --- /dev/null +++ b/tests/snippets/rust/test_attribute.txt @@ -0,0 +1,12 @@ +---input--- +#[foo(bar = [baz, qux])] + +---tokens--- +'#[' Comment.Preproc +'foo(bar = ' Comment.Preproc +'[' Comment.Preproc +'baz, qux' Comment.Preproc +']' Comment.Preproc +')' Comment.Preproc +']' Comment.Preproc +'\n' Text.Whitespace diff --git a/tests/snippets/rust/test_break.txt b/tests/snippets/rust/test_break.txt new file mode 100644 index 0000000..7dafde2 --- /dev/null +++ b/tests/snippets/rust/test_break.txt @@ -0,0 +1,39 @@ +---input--- +loop { + break; + break 'foo; + break'foo; + break_it; +} + +---tokens--- +'loop' Keyword +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'break' Keyword +';' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'break' Keyword +' ' Text.Whitespace +"'foo" Name.Label +';' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'break' Keyword +"'foo" Name.Label +';' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'break_it' Name +';' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/rust/test_rawstrings.txt b/tests/snippets/rust/test_rawstrings.txt new file mode 100644 index 0000000..69524f9 --- /dev/null +++ b/tests/snippets/rust/test_rawstrings.txt @@ -0,0 +1,117 @@ +---input--- +fn main() { + let raw_str = r"Escapes don't work + + here: \x3F \u{211D}"; + println!("{}", raw_str); + + // If you need quotes in a raw string, add a pair of #s + let quotes = r#"And then I said: + + "There is no escape!""#; + println!("{}", quotes); + + // If you need "# in your string, just use more #s in the delimiter. + // There is no limit for the number of #s you can use. + let longer_delimiter = r###"A string + with "# in it. And even "##!"###; + println!("{}", longer_delimiter); +} + +---tokens--- +'fn' Keyword +' ' Text +'main' Name.Function +'(' Punctuation +')' Punctuation +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'let' Keyword.Declaration +' ' Text.Whitespace +'raw_str' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'r"Escapes don\'t work\n\n here: \\x3F \\u{211D}"' Literal.String +';' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'println!' Name.Function.Magic +'(' Punctuation +'"' Literal.String +'{}' Literal.String +'"' Literal.String +',' Punctuation +' ' Text.Whitespace +'raw_str' Name +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +' ' Text.Whitespace +'// If you need quotes in a raw string, add a pair of #s\n' Comment.Single + +' ' Text.Whitespace +'let' Keyword.Declaration +' ' Text.Whitespace +'quotes' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'r#"And then I said:\n\n "There is no escape!""#' Literal.String +';' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'println!' Name.Function.Magic +'(' Punctuation +'"' Literal.String +'{}' Literal.String +'"' Literal.String +',' Punctuation +' ' Text.Whitespace +'quotes' Name +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +' ' Text.Whitespace +'// If you need "# in your string, just use more #s in the delimiter.\n' Comment.Single + +' ' Text.Whitespace +'// There is no limit for the number of #s you can use.\n' Comment.Single + +' ' Text.Whitespace +'let' Keyword.Declaration +' ' Text.Whitespace +'longer_delimiter' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'r###"A string\n with "# in it. And even "##!"###' Literal.String +';' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'println!' Name.Function.Magic +'(' Punctuation +'"' Literal.String +'{}' Literal.String +'"' Literal.String +',' Punctuation +' ' Text.Whitespace +'longer_delimiter' Name +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_colon_colon_function_name.txt b/tests/snippets/scala/test_colon_colon_function_name.txt new file mode 100644 index 0000000..8840fff --- /dev/null +++ b/tests/snippets/scala/test_colon_colon_function_name.txt @@ -0,0 +1,33 @@ +---input--- +def ::(xs: List[T]): List[T] = ::(x, xs) + +---tokens--- +'def' Keyword +' ' Text.Whitespace +'::' Name.Function +'(' Punctuation +'xs' Name +':' Punctuation +' ' Text.Whitespace +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +')' Punctuation +':' Punctuation +' ' Text.Whitespace +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'::' Name +'(' Punctuation +'x' Name +',' Punctuation +' ' Text.Whitespace +'xs' Name +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_default_parameter.txt b/tests/snippets/scala/test_default_parameter.txt new file mode 100644 index 0000000..16ce948 --- /dev/null +++ b/tests/snippets/scala/test_default_parameter.txt @@ -0,0 +1,37 @@ +---input--- +def f(using y: Char = if true then 'a' else 2): Int = ??? + +---tokens--- +'def' Keyword +' ' Text.Whitespace +'f' Name.Function +'(' Punctuation +'using' Keyword +' ' Text.Whitespace +'y' Name +':' Punctuation +' ' Text.Whitespace +'Char' Name.Class +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'if' Keyword +' ' Text.Whitespace +'true' Keyword.Constant +' ' Text.Whitespace +'then' Keyword +' ' Text.Whitespace +"'a'" Literal.String.Char +' ' Text.Whitespace +'else' Keyword +' ' Text.Whitespace +'2' Literal.Number.Integer +')' Punctuation +':' Punctuation +' ' Text.Whitespace +'Int' Name.Class +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'???' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_end_val.txt b/tests/snippets/scala/test_end_val.txt new file mode 100644 index 0000000..43ac172 --- /dev/null +++ b/tests/snippets/scala/test_end_val.txt @@ -0,0 +1,8 @@ +---input--- +end val + +---tokens--- +'end' Keyword +' ' Text.Whitespace +'val' Keyword +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_end_valx.txt b/tests/snippets/scala/test_end_valx.txt new file mode 100644 index 0000000..e1d17d7 --- /dev/null +++ b/tests/snippets/scala/test_end_valx.txt @@ -0,0 +1,8 @@ +---input--- +end valx + +---tokens--- +'end' Keyword +' ' Text.Whitespace +'valx' Name.Namespace +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_float_with_exponents.txt b/tests/snippets/scala/test_float_with_exponents.txt new file mode 100644 index 0000000..d64ee63 --- /dev/null +++ b/tests/snippets/scala/test_float_with_exponents.txt @@ -0,0 +1,12 @@ +---input--- +.1e12 .1e+34 .1e-56 .1e12f + +---tokens--- +'.1e12' Literal.Number.Float +' ' Text.Whitespace +'.1e+34' Literal.Number.Float +' ' Text.Whitespace +'.1e-56' Literal.Number.Float +' ' Text.Whitespace +'.1e12f' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_function_operator_name.txt b/tests/snippets/scala/test_function_operator_name.txt new file mode 100644 index 0000000..72c375d --- /dev/null +++ b/tests/snippets/scala/test_function_operator_name.txt @@ -0,0 +1,18 @@ +---input--- +def < (y: String): Boolean + +---tokens--- +'def' Keyword +' ' Text.Whitespace +'<' Name.Function +' ' Text.Whitespace +'(' Punctuation +'y' Name +':' Punctuation +' ' Text.Whitespace +'String' Name.Class +')' Punctuation +':' Punctuation +' ' Text.Whitespace +'Boolean' Name.Class +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_import_path.txt b/tests/snippets/scala/test_import_path.txt new file mode 100644 index 0000000..1c316a0 --- /dev/null +++ b/tests/snippets/scala/test_import_path.txt @@ -0,0 +1,12 @@ +---input--- +import a.b.c + +---tokens--- +'import' Keyword +' ' Text.Whitespace +'a' Name.Namespace +'.' Punctuation +'b' Name.Namespace +'.' Punctuation +'c' Name +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_invalid_symbol_and_invalid_char.txt b/tests/snippets/scala/test_invalid_symbol_and_invalid_char.txt new file mode 100644 index 0000000..ccaae59 --- /dev/null +++ b/tests/snippets/scala/test_invalid_symbol_and_invalid_char.txt @@ -0,0 +1,8 @@ +---input--- +'1 //' + +---tokens--- +"'" Error +'1' Literal.Number.Integer +' ' Text.Whitespace +"//'\n" Comment.Single diff --git a/tests/snippets/scala/test_open_soft_keyword.txt b/tests/snippets/scala/test_open_soft_keyword.txt new file mode 100644 index 0000000..903be71 --- /dev/null +++ b/tests/snippets/scala/test_open_soft_keyword.txt @@ -0,0 +1,12 @@ +---input--- +val open = true + +---tokens--- +'val' Keyword.Declaration +' ' Text.Whitespace +'open' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'true' Keyword.Constant +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_package_name.txt b/tests/snippets/scala/test_package_name.txt new file mode 100644 index 0000000..53633e2 --- /dev/null +++ b/tests/snippets/scala/test_package_name.txt @@ -0,0 +1,11 @@ +---input--- +package p1.p2: + +---tokens--- +'package' Keyword +' ' Text.Whitespace +'p1' Name.Namespace +'.' Punctuation +'p2' Name +':' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_prepend_operator.txt b/tests/snippets/scala/test_prepend_operator.txt new file mode 100644 index 0000000..cf7b2f9 --- /dev/null +++ b/tests/snippets/scala/test_prepend_operator.txt @@ -0,0 +1,10 @@ +---input--- +a +: b + +---tokens--- +'a' Name +' ' Text.Whitespace +'+:' Operator +' ' Text.Whitespace +'b' Name +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_qualified_name.txt b/tests/snippets/scala/test_qualified_name.txt new file mode 100644 index 0000000..a004410 --- /dev/null +++ b/tests/snippets/scala/test_qualified_name.txt @@ -0,0 +1,10 @@ +---input--- +a.b.c + +---tokens--- +'a' Name +'.' Punctuation +'b' Name +'.' Punctuation +'c' Name +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_qualified_name_class.txt b/tests/snippets/scala/test_qualified_name_class.txt new file mode 100644 index 0000000..7345092 --- /dev/null +++ b/tests/snippets/scala/test_qualified_name_class.txt @@ -0,0 +1,10 @@ +---input--- +a.b.C + +---tokens--- +'a' Name +'.' Punctuation +'b' Name +'.' Punctuation +'C' Name.Class +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_script_header.txt b/tests/snippets/scala/test_script_header.txt new file mode 100644 index 0000000..6d96fd6 --- /dev/null +++ b/tests/snippets/scala/test_script_header.txt @@ -0,0 +1,6 @@ +---input--- +#!/usr/bin/scala + +---tokens--- +'#!/usr/bin/scala' Comment.Hashbang +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_symbol_followed_by_op.txt b/tests/snippets/scala/test_symbol_followed_by_op.txt new file mode 100644 index 0000000..518abce --- /dev/null +++ b/tests/snippets/scala/test_symbol_followed_by_op.txt @@ -0,0 +1,7 @@ +---input--- +symbol* + +---tokens--- +'symbol' Name +'*' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_symbol_name_ending_with_star.txt b/tests/snippets/scala/test_symbol_name_ending_with_star.txt new file mode 100644 index 0000000..25e5dc6 --- /dev/null +++ b/tests/snippets/scala/test_symbol_name_ending_with_star.txt @@ -0,0 +1,6 @@ +---input--- +symbol_* + +---tokens--- +'symbol_*' Name +'\n' Text.Whitespace diff --git a/tests/snippets/scala/test_underscore_name.txt b/tests/snippets/scala/test_underscore_name.txt new file mode 100644 index 0000000..f7a24af --- /dev/null +++ b/tests/snippets/scala/test_underscore_name.txt @@ -0,0 +1,12 @@ +---input--- +val head = _head + +---tokens--- +'val' Keyword.Declaration +' ' Text.Whitespace +'head' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'_head' Name +'\n' Text.Whitespace diff --git a/tests/snippets/scheme/keywords.txt b/tests/snippets/scheme/keywords.txt new file mode 100644 index 0000000..046a444 --- /dev/null +++ b/tests/snippets/scheme/keywords.txt @@ -0,0 +1,43 @@ +---input--- +(define* (foo #:key (bar123? 'baz)) + (display bar123?) + (newline)) + +(foo #:bar123? 'xyz) + +---tokens--- +'(' Punctuation +'define*' Keyword +' ' Text.Whitespace +'(' Punctuation +'foo' Name.Function +' ' Text.Whitespace +'#:key' Keyword.Declaration +' ' Text.Whitespace +'(' Punctuation +'bar123?' Name.Function +' ' Text.Whitespace +"'baz" Literal.String.Symbol +')' Punctuation +')' Punctuation +'\n ' Text.Whitespace +'(' Punctuation +'display' Name.Builtin +' ' Text.Whitespace +'bar123?' Name.Variable +')' Punctuation +'\n ' Text.Whitespace +'(' Punctuation +'newline' Name.Builtin +')' Punctuation +')' Punctuation +'\n\n' Text.Whitespace + +'(' Punctuation +'foo' Name.Function +' ' Text.Whitespace +'#:bar123?' Keyword.Declaration +' ' Text.Whitespace +"'xyz" Literal.String.Symbol +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/scheme/numbers.txt b/tests/snippets/scheme/numbers.txt new file mode 100644 index 0000000..f03b3a7 --- /dev/null +++ b/tests/snippets/scheme/numbers.txt @@ -0,0 +1,169 @@ +---input--- +;; All sorts of numbers, common and less common. + +0 +142 +-142 ++142 +-0.5 ++0.5 +-0.5e-10 ++0.5e10 +0.5e+10 +.5F+10 +.123 +123. +123.L-25|54 ++inf.0 +-inf.0 +#b+nan.0-inf.0i +1-2i +1-i ++i +-5f24@3.14159 +4/5 +5.4e5@4 +#i5 +#o5 +#i#o5 +#o#i5 +#b01/10 +#x0f42a +#E#b01/10 +#d#I01/10 +#i-324@3.14159 +#o#I01/1022-inf.0i + +;; These are not numbers but plain symbols. + +1+ +1- +i +inf +-inf +nan +-nan + +---tokens--- +';; All sorts of numbers, common and less common.' Comment.Single +'\n\n' Text.Whitespace + +'0' Literal.Number.Integer +'\n' Text.Whitespace + +'142' Literal.Number.Integer +'\n' Text.Whitespace + +'-142' Literal.Number.Integer +'\n' Text.Whitespace + +'+142' Literal.Number.Integer +'\n' Text.Whitespace + +'-0.5' Literal.Number.Float +'\n' Text.Whitespace + +'+0.5' Literal.Number.Float +'\n' Text.Whitespace + +'-0.5e-10' Literal.Number.Float +'\n' Text.Whitespace + +'+0.5e10' Literal.Number.Float +'\n' Text.Whitespace + +'0.5e+10' Literal.Number.Float +'\n' Text.Whitespace + +'.5F+10' Literal.Number.Float +'\n' Text.Whitespace + +'.123' Literal.Number.Float +'\n' Text.Whitespace + +'123.' Literal.Number.Float +'\n' Text.Whitespace + +'123.L-25|54' Literal.Number.Float +'\n' Text.Whitespace + +'+inf.0' Literal.Number.Float +'\n' Text.Whitespace + +'-inf.0' Literal.Number.Float +'\n' Text.Whitespace + +'#b+nan.0-inf.0i' Literal.Number.Bin +'\n' Text.Whitespace + +'1-2i' Literal.Number.Integer +'\n' Text.Whitespace + +'1-i' Literal.Number.Integer +'\n' Text.Whitespace + +'+i' Literal.Number.Integer +'\n' Text.Whitespace + +'-5f24@3.14159' Literal.Number.Float +'\n' Text.Whitespace + +'4/5' Literal.Number.Integer +'\n' Text.Whitespace + +'5.4e5@4' Literal.Number.Float +'\n' Text.Whitespace + +'#i5' Literal.Number.Integer +'\n' Text.Whitespace + +'#o5' Literal.Number.Oct +'\n' Text.Whitespace + +'#i#o5' Literal.Number.Oct +'\n' Text.Whitespace + +'#o#i5' Literal.Number.Oct +'\n' Text.Whitespace + +'#b01/10' Literal.Number.Bin +'\n' Text.Whitespace + +'#x0f42a' Literal.Number.Hex +'\n' Text.Whitespace + +'#E#b01/10' Literal.Number.Bin +'\n' Text.Whitespace + +'#d#I01/10' Literal.Number.Integer +'\n' Text.Whitespace + +'#i-324@3.14159' Literal.Number.Float +'\n' Text.Whitespace + +'#o#I01/1022-inf.0i' Literal.Number.Oct +'\n\n' Text.Whitespace + +';; These are not numbers but plain symbols.' Comment.Single +'\n\n' Text.Whitespace + +'1+' Name.Builtin +'\n' Text.Whitespace + +'1-' Name.Builtin +'\n' Text.Whitespace + +'i' Name.Variable +'\n' Text.Whitespace + +'inf' Name.Builtin +'\n' Text.Whitespace + +'-inf' Name.Variable +'\n' Text.Whitespace + +'nan' Name.Builtin +'\n' Text.Whitespace + +'-nan' Name.Variable +'\n' Text.Whitespace diff --git a/tests/snippets/scheme/strings.txt b/tests/snippets/scheme/strings.txt new file mode 100644 index 0000000..9d03351 --- /dev/null +++ b/tests/snippets/scheme/strings.txt @@ -0,0 +1,85 @@ +---input--- +;; Test string escapes + +"basic string" + +"Strings can + span several + + lines. + " + +"Escapes: + \" + \\ + \| + \a + \f + \n + \r + \t + \v + \b + \0 + \( + \ + \x125612; (R6RS-style) + \x13 (Guile-style) + \u1234 + \U123456 +" + +---tokens--- +';; Test string escapes' Comment.Single +'\n\n' Text.Whitespace + +'"' Literal.String +'basic string' Literal.String +'"' Literal.String +'\n\n' Text.Whitespace + +'"' Literal.String +'Strings can\n span several\n\n lines.\n ' Literal.String +'"' Literal.String +'\n\n' Text.Whitespace + +'"' Literal.String +'Escapes:\n ' Literal.String +'\\"' Literal.String.Escape +'\n ' Literal.String +'\\\\' Literal.String.Escape +'\n ' Literal.String +'\\|' Literal.String.Escape +'\n ' Literal.String +'\\a' Literal.String.Escape +'\n ' Literal.String +'\\f' Literal.String.Escape +'\n ' Literal.String +'\\n' Literal.String.Escape +'\n ' Literal.String +'\\r' Literal.String.Escape +'\n ' Literal.String +'\\t' Literal.String.Escape +'\n ' Literal.String +'\\v' Literal.String.Escape +'\n ' Literal.String +'\\b' Literal.String.Escape +'\n ' Literal.String +'\\0' Literal.String.Escape +'\n ' Literal.String +'\\(' Literal.String.Escape +'\n ' Literal.String +'\\\n' Literal.String.Escape + +' ' Literal.String +'\\x125612;' Literal.String.Escape +' (R6RS-style)\n ' Literal.String +'\\x13' Literal.String.Escape +' (Guile-style)\n ' Literal.String +'\\u1234' Literal.String.Escape +'\n ' Literal.String +'\\U123456' Literal.String.Escape +'\n' Literal.String + +'"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/shell/test_array_nums.txt b/tests/snippets/shell/test_array_nums.txt new file mode 100644 index 0000000..4e9870c --- /dev/null +++ b/tests/snippets/shell/test_array_nums.txt @@ -0,0 +1,14 @@ +---input--- +a=(1 2 3) + +---tokens--- +'a' Name.Variable +'=' Operator +'(' Operator +'1' Literal.Number +' ' Text.Whitespace +'2' Literal.Number +' ' Text.Whitespace +'3' Literal.Number +')' Operator +'\n' Text.Whitespace diff --git a/tests/snippets/shell/test_curly_no_escape_and_quotes.txt b/tests/snippets/shell/test_curly_no_escape_and_quotes.txt new file mode 100644 index 0000000..9fbb718 --- /dev/null +++ b/tests/snippets/shell/test_curly_no_escape_and_quotes.txt @@ -0,0 +1,15 @@ +---input--- +echo "${a//["b"]/}" + +---tokens--- +'echo' Name.Builtin +' ' Text.Whitespace +'"' Literal.String.Double +'${' Literal.String.Interpol +'a' Name.Variable +'//[' Punctuation +'"b"' Literal.String.Double +']/' Punctuation +'}' Literal.String.Interpol +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/shell/test_curly_with_escape.txt b/tests/snippets/shell/test_curly_with_escape.txt new file mode 100644 index 0000000..d03b23e --- /dev/null +++ b/tests/snippets/shell/test_curly_with_escape.txt @@ -0,0 +1,13 @@ +---input--- +echo ${a//[\"]/} + +---tokens--- +'echo' Name.Builtin +' ' Text.Whitespace +'${' Literal.String.Interpol +'a' Name.Variable +'//[' Punctuation +'\\"' Literal.String.Escape +']/' Punctuation +'}' Literal.String.Interpol +'\n' Text.Whitespace diff --git a/tests/snippets/shell/test_end_of_line_nums.txt b/tests/snippets/shell/test_end_of_line_nums.txt new file mode 100644 index 0000000..663ea61 --- /dev/null +++ b/tests/snippets/shell/test_end_of_line_nums.txt @@ -0,0 +1,15 @@ +---input--- +a=1 +b=2 # comment + +---tokens--- +'a' Name.Variable +'=' Operator +'1' Literal.Number +'\n' Text.Whitespace + +'b' Name.Variable +'=' Operator +'2' Literal.Number +' ' Text.Whitespace +'# comment\n' Comment.Single diff --git a/tests/snippets/shell/test_parsed_single.txt b/tests/snippets/shell/test_parsed_single.txt new file mode 100644 index 0000000..3110c8e --- /dev/null +++ b/tests/snippets/shell/test_parsed_single.txt @@ -0,0 +1,8 @@ +---input--- +a=$'abc\'' + +---tokens--- +'a' Name.Variable +'=' Operator +"$'abc\\''" Literal.String.Single +'\n' Text.Whitespace diff --git a/tests/snippets/shell/test_short_variable_names.txt b/tests/snippets/shell/test_short_variable_names.txt new file mode 100644 index 0000000..86d4dc1 --- /dev/null +++ b/tests/snippets/shell/test_short_variable_names.txt @@ -0,0 +1,26 @@ +---input--- +x="$" +y="$_" +z="$abc" + +---tokens--- +'x' Name.Variable +'=' Operator +'"' Literal.String.Double +'$' Text +'"' Literal.String.Double +'\n' Text.Whitespace + +'y' Name.Variable +'=' Operator +'"' Literal.String.Double +'$_' Name.Variable +'"' Literal.String.Double +'\n' Text.Whitespace + +'z' Name.Variable +'=' Operator +'"' Literal.String.Double +'$abc' Name.Variable +'"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/shexc/test_prefixed_name_starting_with_number.txt b/tests/snippets/shexc/test_prefixed_name_starting_with_number.txt new file mode 100644 index 0000000..ca1c293 --- /dev/null +++ b/tests/snippets/shexc/test_prefixed_name_starting_with_number.txt @@ -0,0 +1,8 @@ +---input--- +alice:6f6e4241-75a2-4780-9b2a-40da53082e54 + +---tokens--- +'alice' Name.Namespace +':' Punctuation +'6f6e4241-75a2-4780-9b2a-40da53082e54' Name.Tag +'\n' Text diff --git a/tests/snippets/smarty/test_nested_curly.txt b/tests/snippets/smarty/test_nested_curly.txt new file mode 100644 index 0000000..493aa49 --- /dev/null +++ b/tests/snippets/smarty/test_nested_curly.txt @@ -0,0 +1,18 @@ +---input--- +{templateFunction param={anotherFunction} param2=$something} + +---tokens--- +'{' Comment.Preproc +'templateFunction' Name.Function +' ' Text +'param' Name.Attribute +'=' Operator +'{' Comment.Preproc +'anotherFunction' Name.Attribute +'}' Comment.Preproc +' ' Text +'param2' Name.Attribute +'=' Operator +'$something' Name.Variable +'}' Comment.Preproc +'\n' Other diff --git a/tests/snippets/snbt/json.txt b/tests/snippets/snbt/json.txt new file mode 100644 index 0000000..7b02134 --- /dev/null +++ b/tests/snippets/snbt/json.txt @@ -0,0 +1,43 @@ +---input--- +{ + "text": "This is JSON", + "extra": [ + "however", + "it's also technically valid SNBT.." + ] +} + +---tokens--- +'{' Punctuation +'\n ' Text.Whitespace +'"' Literal.String.Double +'text' Literal.String.Double +'"' Literal.String.Double +':' Punctuation +' ' Text.Whitespace +'"' Literal.String.Double +'This is JSON' Literal.String.Double +'"' Literal.String.Double +',' Punctuation +'\n ' Text.Whitespace +'"' Literal.String.Double +'extra' Literal.String.Double +'"' Literal.String.Double +':' Punctuation +' ' Text.Whitespace +'[' Punctuation +'\n ' Text.Whitespace +'"' Literal.String.Double +'however' Literal.String.Double +'"' Literal.String.Double +',' Punctuation +'\n ' Text.Whitespace +'"' Literal.String.Double +"it's also technically valid SNBT.." Literal.String.Double +'"' Literal.String.Double +'\n ' Text.Whitespace +']' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text diff --git a/tests/snippets/snbt/literals.txt b/tests/snippets/snbt/literals.txt new file mode 100644 index 0000000..cc852b8 --- /dev/null +++ b/tests/snippets/snbt/literals.txt @@ -0,0 +1,41 @@ +---input--- +{int: 1, byte: 0b, short: 1s, long: 10000L, float: 10.0f, double: 20.0} + +---tokens--- +'{' Punctuation +'int' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'1' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'byte' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'0b' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'short' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'1s' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'long' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'10000L' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'float' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'10.0f' Literal.Number.Float +',' Punctuation +' ' Text.Whitespace +'double' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'20.0' Literal.Number.Float +'}' Punctuation +'\n' Text diff --git a/tests/snippets/snbt/multiline.txt b/tests/snippets/snbt/multiline.txt new file mode 100644 index 0000000..35a6a53 --- /dev/null +++ b/tests/snippets/snbt/multiline.txt @@ -0,0 +1,56 @@ +---input--- +{ + key: "cool compound", + UUID: [I;459130179,987513928,-1425663264,-175461800], + list: [ + 0, + 1, + 3 + ] +} + +---tokens--- +'{' Punctuation +'\n ' Text.Whitespace +'key' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'"' Literal.String.Double +'cool compound' Literal.String.Double +'"' Literal.String.Double +',' Punctuation +'\n ' Text.Whitespace +'UUID' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'[' Punctuation +'I' Name.Attribute +';' Punctuation +'459130179' Literal.Number.Integer +',' Punctuation +'987513928' Literal.Number.Integer +',' Punctuation +'-1425663264' Literal.Number.Integer +',' Punctuation +'-175461800' Literal.Number.Integer +']' Punctuation +',' Punctuation +'\n ' Text.Whitespace +'list' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'[' Punctuation +'\n ' Text.Whitespace +'0' Literal.Number.Integer +',' Punctuation +'\n ' Text.Whitespace +'1' Literal.Number.Integer +',' Punctuation +'\n ' Text.Whitespace +'3' Literal.Number.Integer +'\n ' Text.Whitespace +']' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text diff --git a/tests/snippets/snbt/nesting.txt b/tests/snippets/snbt/nesting.txt new file mode 100644 index 0000000..317a9c8 --- /dev/null +++ b/tests/snippets/snbt/nesting.txt @@ -0,0 +1,39 @@ +---input--- +{root: [{compound: 1b}, {compound: 2b, tag: {key: "value"}}]} + +---tokens--- +'{' Punctuation +'root' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'[' Punctuation +'{' Punctuation +'compound' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'1b' Literal.Number.Integer +'}' Punctuation +',' Punctuation +' ' Text.Whitespace +'{' Punctuation +'compound' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'2b' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'tag' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'{' Punctuation +'key' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'"' Literal.String.Double +'value' Literal.String.Double +'"' Literal.String.Double +'}' Punctuation +'}' Punctuation +']' Punctuation +'}' Punctuation +'\n' Text diff --git a/tests/snippets/snbt/quoted_keys.txt b/tests/snippets/snbt/quoted_keys.txt new file mode 100644 index 0000000..8e54f5f --- /dev/null +++ b/tests/snippets/snbt/quoted_keys.txt @@ -0,0 +1,29 @@ +---input--- +{"special--key": 10b, normal_key: false, "json..///_type_key": "yup"} + +---tokens--- +'{' Punctuation +'"' Literal.String.Double +'special--key' Literal.String.Double +'"' Literal.String.Double +':' Punctuation +' ' Text.Whitespace +'10b' Literal.Number.Integer +',' Punctuation +' ' Text.Whitespace +'normal_key' Name.Attribute +':' Punctuation +' ' Text.Whitespace +'false' Name.Attribute +',' Punctuation +' ' Text.Whitespace +'"' Literal.String.Double +'json..///_type_key' Literal.String.Double +'"' Literal.String.Double +':' Punctuation +' ' Text.Whitespace +'"' Literal.String.Double +'yup' Literal.String.Double +'"' Literal.String.Double +'}' Punctuation +'\n' Text diff --git a/tests/snippets/systemverilog/test_basic.txt b/tests/snippets/systemverilog/test_basic.txt new file mode 100644 index 0000000..1f86ed0 --- /dev/null +++ b/tests/snippets/systemverilog/test_basic.txt @@ -0,0 +1,157 @@ +# Examine tokens emitted by the SV lexer for a trivial module. +# Not intended to stress any particular corner of the language. + +---input--- +// Adder flops the sum of its inputs +module Adder #( + parameter int N = 42 +) ( + output logic [N-1:0] y, + output logic co, + + input logic [N-1:0] a, + input logic [N-1:0] b, + input logic ci, + + input logic clk +); + always_ff @(posedge clk) begin + {co, y} <= a + b + ci; + end +endmodule : Adder + +---tokens--- +'// Adder flops the sum of its inputs\n' Comment.Single + +'module' Keyword +' ' Text.Whitespace +'Adder' Name +' ' Text.Whitespace +'#' Punctuation +'(' Punctuation +'\n ' Text.Whitespace +'parameter' Keyword +' ' Text.Whitespace +'int' Keyword.Type +' ' Text.Whitespace +'N' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'42' Literal.Number.Integer +'\n' Text.Whitespace + +')' Punctuation +' ' Text.Whitespace +'(' Punctuation +'\n ' Text.Whitespace +'output' Keyword +' ' Text.Whitespace +'logic' Keyword.Type +' ' Text.Whitespace +'[' Punctuation +'N' Name +'-' Operator +'1' Literal.Number.Integer +':' Operator +'0' Literal.Number.Integer +']' Punctuation +' ' Text.Whitespace +'y' Name +',' Punctuation +'\n ' Text.Whitespace +'output' Keyword +' ' Text.Whitespace +'logic' Keyword.Type +' ' Text.Whitespace +'co' Name +',' Punctuation +'\n\n ' Text.Whitespace +'input' Keyword +' ' Text.Whitespace +'logic' Keyword.Type +' ' Text.Whitespace +'[' Punctuation +'N' Name +'-' Operator +'1' Literal.Number.Integer +':' Operator +'0' Literal.Number.Integer +']' Punctuation +' ' Text.Whitespace +'a' Name +',' Punctuation +'\n ' Text.Whitespace +'input' Keyword +' ' Text.Whitespace +'logic' Keyword.Type +' ' Text.Whitespace +'[' Punctuation +'N' Name +'-' Operator +'1' Literal.Number.Integer +':' Operator +'0' Literal.Number.Integer +']' Punctuation +' ' Text.Whitespace +'b' Name +',' Punctuation +'\n ' Text.Whitespace +'input' Keyword +' ' Text.Whitespace +'logic' Keyword.Type +' ' Text.Whitespace +'ci' Name +',' Punctuation +'\n\n ' Text.Whitespace +'input' Keyword +' ' Text.Whitespace +'logic' Keyword.Type +' ' Text.Whitespace +'clk' Name +'\n' Text.Whitespace + +')' Punctuation +';' Punctuation +'\n ' Text.Whitespace +'always_ff' Keyword +' ' Text.Whitespace +'@' Punctuation +'(' Punctuation +'posedge' Keyword +' ' Text.Whitespace +'clk' Name +')' Punctuation +' ' Text.Whitespace +'begin' Keyword +'\n ' Text.Whitespace +'{' Punctuation +'co' Name +',' Punctuation +' ' Text.Whitespace +'y' Name +'}' Punctuation +' ' Text.Whitespace +'<' Operator +'=' Operator +' ' Text.Whitespace +'a' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'b' Name +' ' Text.Whitespace +'+' Operator +' ' Text.Whitespace +'ci' Name +';' Punctuation +'\n ' Text.Whitespace +'end' Keyword +'\n' Text.Whitespace + +'endmodule' Keyword +' ' Text.Whitespace +':' Operator +' ' Text.Whitespace +'Adder' Name +'\n' Text.Whitespace diff --git a/tests/snippets/systemverilog/test_classes.txt b/tests/snippets/systemverilog/test_classes.txt new file mode 100644 index 0000000..b9529db --- /dev/null +++ b/tests/snippets/systemverilog/test_classes.txt @@ -0,0 +1,89 @@ +# Most of the interesting types of class declarations + +---input--- +class Foo; +endclass + +class Bar; +endclass : Bar + +class Fiz extends Buz; +endclass : Fiz + +class Free #(parameter type T = byte) extends Beer #(T); +endclass : Free + +---tokens--- +'class' Keyword.Declaration +' ' Text.Whitespace +'Foo' Name.Class +';' Punctuation +'\n' Text.Whitespace + +'endclass' Keyword.Declaration +'\n\n' Text.Whitespace + +'class' Keyword.Declaration +' ' Text.Whitespace +'Bar' Name.Class +';' Punctuation +'\n' Text.Whitespace + +'endclass' Keyword.Declaration +' ' Text.Whitespace +':' Punctuation +' ' Text.Whitespace +'Bar' Name.Class +'\n\n' Text.Whitespace + +'class' Keyword.Declaration +' ' Text.Whitespace +'Fiz' Name.Class +' ' Text.Whitespace +'extends' Keyword.Declaration +' ' Text.Whitespace +'Buz' Name.Class +';' Punctuation +'\n' Text.Whitespace + +'endclass' Keyword.Declaration +' ' Text.Whitespace +':' Punctuation +' ' Text.Whitespace +'Fiz' Name.Class +'\n\n' Text.Whitespace + +'class' Keyword.Declaration +' ' Text.Whitespace +'Free' Name.Class +' ' Text.Whitespace +'#' Punctuation +'(' Punctuation +'parameter' Keyword +' ' Text.Whitespace +'type' Keyword.Type +' ' Text.Whitespace +'T' Name +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'byte' Keyword.Type +')' Punctuation +' ' Text.Whitespace +'extends' Keyword.Declaration +' ' Text.Whitespace +'Beer' Name.Class +' ' Text.Whitespace +'#' Punctuation +'(' Punctuation +'T' Name +')' Punctuation +';' Punctuation +'\n' Text.Whitespace + +'endclass' Keyword.Declaration +' ' Text.Whitespace +':' Punctuation +' ' Text.Whitespace +'Free' Name.Class +'\n' Text.Whitespace diff --git a/tests/snippets/systemverilog/test_numbers.txt b/tests/snippets/systemverilog/test_numbers.txt new file mode 100644 index 0000000..d7e4511 --- /dev/null +++ b/tests/snippets/systemverilog/test_numbers.txt @@ -0,0 +1,158 @@ +# Believe it or not, SystemVerilog supports spaces before and after the base +# specifier (ie 'b, 'd, 'h). See IEEE 1800-2017 Section 5.7.1 for examples. + +---input--- +8'b10101010 +8 'b10101010 +8'b 10101010 +8'sb10101010 +8'Sb10101010 +8'B10101010 +8'b1010_1010 +8'b10xXzZ?10 + +24'o01234567 +24 'o01234567 +24'o 01234567 +24'so01234567 +24'So01234567 +24'O01234567 +24'o0123_4567 +24'o01xXzZ?7 + +32'd27182818 +32 'd27182818 +32'd 27182818 +32'sd27182818 +32'Sd27182818 +32'D27182818 +32'd2718_2818 +32'd27xXzZ?8 + +32'hdeadbeef +32 'hdeadbeef +32'h deadbeef +32'shdeadbeef +32'Shdeadbeef +32'Hdeadbeef +32'hdead_beef +32'hdexXzZ?f + +'0 '1 'x 'X 'z 'Z + +42 1234_5678 + +---tokens--- +"8'b10101010" Literal.Number.Bin +'\n' Text.Whitespace + +"8 'b10101010" Literal.Number.Bin +'\n' Text.Whitespace + +"8'b 10101010" Literal.Number.Bin +'\n' Text.Whitespace + +"8'sb10101010" Literal.Number.Bin +'\n' Text.Whitespace + +"8'Sb10101010" Literal.Number.Bin +'\n' Text.Whitespace + +"8'B10101010" Literal.Number.Bin +'\n' Text.Whitespace + +"8'b1010_1010" Literal.Number.Bin +'\n' Text.Whitespace + +"8'b10xXzZ?10" Literal.Number.Bin +'\n\n' Text.Whitespace + +"24'o01234567" Literal.Number.Oct +'\n' Text.Whitespace + +"24 'o01234567" Literal.Number.Oct +'\n' Text.Whitespace + +"24'o 01234567" Literal.Number.Oct +'\n' Text.Whitespace + +"24'so01234567" Literal.Number.Oct +'\n' Text.Whitespace + +"24'So01234567" Literal.Number.Oct +'\n' Text.Whitespace + +"24'O01234567" Literal.Number.Oct +'\n' Text.Whitespace + +"24'o0123_4567" Literal.Number.Oct +'\n' Text.Whitespace + +"24'o01xXzZ?7" Literal.Number.Oct +'\n\n' Text.Whitespace + +"32'd27182818" Literal.Number.Integer +'\n' Text.Whitespace + +"32 'd27182818" Literal.Number.Integer +'\n' Text.Whitespace + +"32'd 27182818" Literal.Number.Integer +'\n' Text.Whitespace + +"32'sd27182818" Literal.Number.Integer +'\n' Text.Whitespace + +"32'Sd27182818" Literal.Number.Integer +'\n' Text.Whitespace + +"32'D27182818" Literal.Number.Integer +'\n' Text.Whitespace + +"32'd2718_2818" Literal.Number.Integer +'\n' Text.Whitespace + +"32'd27xXzZ?8" Literal.Number.Integer +'\n\n' Text.Whitespace + +"32'hdeadbeef" Literal.Number.Hex +'\n' Text.Whitespace + +"32 'hdeadbeef" Literal.Number.Hex +'\n' Text.Whitespace + +"32'h deadbeef" Literal.Number.Hex +'\n' Text.Whitespace + +"32'shdeadbeef" Literal.Number.Hex +'\n' Text.Whitespace + +"32'Shdeadbeef" Literal.Number.Hex +'\n' Text.Whitespace + +"32'Hdeadbeef" Literal.Number.Hex +'\n' Text.Whitespace + +"32'hdead_beef" Literal.Number.Hex +'\n' Text.Whitespace + +"32'hdexXzZ?f" Literal.Number.Hex +'\n\n' Text.Whitespace + +"'0" Literal.Number +' ' Text.Whitespace +"'1" Literal.Number +' ' Text.Whitespace +"'x" Literal.Number +' ' Text.Whitespace +"'X" Literal.Number +' ' Text.Whitespace +"'z" Literal.Number +' ' Text.Whitespace +"'Z" Literal.Number +'\n\n' Text.Whitespace + +'42' Literal.Number.Integer +' ' Text.Whitespace +'1234_5678' Literal.Number.Integer +'\n' Text.Whitespace diff --git a/tests/snippets/systemverilog/test_operators.txt b/tests/snippets/systemverilog/test_operators.txt new file mode 100644 index 0000000..fec4539 --- /dev/null +++ b/tests/snippets/systemverilog/test_operators.txt @@ -0,0 +1,213 @@ +# See 1800-2017 Table 11-2: Operator Precedence and Associativity +# Note that the duplicates (unary/binary) have been removed, +# ie '+', '-', '&', '|', '^', '~^', '^~' +# Note: This is a inconsistent mix of operator and punctuation +# Note: Operators would ideally be represented as one token: ':' ':' -> '::', '~' '&' -> '~&' + +---input--- +() [] :: . ++ - ! ~ & ~& | ~| ^ ~^ ^~ ++ -- +** +* / % +<< >> <<< >>> +< <= > >= inside dist +== != === !== ==? !=? +&& +|| +?: +-> <-> += += -= *= /= %= &= ^= |= <<= >>= <<<= >>>= := :/ <= +{} {{}} + +---tokens--- +'(' Punctuation +')' Punctuation +' ' Text.Whitespace +'[' Punctuation +']' Punctuation +' ' Text.Whitespace +':' Operator +':' Operator +' ' Text.Whitespace +'.' Punctuation +'\n' Text.Whitespace + +'+' Operator +' ' Text.Whitespace +'-' Operator +' ' Text.Whitespace +'!' Operator +' ' Text.Whitespace +'~' Operator +' ' Text.Whitespace +'&' Operator +' ' Text.Whitespace +'~' Operator +'&' Operator +' ' Text.Whitespace +'|' Operator +' ' Text.Whitespace +'~' Operator +'|' Operator +' ' Text.Whitespace +'^' Operator +' ' Text.Whitespace +'~' Operator +'^' Operator +' ' Text.Whitespace +'^' Operator +'~' Operator +' ' Text.Whitespace +'+' Operator +'+' Operator +' ' Text.Whitespace +'-' Operator +'-' Operator +'\n' Text.Whitespace + +'*' Operator +'*' Operator +'\n' Text.Whitespace + +'*' Operator +' ' Text.Whitespace +'/' Operator +' ' Text.Whitespace +'%' Operator +'\n' Text.Whitespace + +'<' Operator +'<' Operator +' ' Text.Whitespace +'>' Operator +'>' Operator +' ' Text.Whitespace +'<' Operator +'<' Operator +'<' Operator +' ' Text.Whitespace +'>' Operator +'>' Operator +'>' Operator +'\n' Text.Whitespace + +'<' Operator +' ' Text.Whitespace +'<' Operator +'=' Operator +' ' Text.Whitespace +'>' Operator +' ' Text.Whitespace +'>' Operator +'=' Operator +' ' Text.Whitespace +'inside' Operator.Word +' ' Text.Whitespace +'dist' Operator.Word +'\n' Text.Whitespace + +'=' Operator +'=' Operator +' ' Text.Whitespace +'!' Operator +'=' Operator +' ' Text.Whitespace +'=' Operator +'=' Operator +'=' Operator +' ' Text.Whitespace +'!' Operator +'=' Operator +'=' Operator +' ' Text.Whitespace +'=' Operator +'=' Operator +'?' Operator +' ' Text.Whitespace +'!' Operator +'=' Operator +'?' Operator +'\n' Text.Whitespace + +'&' Operator +'&' Operator +'\n' Text.Whitespace + +'|' Operator +'|' Operator +'\n' Text.Whitespace + +'?' Operator +':' Operator +'\n' Text.Whitespace + +'-' Operator +'>' Operator +' ' Text.Whitespace +'<' Operator +'-' Operator +'>' Operator +'\n' Text.Whitespace + +'=' Operator +' ' Text.Whitespace +'+' Operator +'=' Operator +' ' Text.Whitespace +'-' Operator +'=' Operator +' ' Text.Whitespace +'*' Operator +'=' Operator +' ' Text.Whitespace +'/' Operator +'=' Operator +' ' Text.Whitespace +'%' Operator +'=' Operator +' ' Text.Whitespace +'&' Operator +'=' Operator +' ' Text.Whitespace +'^' Operator +'=' Operator +' ' Text.Whitespace +'|' Operator +'=' Operator +' ' Text.Whitespace +'<' Operator +'<' Operator +'=' Operator +' ' Text.Whitespace +'>' Operator +'>' Operator +'=' Operator +' ' Text.Whitespace +'<' Operator +'<' Operator +'<' Operator +'=' Operator +' ' Text.Whitespace +'>' Operator +'>' Operator +'>' Operator +'=' Operator +' ' Text.Whitespace +':' Operator +'=' Operator +' ' Text.Whitespace +':' Operator +'/' Operator +' ' Text.Whitespace +'<' Operator +'=' Operator +'\n' Text.Whitespace + +'{' Punctuation +'}' Punctuation +' ' Text.Whitespace +'{' Punctuation +'{' Punctuation +'}' Punctuation +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/tcl/test_comma_and_at.txt b/tests/snippets/tcl/test_comma_and_at.txt new file mode 100644 index 0000000..51e1733 --- /dev/null +++ b/tests/snippets/tcl/test_comma_and_at.txt @@ -0,0 +1,131 @@ +---input--- +# Alt and arrow keys to scroll +set scroll_amount 2 +bind Text <Alt-Up> { + %W yview scroll -$scroll_amount units + %W mark set insert @0,[expr [winfo height %W] / 2] +} +bind Text <Alt-Down> { + %W yview scroll $scroll_amount units + %W mark set insert @0,[expr [winfo height %W] / 2] +} + +---tokens--- +'#' Comment +' Alt and arrow keys to scroll\n' Comment + +'set' Keyword +' ' Text.Whitespace +'scroll_amount' Text +' ' Text.Whitespace +'2' Literal.Number.Integer +'\n' Text + +'bind' Name.Variable +' ' Text.Whitespace +'Text' Text +' ' Text.Whitespace +'<' Operator +'Alt-Up' Text +'>' Operator +' ' Text.Whitespace +'{' Keyword +'\n ' Text.Whitespace +'%' Operator +'W' Name.Variable +' ' Text.Whitespace +'yview' Text +' ' Text.Whitespace +'scroll' Text +' ' Text.Whitespace +'-' Operator +'$scroll_amount' Name.Variable +' ' Text.Whitespace +'units' Text +'\n' Text + +' ' Text.Whitespace +'%' Operator +'W' Name.Variable +' ' Text.Whitespace +'mark' Text +' ' Text.Whitespace +'set' Text +' ' Text.Whitespace +'insert' Text +' ' Text.Whitespace +'@0,' Text +'[' Keyword +'expr' Keyword +' ' Text.Whitespace +'[' Keyword +'winfo' Name.Variable +' ' Text.Whitespace +'height' Text +' ' Text.Whitespace +'%' Operator +'W' Text +']' Keyword +' ' Text.Whitespace +'/' Operator +' ' Text.Whitespace +'2' Literal.Number.Integer +']' Keyword +'\n' Text + +'}' Keyword +'\n' Text + +'bind' Name.Variable +' ' Text.Whitespace +'Text' Text +' ' Text.Whitespace +'<' Operator +'Alt-Down' Text +'>' Operator +' ' Text.Whitespace +'{' Keyword +'\n ' Text.Whitespace +'%' Operator +'W' Name.Variable +' ' Text.Whitespace +'yview' Text +' ' Text.Whitespace +'scroll' Text +' ' Text.Whitespace +'$scroll_amount' Name.Variable +' ' Text.Whitespace +'units' Text +'\n' Text + +' ' Text.Whitespace +'%' Operator +'W' Name.Variable +' ' Text.Whitespace +'mark' Text +' ' Text.Whitespace +'set' Text +' ' Text.Whitespace +'insert' Text +' ' Text.Whitespace +'@0,' Text +'[' Keyword +'expr' Keyword +' ' Text.Whitespace +'[' Keyword +'winfo' Name.Variable +' ' Text.Whitespace +'height' Text +' ' Text.Whitespace +'%' Operator +'W' Text +']' Keyword +' ' Text.Whitespace +'/' Operator +' ' Text.Whitespace +'2' Literal.Number.Integer +']' Keyword +'\n' Text + +'}' Keyword +'\n' Text diff --git a/tests/snippets/tcl/test_vars.txt b/tests/snippets/tcl/test_vars.txt new file mode 100644 index 0000000..5c62390 --- /dev/null +++ b/tests/snippets/tcl/test_vars.txt @@ -0,0 +1,17 @@ +---input--- +set size 10; puts ${size}x${size} + +---tokens--- +'set' Keyword +' ' Text.Whitespace +'size' Text +' ' Text.Whitespace +'10' Literal.Number.Integer +';' Keyword +' ' Text.Whitespace +'puts' Name.Builtin +' ' Text.Whitespace +'${size}' Name.Variable +'x' Text +'${size}' Name.Variable +'\n' Text diff --git a/tests/snippets/teal/test_comments.txt b/tests/snippets/teal/test_comments.txt new file mode 100644 index 0000000..df7e1b1 --- /dev/null +++ b/tests/snippets/teal/test_comments.txt @@ -0,0 +1,28 @@ +---input--- +a//c1 + //c2 +label://c3 +a // c4 +label: implicit comment + +---tokens--- +'a' Name.Function +'//c1' Comment.Single +'\n' Text + +' ' Text.Whitespace +'//c2' Comment.Single +'\n' Text.Whitespace + +'label:' Name.Function +'//c3' Comment.Single +'\n' Text + +'a' Name.Function +' ' Text.Whitespace +'// c4' Comment.Single +'\n' Text + +'label:' Name.Label +' implicit comment' Comment.Single +'\n' Text.Whitespace diff --git a/tests/snippets/teal/test_literals.txt b/tests/snippets/teal/test_literals.txt new file mode 100644 index 0000000..46e43dc --- /dev/null +++ b/tests/snippets/teal/test_literals.txt @@ -0,0 +1,28 @@ +---input--- +a 0x1AaAF +a 7777777777777777777777777777777777777777777777777774MSJUVU +a base32(aB/c23=) +a b64 aB/c23= + +---tokens--- +'a' Name.Function +' ' Text.Whitespace +'0x1AaAF' Literal.Number.Hex +'\n' Text + +'a' Name.Function +' ' Text.Whitespace +'7777777777777777777777777777777777777777777777777774MSJUVU' Literal.Number +'\n' Text + +'a' Name.Function +' ' Text.Whitespace +'base32' Literal.String.Affix +'(aB/c23=)' Literal.String.Other +'\n' Text + +'a' Name.Function +' ' Text.Whitespace +'b64 ' Literal.String.Affix +'aB/c23=' Literal.String.Other +'\n' Text diff --git a/tests/snippets/teal/test_strings.txt b/tests/snippets/teal/test_strings.txt new file mode 100644 index 0000000..4e32633 --- /dev/null +++ b/tests/snippets/teal/test_strings.txt @@ -0,0 +1,15 @@ +---input--- +a "abc\x123\n\"de//f" + +---tokens--- +'a' Name.Function +' ' Text.Whitespace +'"' Literal.String +'abc' Literal.String +'\\x12' Literal.String.Escape +'3' Literal.String +'\\n' Literal.String.Escape +'\\"' Literal.String.Escape +'de//f' Literal.String +'"' Literal.String +'\n' Text diff --git a/tests/snippets/terraform/test_attributes.txt b/tests/snippets/terraform/test_attributes.txt new file mode 100644 index 0000000..2fcf805 --- /dev/null +++ b/tests/snippets/terraform/test_attributes.txt @@ -0,0 +1,155 @@ +---input--- + description = "Some description" + + availability_zones = ["${aws_instance.web.availability_zone}-foobar"] + availability_zones = [aws_instance.web.availability_zone] + assume_role_policy = data.aws_iam_policy_document.trust.json + policy_arn = aws_iam_policy.assume_roles[0].arn + + value = file("path.txt") + value = jsonencode(element("value")) + + tags = { + Name = "something" + } + + "ENV_VARIABLE_1" = aws_dynamodb_table.loginsights2metrics.name + "ENV_VARIABLE_2" = "Some string" + + ignore_changes = [last_modified, filename] + + variable = "aws:MultiFactorAuthPresent" + +---tokens--- +' ' Text.Whitespace +'description' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"Some description"' Literal.String.Double +'\n' Text.Whitespace + +'\n' Text.Whitespace + +' ' Text.Whitespace +'availability_zones' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'[' Punctuation +'"${aws_instance.web.availability_zone}-foobar"' Literal.String.Double +']' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'availability_zones' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'[' Punctuation +'aws_instance.web.availability_zone' Name.Variable +']' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'assume_role_policy' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'data.aws_iam_policy_document.trust.json' Name.Variable +'\n' Text.Whitespace + +' ' Text.Whitespace +'policy_arn' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'aws_iam_policy.assume_roles[0].arn' Name.Variable +'\n' Text.Whitespace + +' \n ' Text.Whitespace +'value' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'file' Name.Function +'(' Punctuation +'"path.txt"' Literal.String.Double +')' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'value' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'jsonencode' Name.Function +'(' Punctuation +'element' Name.Function +'(' Punctuation +'"value"' Literal.String.Double +')' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +' ' Text.Whitespace +'tags' Name.Builtin +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'Name' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"something"' Literal.String.Double +'\n' Text.Whitespace + +' ' Text.Whitespace +'}' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +' ' Text.Whitespace +'"ENV_VARIABLE_1"' Literal.String.Double +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'aws_dynamodb_table.loginsights2metrics.name' Name.Variable +'\n' Text.Whitespace + +' ' Text.Whitespace +'"ENV_VARIABLE_2"' Literal.String.Double +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"Some string"' Literal.String.Double +'\n' Text.Whitespace + +'\n' Text.Whitespace + +' ' Text.Whitespace +'ignore_changes' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'[' Punctuation +'last_modified, filename' Name.Builtin +']' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +' ' Text.Whitespace +'variable' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"aws:MultiFactorAuthPresent"' Literal.String.Double +'\n' Text.Whitespace diff --git a/tests/snippets/terraform/test_backend.txt b/tests/snippets/terraform/test_backend.txt new file mode 100644 index 0000000..ff02a58 --- /dev/null +++ b/tests/snippets/terraform/test_backend.txt @@ -0,0 +1,44 @@ +---input--- +terraform { + backend "consul" { + address = "demo.consul.io" + path = "tfdocs" + } +} + +---tokens--- +'terraform' Name.Builtin +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'backend' Keyword.Reserved +' ' Text.Whitespace +'"consul"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'address' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"demo.consul.io"' Literal.String.Double +'\n' Text.Whitespace + +' ' Text.Whitespace +'path' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"tfdocs"' Literal.String.Double +'\n' Text.Whitespace + +' ' Text.Whitespace +'}' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/terraform/test_comment.txt b/tests/snippets/terraform/test_comment.txt new file mode 100644 index 0000000..9f5c1a7 --- /dev/null +++ b/tests/snippets/terraform/test_comment.txt @@ -0,0 +1,64 @@ +---input--- +# Single line comment +// Non-idiomatic single line comment +/* multiline + + comment + +*/ +provider "azurerm" { # (1) + features {} +} + +---tokens--- +'# Single line comment\n' Comment.Single + +'// Non-idiomatic single line comment\n' Comment.Single + +'/*' Comment.Multiline +' ' Comment.Multiline +'m' Comment.Multiline +'u' Comment.Multiline +'l' Comment.Multiline +'t' Comment.Multiline +'i' Comment.Multiline +'l' Comment.Multiline +'i' Comment.Multiline +'n' Comment.Multiline +'e' Comment.Multiline +'\n' Comment.Multiline + +'\n' Comment.Multiline + +' ' Comment.Multiline +' ' Comment.Multiline +'c' Comment.Multiline +'o' Comment.Multiline +'m' Comment.Multiline +'m' Comment.Multiline +'e' Comment.Multiline +'n' Comment.Multiline +'t' Comment.Multiline +'\n' Comment.Multiline + +'\n' Comment.Multiline + +'*/' Comment.Multiline +'\n' Text.Whitespace + +'provider' Keyword.Reserved +' ' Text.Whitespace +'"azurerm"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +' # (1)\n' Comment.Single + +' ' Text.Whitespace +'features' Name.Builtin +' ' Text.Whitespace +'{' Punctuation +'}' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +' \n' Text.Whitespace diff --git a/tests/snippets/terraform/test_functions.txt b/tests/snippets/terraform/test_functions.txt new file mode 100644 index 0000000..b00c7a5 --- /dev/null +++ b/tests/snippets/terraform/test_functions.txt @@ -0,0 +1,56 @@ +---input--- +provider "aws" { + value = file("path.txt") +} + +provider "aws" { + value = jsonencode(element("value")) +} + +---tokens--- +'provider' Keyword.Reserved +' ' Text.Whitespace +'"aws"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'value' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'file' Name.Function +'(' Punctuation +'"path.txt"' Literal.String.Double +')' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'provider' Keyword.Reserved +' ' Text.Whitespace +'"aws"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'value' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'jsonencode' Name.Function +'(' Punctuation +'element' Name.Function +'(' Punctuation +'"value"' Literal.String.Double +')' Punctuation +')' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/terraform/test_heredoc.txt b/tests/snippets/terraform/test_heredoc.txt new file mode 100644 index 0000000..a8b1cb3 --- /dev/null +++ b/tests/snippets/terraform/test_heredoc.txt @@ -0,0 +1,65 @@ +---input--- +resource "local_file" "heredoc" { + content = <<-DOC + heredoc content + DOC +} + +resource "local_file" "heredoc" { + content = <<DOC + heredoc content + DOC +} + +---tokens--- +'resource' Keyword.Reserved +' ' Text.Whitespace +'"local_file"' Name.Class +' ' Text.Whitespace +'"heredoc"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'content' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'<<-' Operator +'DOC' Literal.String.Delimiter +'\n' Literal.String.Heredoc + +' heredoc content\n' Literal.String.Heredoc + +' DOC\n' Literal.String.Delimiter + +'}' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'resource' Keyword.Reserved +' ' Text.Whitespace +'"local_file"' Name.Class +' ' Text.Whitespace +'"heredoc"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'content' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'<<' Operator +'DOC' Literal.String.Delimiter +'\n' Literal.String.Heredoc + +' heredoc content\n' Literal.String.Heredoc + +' DOC\n' Literal.String.Delimiter + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/terraform/test_module.txt b/tests/snippets/terraform/test_module.txt new file mode 100644 index 0000000..5a5876b --- /dev/null +++ b/tests/snippets/terraform/test_module.txt @@ -0,0 +1,32 @@ +---input--- +module "consul" { + source = "hashicorp/consul/aws" + servers = 3 +} + +---tokens--- +'module' Keyword.Reserved +' ' Text.Whitespace +'"consul"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'source' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"hashicorp/consul/aws"' Literal.String.Double +'\n' Text.Whitespace + +' ' Text.Whitespace +'servers' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'3' Literal.Number +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/terraform/test_resource.txt b/tests/snippets/terraform/test_resource.txt new file mode 100644 index 0000000..7b2815a --- /dev/null +++ b/tests/snippets/terraform/test_resource.txt @@ -0,0 +1,211 @@ +---input--- +resource "aws_internet_gateway" "base_igw" { + vpc_id = aws_vpc.something.id + tags = { + Name = "igw-${var.something}-${var.something}" + } +} + +resource "aws_security_group" "allow_tls" { + name = "allow_tls" + description = "Allow TLS inbound traffic" + vpc_id = aws_vpc.main.id + + # Ingress rules + ingress { + description = "TLS from VPC" + from_port = 443 + to_port = 443 + } + + # Egress rules + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } + + tags = { + Name = "allow_tls" + } +} + +---tokens--- +'resource' Keyword.Reserved +' ' Text.Whitespace +'"aws_internet_gateway"' Name.Class +' ' Text.Whitespace +'"base_igw"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'vpc_id' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'aws_vpc.something.id' Name.Variable +'\n' Text.Whitespace + +' ' Text.Whitespace +'tags' Name.Builtin +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'Name' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"igw-${var.something}-${var.something}"' Literal.String.Double +'\n' Text.Whitespace + +' ' Text.Whitespace +'}' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'resource' Keyword.Reserved +' ' Text.Whitespace +'"aws_security_group"' Name.Class +' ' Text.Whitespace +'"allow_tls"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'name' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"allow_tls"' Literal.String.Double +'\n' Text.Whitespace + +' ' Text.Whitespace +'description' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"Allow TLS inbound traffic"' Literal.String.Double +'\n' Text.Whitespace + +' ' Text.Whitespace +'vpc_id' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'aws_vpc.main.id' Name.Variable +'\n\n # Ingress rules\n' Comment.Single + +' ' Text.Whitespace +'ingress' Name.Builtin +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'description' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"TLS from VPC"' Literal.String.Double +'\n' Text.Whitespace + +' ' Text.Whitespace +'from_port' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'443' Literal.Number +'\n' Text.Whitespace + +' ' Text.Whitespace +'to_port' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'443' Literal.Number +'\n' Text.Whitespace + +' ' Text.Whitespace +'}' Punctuation +'\n\n # Egress rules\n' Comment.Single + +' ' Text.Whitespace +'egress' Name.Builtin +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'from_port' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'0' Literal.Number +'\n' Text.Whitespace + +' ' Text.Whitespace +'to_port' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'0' Literal.Number +'\n' Text.Whitespace + +' ' Text.Whitespace +'protocol' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"-1"' Literal.String.Double +'\n' Text.Whitespace + +' ' Text.Whitespace +'cidr_blocks' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'[' Punctuation +'"0.0.0.0/0"' Literal.String.Double +']' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'}' Punctuation +'\n' Text.Whitespace + +'\n' Text.Whitespace + +' ' Text.Whitespace +'tags' Name.Builtin +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'Name' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"allow_tls"' Literal.String.Double +'\n' Text.Whitespace + +' ' Text.Whitespace +'}' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/terraform/test_types.txt b/tests/snippets/terraform/test_types.txt new file mode 100644 index 0000000..b689244 --- /dev/null +++ b/tests/snippets/terraform/test_types.txt @@ -0,0 +1,94 @@ +---input--- +backend "consul" { +data "aws_ami" "example" { +module "consul" { +output "instance_ip_addr" { +provider "aws" { +provisioner "local-exec" { +resource "aws_internet_gateway" "base_igw" { +variable "aws_region" { +variable "set-str" { + type = set(string) +} + +---tokens--- +'backend' Keyword.Reserved +' ' Text.Whitespace +'"consul"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +'data' Keyword.Reserved +' ' Text.Whitespace +'"aws_ami"' Name.Class +' ' Text.Whitespace +'"example"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +'module' Keyword.Reserved +' ' Text.Whitespace +'"consul"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +'output' Keyword.Reserved +' ' Text.Whitespace +'"instance_ip_addr"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +'provider' Keyword.Reserved +' ' Text.Whitespace +'"aws"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +'provisioner' Keyword.Reserved +' ' Text.Whitespace +'"local-exec"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +'resource' Keyword.Reserved +' ' Text.Whitespace +'"aws_internet_gateway"' Name.Class +' ' Text.Whitespace +'"base_igw"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +'variable' Keyword.Reserved +' ' Text.Whitespace +'"aws_region"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +'variable' Keyword.Reserved +' ' Text.Whitespace +'"set-str"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'type' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'set' Keyword.Type +'(' Punctuation +'string' Keyword.Type +')' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/terraform/test_variable_declaration.txt b/tests/snippets/terraform/test_variable_declaration.txt new file mode 100644 index 0000000..72e515e --- /dev/null +++ b/tests/snippets/terraform/test_variable_declaration.txt @@ -0,0 +1,41 @@ +---input--- +variable "aws_region" { + description = "AWS region to launch servers." + default = "us-west-2" + somevar = true +} + +---tokens--- +'variable' Keyword.Reserved +' ' Text.Whitespace +'"aws_region"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'description' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"AWS region to launch servers."' Literal.String.Double +'\n' Text.Whitespace + +' ' Text.Whitespace +'default' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"us-west-2"' Literal.String.Double +'\n' Text.Whitespace + +' ' Text.Whitespace +'somevar' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'true' Name.Constant +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/terraform/test_variable_read.txt b/tests/snippets/terraform/test_variable_read.txt new file mode 100644 index 0000000..25afcf4 --- /dev/null +++ b/tests/snippets/terraform/test_variable_read.txt @@ -0,0 +1,23 @@ +---input--- +provider "aws" { + region = var.aws_region +} + +---tokens--- +'provider' Keyword.Reserved +' ' Text.Whitespace +'"aws"' Name.Variable +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +' ' Text.Whitespace +'region' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'var.aws_region' Name.Variable +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/turtle/test_prefixed_name_starting_with_number.txt b/tests/snippets/turtle/test_prefixed_name_starting_with_number.txt new file mode 100644 index 0000000..ca1c293 --- /dev/null +++ b/tests/snippets/turtle/test_prefixed_name_starting_with_number.txt @@ -0,0 +1,8 @@ +---input--- +alice:6f6e4241-75a2-4780-9b2a-40da53082e54 + +---tokens--- +'alice' Name.Namespace +':' Punctuation +'6f6e4241-75a2-4780-9b2a-40da53082e54' Name.Tag +'\n' Text diff --git a/tests/snippets/typescript/test_function_definition.txt b/tests/snippets/typescript/test_function_definition.txt new file mode 100644 index 0000000..925c380 --- /dev/null +++ b/tests/snippets/typescript/test_function_definition.txt @@ -0,0 +1,18 @@ +---input--- +async function main() { +} + +---tokens--- +'async' Keyword +' ' Text.Whitespace +'function' Keyword.Declaration +' ' Text.Whitespace +'main' Name.Other +'(' Punctuation +')' Punctuation +' ' Text.Whitespace +'{' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/unixconfig/etc_group.txt b/tests/snippets/unixconfig/etc_group.txt new file mode 100644 index 0000000..3294ed5 --- /dev/null +++ b/tests/snippets/unixconfig/etc_group.txt @@ -0,0 +1,45 @@ +---input--- +root:x:0: +sudo:x:1:syslog,user +syslog:x:2: +#adm:x:3: + +user:x:1000 + +---tokens--- +'root' Text +':' Punctuation +'x' Literal.String +':' Punctuation +'0' Literal.Number +':' Punctuation +'\n' Text.Whitespace + +'sudo' Text +':' Punctuation +'x' Literal.String +':' Punctuation +'1' Literal.Number +':' Punctuation +'syslog,user' Text +'\n' Text.Whitespace + +'syslog' Text +':' Punctuation +'x' Literal.String +':' Punctuation +'2' Literal.Number +':' Punctuation +'\n' Text.Whitespace + +'#adm:x:3:' Comment +'\n' Text.Whitespace + +'\n' Text.Whitespace + +'user' Text +':' Punctuation +'x' Literal.String +':' Punctuation +'1000' Literal.Number +'\n' Text.Whitespace diff --git a/tests/snippets/unixconfig/etc_passwd.txt b/tests/snippets/unixconfig/etc_passwd.txt new file mode 100644 index 0000000..540e41f --- /dev/null +++ b/tests/snippets/unixconfig/etc_passwd.txt @@ -0,0 +1,86 @@ +---input--- +root:x:0:0:root:/root:/bin/bash +daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin +#irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin +gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin +systemd-network:x:100:102:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin + +---tokens--- +'root' Text +':' Punctuation +'x' Literal.String +':' Punctuation +'0' Literal.Number +':' Punctuation +'0' Literal.Number +':' Punctuation +'root' Text +':' Punctuation +'/root' Literal.String +':' Punctuation +'/bin/bash' Literal.String +'\n' Text.Whitespace + +'daemon' Text +':' Punctuation +'x' Literal.String +':' Punctuation +'1' Literal.Number +':' Punctuation +'1' Literal.Number +':' Punctuation +'daemon' Text +':' Punctuation +'/usr/sbin' Literal.String +':' Punctuation +'/usr/sbin/nologin' Literal.String +'\n' Text.Whitespace + +'#irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin' Comment +'\n' Text.Whitespace + +'gnats' Text +':' Punctuation +'x' Literal.String +':' Punctuation +'41' Literal.Number +':' Punctuation +'41' Literal.Number +':' Punctuation +'Gnats Bug-Reporting System (admin)' Text +':' Punctuation +'/var/lib/gnats' Literal.String +':' Punctuation +'/usr/sbin/nologin' Literal.String +'\n' Text.Whitespace + +'nobody' Text +':' Punctuation +'x' Literal.String +':' Punctuation +'65534' Literal.Number +':' Punctuation +'65534' Literal.Number +':' Punctuation +'nobody' Text +':' Punctuation +'/nonexistent' Literal.String +':' Punctuation +'/usr/sbin/nologin' Literal.String +'\n' Text.Whitespace + +'systemd-network' Text +':' Punctuation +'x' Literal.String +':' Punctuation +'100' Literal.Number +':' Punctuation +'102' Literal.Number +':' Punctuation +'systemd Network Management,,,' Text +':' Punctuation +'/run/systemd' Literal.String +':' Punctuation +'/usr/sbin/nologin' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/unixconfig/etc_shadow.txt b/tests/snippets/unixconfig/etc_shadow.txt new file mode 100644 index 0000000..6b1d92a --- /dev/null +++ b/tests/snippets/unixconfig/etc_shadow.txt @@ -0,0 +1,74 @@ +---input--- +root:$6$L95fNbtS$IZ8affe7h2B.DF81HZ:17262:0:14600:14::: +#nobody:*:18375:0:99999:7::: +bin:*:17110:0:99999:7::: +user:$6$KmghZnvbZs7f3SQ9$H6f0M61q5Cf8JLrS0kR3M97/o6GzD6FH3MbLs92CM/l9mHZ7FngBzRfa8D5NrWl.K8nM64affeWrY/L0U7nBt/:19097:0:99999:7::: +linoadmin:!!:17289:0:99999:7::: + +---tokens--- +'root' Text +':' Punctuation +'$6$L95fNbtS$IZ8affe7h2B.DF81HZ' Literal.String +':' Punctuation +'17262' Literal.Number +':' Punctuation +'0' Literal.Number +':' Punctuation +'14600' Literal.Number +':' Punctuation +'14' Literal.Number +':' Punctuation +':' Punctuation +':' Punctuation +'\n' Text.Whitespace + +'#nobody:*:18375:0:99999:7:::' Comment +'\n' Text.Whitespace + +'bin' Text +':' Punctuation +'*' Literal.String +':' Punctuation +'17110' Literal.Number +':' Punctuation +'0' Literal.Number +':' Punctuation +'99999' Literal.Number +':' Punctuation +'7' Literal.Number +':' Punctuation +':' Punctuation +':' Punctuation +'\n' Text.Whitespace + +'user' Text +':' Punctuation +'$6$KmghZnvbZs7f3SQ9$H6f0M61q5Cf8JLrS0kR3M97/o6GzD6FH3MbLs92CM/l9mHZ7FngBzRfa8D5NrWl.K8nM64affeWrY/L0U7nBt/' Literal.String +':' Punctuation +'19097' Literal.Number +':' Punctuation +'0' Literal.Number +':' Punctuation +'99999' Literal.Number +':' Punctuation +'7' Literal.Number +':' Punctuation +':' Punctuation +':' Punctuation +'\n' Text.Whitespace + +'linoadmin' Text +':' Punctuation +'!!' Literal.String +':' Punctuation +'17289' Literal.Number +':' Punctuation +'0' Literal.Number +':' Punctuation +'99999' Literal.Number +':' Punctuation +'7' Literal.Number +':' Punctuation +':' Punctuation +':' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/usd/test_attribute.txt b/tests/snippets/usd/test_attribute.txt new file mode 100644 index 0000000..74e6789 --- /dev/null +++ b/tests/snippets/usd/test_attribute.txt @@ -0,0 +1,174 @@ +---input--- +double foo = 8.0 + +custom double foo = 8.0 + +uniform double foo = 8.0 + +custom uniform double foo = 8.0 + +custom double foo_underscore_name = 8.0 + +double[] foo_underscore_name = [10.1, 12.0, 13] + +double[] primvar:foo_thing = [10.1, 12.0, 13] + +custom int[] foo = [8, 10, 14] + +custom int[] foo.timeSamples = { + 1: [8, 0, 14], + 2: [-8, 0, 14], +} + +---tokens--- +'double' Keyword.Type +' ' Text.Whitespace +'foo' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'8.0' Literal.Number +'\n\n' Text.Whitespace + +'custom' Keyword.Token +' ' Text.Whitespace +'double' Keyword.Type +' ' Text.Whitespace +'foo' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'8.0' Literal.Number +'\n\n' Text.Whitespace + +'uniform' Keyword.Token +' ' Text.Whitespace +'double' Keyword.Type +' ' Text.Whitespace +'foo' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'8.0' Literal.Number +'\n\n' Text.Whitespace + +'custom' Keyword.Token +' ' Text.Whitespace +'uniform' Keyword.Token +' ' Text.Whitespace +'double' Keyword.Type +' ' Text.Whitespace +'foo' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'8.0' Literal.Number +'\n\n' Text.Whitespace + +'custom' Keyword.Token +' ' Text.Whitespace +'double' Keyword.Type +' ' Text.Whitespace +'foo_underscore_name' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'8.0' Literal.Number +'\n\n' Text.Whitespace + +'double[]' Keyword.Type +' ' Text.Whitespace +'foo_underscore_name' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'[' Punctuation +'10.1' Literal.Number +',' Punctuation +' ' Text.Whitespace +'12.0' Literal.Number +',' Punctuation +' ' Text.Whitespace +'13' Literal.Number +']' Punctuation +'\n\n' Text.Whitespace + +'double[]' Keyword.Type +' ' Text.Whitespace +'primvar:foo_thing' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'[' Punctuation +'10.1' Literal.Number +',' Punctuation +' ' Text.Whitespace +'12.0' Literal.Number +',' Punctuation +' ' Text.Whitespace +'13' Literal.Number +']' Punctuation +'\n\n' Text.Whitespace + +'custom' Keyword.Token +' ' Text.Whitespace +'int[]' Keyword.Type +' ' Text.Whitespace +'foo' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'[' Punctuation +'8' Literal.Number +',' Punctuation +' ' Text.Whitespace +'10' Literal.Number +',' Punctuation +' ' Text.Whitespace +'14' Literal.Number +']' Punctuation +'\n\n' Text.Whitespace + +'custom' Keyword.Token +' ' Text.Whitespace +'int[]' Keyword.Type +' ' Text.Whitespace +'foo' Name.Attribute +'.' Text +'timeSamples' Name.Keyword.Tokens +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'{' Punctuation +'\n ' Text.Whitespace +'1' Literal.Number +':' Punctuation +' ' Text.Whitespace +'[' Punctuation +'8' Literal.Number +',' Punctuation +' ' Text.Whitespace +'0' Literal.Number +',' Punctuation +' ' Text.Whitespace +'14' Literal.Number +']' Punctuation +',' Punctuation +'\n ' Text.Whitespace +'2' Literal.Number +':' Punctuation +' ' Text.Whitespace +'[' Punctuation +'-8' Literal.Number +',' Punctuation +' ' Text.Whitespace +'0' Literal.Number +',' Punctuation +' ' Text.Whitespace +'14' Literal.Number +']' Punctuation +',' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/usd/test_composition_arcs.txt b/tests/snippets/usd/test_composition_arcs.txt new file mode 100644 index 0000000..0270c93 --- /dev/null +++ b/tests/snippets/usd/test_composition_arcs.txt @@ -0,0 +1,101 @@ +---input--- +def Xform "BottleMedical" ( + kind = "prop" + payload = @./BottleMedical_payload.usd@</BottleMedical> + variants = { + string modelingVariant = "LiquidBottleLg" + string shadingComplexity = "full" + } + add variantSets = ["modelingVariant", "shadingComplexity"] +) +{ + variantSet "modelingVariant" = { + "ALL_VARIANTS" { + } + } +} + +---tokens--- +'def' Keyword.Tokens +' ' Text.Whitespace +'Xform' Text +' ' Text.Whitespace +'"BottleMedical"' Literal.String +' ' Text.Whitespace +'(' Punctuation +'\n ' Text.Whitespace +'kind' Name.Builtins +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"prop"' Literal.String +'\n ' Text.Whitespace +'payload' Keyword.Tokens +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'@./BottleMedical_payload.usd@' Literal.String.Interpol +'</BottleMedical>' Name.Namespace +'\n ' Text.Whitespace +'variants' Keyword.Tokens +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'{' Punctuation +'\n ' Text.Whitespace +'string' Keyword.Type +' ' Text.Whitespace +'modelingVariant' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"LiquidBottleLg"' Literal.String +'\n ' Text.Whitespace +'string' Keyword.Type +' ' Text.Whitespace +'shadingComplexity' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"full"' Literal.String +'\n ' Text.Whitespace +'}' Punctuation +'\n ' Text.Whitespace +'add' Keyword.Type +' ' Text.Whitespace +'variantSets' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'[' Punctuation +'"modelingVariant"' Literal.String +',' Punctuation +' ' Text.Whitespace +'"shadingComplexity"' Literal.String +']' Punctuation +'\n' Text.Whitespace + +')' Punctuation +'\n' Text.Whitespace + +'{' Punctuation +'\n ' Text.Whitespace +'variantSet' Keyword.Tokens +' ' Text.Whitespace +'"modelingVariant"' Literal.String +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'{' Punctuation +'\n ' Text.Whitespace +'"ALL_VARIANTS"' Literal.String +' ' Text.Whitespace +'{' Punctuation +'\n ' Text.Whitespace +'}' Punctuation +'\n ' Text.Whitespace +'}' Punctuation +'\n' Text.Whitespace + +'}' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/usd/test_metadata.txt b/tests/snippets/usd/test_metadata.txt new file mode 100644 index 0000000..edc4614 --- /dev/null +++ b/tests/snippets/usd/test_metadata.txt @@ -0,0 +1,36 @@ +# Make sure metadata [the stuff inside ()s] don't match as Attributes. + +---input--- +float[] primvars:skel:jointWeights = [1] ( + elementSize = 1 + interpolation = "constant" +) + +---tokens--- +'float[]' Keyword.Type +' ' Text.Whitespace +'primvars:skel:jointWeights' Name.Attribute +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'[' Punctuation +'1' Literal.Number +']' Punctuation +' ' Text.Whitespace +'(' Punctuation +'\n ' Text.Whitespace +'elementSize' Name.Builtins +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'1' Literal.Number +'\n ' Text.Whitespace +'interpolation' Name.Builtins +' ' Text.Whitespace +'=' Operator +' ' Text.Whitespace +'"constant"' Literal.String +'\n' Text.Whitespace + +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/usd/test_numbers.txt b/tests/snippets/usd/test_numbers.txt new file mode 100644 index 0000000..a4e0f88 --- /dev/null +++ b/tests/snippets/usd/test_numbers.txt @@ -0,0 +1,21 @@ +---input--- +8 8.0123312132, -4 -14.123 1e10 0.1e10 10.123e+10 0.123e-14 + +---tokens--- +'8' Literal.Number +' ' Text.Whitespace +'8.0123312132' Literal.Number +',' Punctuation +' ' Text.Whitespace +'-4' Literal.Number +' ' Text.Whitespace +'-14.123' Literal.Number +' ' Text.Whitespace +'1e10' Literal.Number +' ' Text.Whitespace +'0.1e10' Literal.Number +' ' Text.Whitespace +'10.123e+10' Literal.Number +' ' Text.Whitespace +'0.123e-14' Literal.Number +'\n' Text.Whitespace diff --git a/tests/snippets/usd/test_outer_match_at_sign.txt b/tests/snippets/usd/test_outer_match_at_sign.txt new file mode 100644 index 0000000..de0bc72 --- /dev/null +++ b/tests/snippets/usd/test_outer_match_at_sign.txt @@ -0,0 +1,14 @@ +# Make sure that text between located between quotes and @@s are not matched. + +---input--- +@firststring@ something else @secondstring@ + +---tokens--- +'@firststring@' Literal.String.Interpol +' ' Text.Whitespace +'something' Text +' ' Text.Whitespace +'else' Text +' ' Text.Whitespace +'@secondstring@' Literal.String.Interpol +'\n' Text.Whitespace diff --git a/tests/snippets/usd/test_outer_match_double.txt b/tests/snippets/usd/test_outer_match_double.txt new file mode 100644 index 0000000..773da13 --- /dev/null +++ b/tests/snippets/usd/test_outer_match_double.txt @@ -0,0 +1,12 @@ +---input--- +'firststring' something else 'secondstring' + +---tokens--- +"'firststring'" Literal.String +' ' Text.Whitespace +'something' Text +' ' Text.Whitespace +'else' Text +' ' Text.Whitespace +"'secondstring'" Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/usd/test_outer_match_single.txt b/tests/snippets/usd/test_outer_match_single.txt new file mode 100644 index 0000000..773da13 --- /dev/null +++ b/tests/snippets/usd/test_outer_match_single.txt @@ -0,0 +1,12 @@ +---input--- +'firststring' something else 'secondstring' + +---tokens--- +"'firststring'" Literal.String +' ' Text.Whitespace +'something' Text +' ' Text.Whitespace +'else' Text +' ' Text.Whitespace +"'secondstring'" Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/usd/test_string_multiple_line.txt b/tests/snippets/usd/test_string_multiple_line.txt new file mode 100644 index 0000000..b3ab1fd --- /dev/null +++ b/tests/snippets/usd/test_string_multiple_line.txt @@ -0,0 +1,20 @@ +---input--- +""" +Some text multiline +""" + +"""Some text multiline +""" + +""" +Some text multiline""" + +---tokens--- +'"""\nSome text multiline\n"""' Literal.String +'\n\n' Text.Whitespace + +'"""Some text multiline\n"""' Literal.String +'\n\n' Text.Whitespace + +'"""\nSome text multiline"""' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/usd/test_string_priority.txt b/tests/snippets/usd/test_string_priority.txt new file mode 100644 index 0000000..481a416 --- /dev/null +++ b/tests/snippets/usd/test_string_priority.txt @@ -0,0 +1,10 @@ +# Make sure that no other rules override a string match. + +---input--- +""" +custom int[] foo = [8, 10, 14] +""" + +---tokens--- +'"""\ncustom int[] foo = [8, 10, 14]\n"""' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/usd/test_string_single_line.txt b/tests/snippets/usd/test_string_single_line.txt new file mode 100644 index 0000000..b5058ce --- /dev/null +++ b/tests/snippets/usd/test_string_single_line.txt @@ -0,0 +1,6 @@ +---input--- +"Some 'text" + +---tokens--- +'"Some \'text"' Literal.String +'\n' Text.Whitespace diff --git a/tests/snippets/vbscript/test_floats.txt b/tests/snippets/vbscript/test_floats.txt new file mode 100644 index 0000000..9493a3b --- /dev/null +++ b/tests/snippets/vbscript/test_floats.txt @@ -0,0 +1,34 @@ +---input--- +1. +1.e1 +.1 +1.2 +1.2e3 +1.2e+3 +1.2e-3 +1e2 + +---tokens--- +'1.' Literal.Number.Float +'\n' Text.Whitespace + +'1.e1' Literal.Number.Float +'\n' Text.Whitespace + +'.1' Literal.Number.Float +'\n' Text.Whitespace + +'1.2' Literal.Number.Float +'\n' Text.Whitespace + +'1.2e3' Literal.Number.Float +'\n' Text.Whitespace + +'1.2e+3' Literal.Number.Float +'\n' Text.Whitespace + +'1.2e-3' Literal.Number.Float +'\n' Text.Whitespace + +'1e2' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/vbscript/test_floats_multiple.txt b/tests/snippets/vbscript/test_floats_multiple.txt new file mode 100644 index 0000000..30a3708 --- /dev/null +++ b/tests/snippets/vbscript/test_floats_multiple.txt @@ -0,0 +1,7 @@ +---input--- +1e2.1e2 + +---tokens--- +'1e2' Literal.Number.Float +'.1e2' Literal.Number.Float +'\n' Text.Whitespace diff --git a/tests/snippets/vbscript/test_integers.txt b/tests/snippets/vbscript/test_integers.txt new file mode 100644 index 0000000..132ef7e --- /dev/null +++ b/tests/snippets/vbscript/test_integers.txt @@ -0,0 +1,14 @@ +---input--- +1 +23 +456 + +---tokens--- +'1' Literal.Number.Integer +'\n' Text.Whitespace + +'23' Literal.Number.Integer +'\n' Text.Whitespace + +'456' Literal.Number.Integer +'\n' Text.Whitespace diff --git a/tests/snippets/vbscript/test_invalid_character.txt b/tests/snippets/vbscript/test_invalid_character.txt new file mode 100644 index 0000000..6a1e6f1 --- /dev/null +++ b/tests/snippets/vbscript/test_invalid_character.txt @@ -0,0 +1,10 @@ +---input--- +a;bc +d + +---tokens--- +'a' Name +';bc\n' Error + +'d' Name +'\n' Text.Whitespace diff --git a/tests/snippets/vbscript/test_names.txt b/tests/snippets/vbscript/test_names.txt new file mode 100644 index 0000000..404844f --- /dev/null +++ b/tests/snippets/vbscript/test_names.txt @@ -0,0 +1,18 @@ +---input--- +thingy +thingy123 +_thingy +_123 + +---tokens--- +'thingy' Name +'\n' Text.Whitespace + +'thingy123' Name +'\n' Text.Whitespace + +'_thingy' Name +'\n' Text.Whitespace + +'_123' Name +'\n' Text.Whitespace diff --git a/tests/snippets/vbscript/test_reject_almost_float.txt b/tests/snippets/vbscript/test_reject_almost_float.txt new file mode 100644 index 0000000..478e6a3 --- /dev/null +++ b/tests/snippets/vbscript/test_reject_almost_float.txt @@ -0,0 +1,7 @@ +---input--- +.e1 + +---tokens--- +'.' Punctuation +'e1' Name +'\n' Text.Whitespace diff --git a/tests/snippets/vbscript/test_unterminated_string.txt b/tests/snippets/vbscript/test_unterminated_string.txt new file mode 100644 index 0000000..e92060b --- /dev/null +++ b/tests/snippets/vbscript/test_unterminated_string.txt @@ -0,0 +1,7 @@ +---input--- +"x\nx + +---tokens--- +'"' Literal.String.Double +'x\\nx' Literal.String.Double +'\n' Error diff --git a/tests/snippets/wat/test_align_and_offset_accept_hexadecimal_numbers.txt b/tests/snippets/wat/test_align_and_offset_accept_hexadecimal_numbers.txt new file mode 100644 index 0000000..919e1d2 --- /dev/null +++ b/tests/snippets/wat/test_align_and_offset_accept_hexadecimal_numbers.txt @@ -0,0 +1,14 @@ +---input--- +i32.store offset=0xdeadbeef align=0x1 + +---tokens--- +'i32.store' Name.Builtin +' ' Text +'offset' Keyword +'=' Operator +'0xdeadbeef' Literal.Number.Hex +' ' Text +'align' Keyword +'=' Operator +'0x1' Literal.Number.Hex +'\n' Text diff --git a/tests/snippets/wat/test_comment_with_open_paren.txt b/tests/snippets/wat/test_comment_with_open_paren.txt new file mode 100644 index 0000000..631de4c --- /dev/null +++ b/tests/snippets/wat/test_comment_with_open_paren.txt @@ -0,0 +1,10 @@ +---input--- +(; comment with ( open paren ;) + +---tokens--- +'(;' Comment.Multiline +' comment with ' Comment.Multiline +'(' Comment.Multiline +' open paren ' Comment.Multiline +';)' Comment.Multiline +'\n' Text diff --git a/tests/snippets/wat/test_comment_with_semicolon.txt b/tests/snippets/wat/test_comment_with_semicolon.txt new file mode 100644 index 0000000..0cd3112 --- /dev/null +++ b/tests/snippets/wat/test_comment_with_semicolon.txt @@ -0,0 +1,10 @@ +---input--- +(; comment with ; semicolon ;) + +---tokens--- +'(;' Comment.Multiline +' comment with ' Comment.Multiline +';' Comment.Multiline +' semicolon ' Comment.Multiline +';)' Comment.Multiline +'\n' Text diff --git a/tests/snippets/wat/test_i32_const_is_builtin.txt b/tests/snippets/wat/test_i32_const_is_builtin.txt new file mode 100644 index 0000000..740907c --- /dev/null +++ b/tests/snippets/wat/test_i32_const_is_builtin.txt @@ -0,0 +1,6 @@ +---input--- +i32.const + +---tokens--- +'i32.const' Name.Builtin +'\n' Text diff --git a/tests/snippets/wat/test_multiline_comment.txt b/tests/snippets/wat/test_multiline_comment.txt new file mode 100644 index 0000000..6cbd45e --- /dev/null +++ b/tests/snippets/wat/test_multiline_comment.txt @@ -0,0 +1,11 @@ +---input--- +(; + comment +;) + +---tokens--- +'(;' Comment.Multiline +'\n comment\n' Comment.Multiline + +';)' Comment.Multiline +'\n' Text diff --git a/tests/snippets/wat/test_nested_comment.txt b/tests/snippets/wat/test_nested_comment.txt new file mode 100644 index 0000000..de07293 --- /dev/null +++ b/tests/snippets/wat/test_nested_comment.txt @@ -0,0 +1,14 @@ +---input--- +(; +nested(;;)comment +;) + +---tokens--- +'(;' Comment.Multiline +'\nnested' Comment.Multiline +'(;' Comment.Multiline +';)' Comment.Multiline +'comment\n' Comment.Multiline + +';)' Comment.Multiline +'\n' Text diff --git a/tests/snippets/wat/test_string_byte_escape.txt b/tests/snippets/wat/test_string_byte_escape.txt new file mode 100644 index 0000000..c0b9e4a --- /dev/null +++ b/tests/snippets/wat/test_string_byte_escape.txt @@ -0,0 +1,9 @@ +---input--- +"\001" + +---tokens--- +'"' Literal.String.Double +'\\00' Literal.String.Escape +'1' Literal.String.Double +'"' Literal.String.Double +'\n' Text diff --git a/tests/snippets/wat/test_string_with_escape.txt b/tests/snippets/wat/test_string_with_escape.txt new file mode 100644 index 0000000..c978faa --- /dev/null +++ b/tests/snippets/wat/test_string_with_escape.txt @@ -0,0 +1,9 @@ +---input--- +"string\t" + +---tokens--- +'"' Literal.String.Double +'string' Literal.String.Double +'\\t' Literal.String.Escape +'"' Literal.String.Double +'\n' Text diff --git a/tests/snippets/wat/test_variable_name_pattern.txt b/tests/snippets/wat/test_variable_name_pattern.txt new file mode 100644 index 0000000..d305ab9 --- /dev/null +++ b/tests/snippets/wat/test_variable_name_pattern.txt @@ -0,0 +1,6 @@ +---input--- +$ABCabc123!#$%&'*+./:<=>?@\\^_`|~-A + +---tokens--- +"$ABCabc123!#$%&'*+./:<=>?@\\\\^_`|~-A" Name.Variable +'\n' Text diff --git a/tests/snippets/whiley/test_whiley_operator.txt b/tests/snippets/whiley/test_whiley_operator.txt new file mode 100644 index 0000000..50761db --- /dev/null +++ b/tests/snippets/whiley/test_whiley_operator.txt @@ -0,0 +1,10 @@ +---input--- +123 ∀ x + +---tokens--- +'123' Literal.Number.Integer +' ' Text +'∀' Operator +' ' Text +'x' Name +'\n' Text diff --git a/tests/snippets/wren/lonely-paren.txt b/tests/snippets/wren/lonely-paren.txt new file mode 100644 index 0000000..5236e60 --- /dev/null +++ b/tests/snippets/wren/lonely-paren.txt @@ -0,0 +1,10 @@ +---input--- +// This invalid input should terminate. +) + +---tokens--- +'// This invalid input should terminate.' Comment.Single +'\n' Text.Whitespace + +')' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/xml/multiline-comment-catastrophic-backtracking.txt b/tests/snippets/xml/multiline-comment-catastrophic-backtracking.txt new file mode 100644 index 0000000..d9a8b7a --- /dev/null +++ b/tests/snippets/xml/multiline-comment-catastrophic-backtracking.txt @@ -0,0 +1,56 @@ +---input--- +<!-- +this +comment +is +never +terminated +... + + + + + + + + + + + + + + + + + + + + + +... + +---tokens--- +'<' Error +'!--' Text +'\n' Text.Whitespace + +'this' Text +'\n' Text.Whitespace + +'comment' Text +'\n' Text.Whitespace + +'is' Text +'\n' Text.Whitespace + +'never' Text +'\n' Text.Whitespace + +'terminated' Text +'\n' Text.Whitespace + +'...' Text +'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' Text.Whitespace + +'...' Text +'\n' Text.Whitespace diff --git a/tests/snippets/yaml/test_yaml.txt b/tests/snippets/yaml/test_yaml.txt new file mode 100644 index 0000000..0dd3911 --- /dev/null +++ b/tests/snippets/yaml/test_yaml.txt @@ -0,0 +1,13 @@ +# Bug #1528: This previously parsed 'token # innocent' as a tag + +---input--- +here: token # innocent: comment + +---tokens--- +'here' Name.Tag +':' Punctuation +' ' Text.Whitespace +'token' Literal.Scalar.Plain +' ' Text.Whitespace +'# innocent: comment' Comment.Single +'\n' Text.Whitespace diff --git a/tests/snippets/yaml/test_yaml_colon_in_key.txt b/tests/snippets/yaml/test_yaml_colon_in_key.txt new file mode 100644 index 0000000..9f3d313 --- /dev/null +++ b/tests/snippets/yaml/test_yaml_colon_in_key.txt @@ -0,0 +1,11 @@ +# Colon in the key name is accepted by the YAML specs too + +---input--- +foo:bar: value + +---tokens--- +'foo:bar' Name.Tag +':' Punctuation +' ' Text.Whitespace +'value' Literal.Scalar.Plain +'\n' Text.Whitespace diff --git a/tests/snippets/yaml/test_yaml_colon_in_key_double.txt b/tests/snippets/yaml/test_yaml_colon_in_key_double.txt new file mode 100644 index 0000000..6f68b6d --- /dev/null +++ b/tests/snippets/yaml/test_yaml_colon_in_key_double.txt @@ -0,0 +1,11 @@ +# Colons in the key name is accepted by the YAML specs too + +---input--- +foo::bar: value + +---tokens--- +'foo::bar' Name.Tag +':' Punctuation +' ' Text.Whitespace +'value' Literal.Scalar.Plain +'\n' Text.Whitespace diff --git a/tests/snippets/yaml/test_yaml_colon_in_key_start.txt b/tests/snippets/yaml/test_yaml_colon_in_key_start.txt new file mode 100644 index 0000000..60d4e23 --- /dev/null +++ b/tests/snippets/yaml/test_yaml_colon_in_key_start.txt @@ -0,0 +1,11 @@ +# Colon at the beginning of the key name is accepted by the YAML specs too + +---input--- +:foo: value + +---tokens--- +':foo' Name.Tag +':' Punctuation +' ' Text.Whitespace +'value' Literal.Scalar.Plain +'\n' Text.Whitespace diff --git a/tests/snippets/yang/test_float_value.txt b/tests/snippets/yang/test_float_value.txt new file mode 100644 index 0000000..b49f479 --- /dev/null +++ b/tests/snippets/yang/test_float_value.txt @@ -0,0 +1,11 @@ +# Float value `1.1` should be explicitly highlighted + +---input--- +yang-version 1.1; + +---tokens--- +'yang-version' Keyword +' ' Text.Whitespace +'1.1' Literal.Number.Float +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/yang/test_integer_value.txt b/tests/snippets/yang/test_integer_value.txt new file mode 100644 index 0000000..149d19c --- /dev/null +++ b/tests/snippets/yang/test_integer_value.txt @@ -0,0 +1,11 @@ +# Integer value `5` should be explicitly highlighted + +---input--- +value 5; + +---tokens--- +'value' Keyword +' ' Text.Whitespace +'5' Literal.Number.Integer +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/yang/test_namespace_1.txt b/tests/snippets/yang/test_namespace_1.txt new file mode 100644 index 0000000..1caf138 --- /dev/null +++ b/tests/snippets/yang/test_namespace_1.txt @@ -0,0 +1,11 @@ +# Namespace `urn:test:std:yang` should not be explicitly highlighted + +---input--- +namespace urn:test:std:yang; + +---tokens--- +'namespace' Keyword +' ' Text.Whitespace +'urn:test:std:yang' Name.Variable +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/yang/test_namespace_2.txt b/tests/snippets/yang/test_namespace_2.txt new file mode 100644 index 0000000..a245f7c --- /dev/null +++ b/tests/snippets/yang/test_namespace_2.txt @@ -0,0 +1,13 @@ +# namespace-prefix `yang` should be explicitly highlighted + +---input--- +type yang:counter64; + +---tokens--- +'type' Keyword +' ' Text.Whitespace +'yang' Name.Namespace +':' Punctuation +'counter64' Name.Variable +';' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/yang/test_revision_date.txt b/tests/snippets/yang/test_revision_date.txt new file mode 100644 index 0000000..09ff5a6 --- /dev/null +++ b/tests/snippets/yang/test_revision_date.txt @@ -0,0 +1,11 @@ +# Revision-date `2020-08-03` should be explicitly highlighted + +---input--- +revision 2020-03-08{ + +---tokens--- +'revision' Keyword +' ' Text.Whitespace +'2020-03-08' Name.Label +'{' Punctuation +'\n' Text.Whitespace diff --git a/tests/snippets/yang/test_string_value.txt b/tests/snippets/yang/test_string_value.txt new file mode 100644 index 0000000..41dcae5 --- /dev/null +++ b/tests/snippets/yang/test_string_value.txt @@ -0,0 +1,11 @@ +# String value `"5"` should be not explicitly highlighted + +---input--- +value "5"; + +---tokens--- +'value' Keyword +' ' Text.Whitespace +'"5"' Literal.String.Double +';' Punctuation +'\n' Text.Whitespace |