diff options
author | Maxime Kjaer <maxime.kjaer@gmail.com> | 2021-03-01 11:39:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-01 11:39:20 +0100 |
commit | 37113b095ee9a445187a8478589010347b7a9687 (patch) | |
tree | 29538f8314345a1a4bcb62406dd58b336107f0a2 /tests/snippets/scala | |
parent | c1a0d82acbe6fa026a1f6843fee00cc1df626549 (diff) | |
download | pygments-git-37113b095ee9a445187a8478589010347b7a9687.tar.gz |
Rewrite Scala lexer for Scala 3 (#1694)
Diffstat (limited to 'tests/snippets/scala')
17 files changed, 220 insertions, 0 deletions
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 00000000..eeebed2e --- /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 +'::' Name.Function +'(' Punctuation +'xs' Name +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +')' Punctuation +':' Punctuation +' ' Text +'List' Name.Class +'[' Punctuation +'T' Name.Class +']' Punctuation +' ' Text +'=' Operator +' ' Text +'::' Name +'(' Punctuation +'x' Name +',' Punctuation +' ' Text +'xs' Name +')' Punctuation +'\n' Text diff --git a/tests/snippets/scala/test_default_parameter.txt b/tests/snippets/scala/test_default_parameter.txt new file mode 100644 index 00000000..a82e5a06 --- /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 +'f' Name.Function +'(' Punctuation +'using' Keyword +' ' Text +'y' Name +':' Punctuation +' ' Text +'Char' Name.Class +' ' Text +'=' Operator +' ' Text +'if' Keyword +' ' Text +'true' Keyword.Constant +' ' Text +'then' Keyword +' ' Text +"'a'" Literal.String.Char +' ' Text +'else' Keyword +' ' Text +'2' Literal.Number.Integer +')' Punctuation +':' Punctuation +' ' Text +'Int' Name.Class +' ' Text +'=' Operator +' ' Text +'???' Operator +'\n' Text diff --git a/tests/snippets/scala/test_end_val.txt b/tests/snippets/scala/test_end_val.txt new file mode 100644 index 00000000..112cfafa --- /dev/null +++ b/tests/snippets/scala/test_end_val.txt @@ -0,0 +1,8 @@ +---input--- +end val + +---tokens--- +'end' Keyword +' ' Text +'val' Keyword +'\n' Text diff --git a/tests/snippets/scala/test_end_valx.txt b/tests/snippets/scala/test_end_valx.txt new file mode 100644 index 00000000..e72c4041 --- /dev/null +++ b/tests/snippets/scala/test_end_valx.txt @@ -0,0 +1,8 @@ +---input--- +end valx + +---tokens--- +'end' Keyword +' ' Text +'valx' Name.Namespace +'\n' Text 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 00000000..9a702431 --- /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 +'.1e+34' Literal.Number.Float +' ' Text +'.1e-56' Literal.Number.Float +' ' Text +'.1e12f' Literal.Number.Float +'\n' Text 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 00000000..a1823f03 --- /dev/null +++ b/tests/snippets/scala/test_function_operator_name.txt @@ -0,0 +1,18 @@ +---input--- +def < (y: String): Boolean + +---tokens--- +'def' Keyword +' ' Text +'<' Name.Function +' ' Text +'(' Punctuation +'y' Name +':' Punctuation +' ' Text +'String' Name.Class +')' Punctuation +':' Punctuation +' ' Text +'Boolean' Name.Class +'\n' Text diff --git a/tests/snippets/scala/test_import_path.txt b/tests/snippets/scala/test_import_path.txt new file mode 100644 index 00000000..fc8e5a2c --- /dev/null +++ b/tests/snippets/scala/test_import_path.txt @@ -0,0 +1,12 @@ +---input--- +import a.b.c + +---tokens--- +'import' Keyword +' ' Text +'a' Name.Namespace +'.' Punctuation +'b' Name.Namespace +'.' Punctuation +'c' Name +'\n' Text 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 00000000..9af24e53 --- /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 +"//'\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 00000000..800880ee --- /dev/null +++ b/tests/snippets/scala/test_open_soft_keyword.txt @@ -0,0 +1,12 @@ +---input--- +val open = true + +---tokens--- +'val' Keyword.Declaration +' ' Text +'open' Name +' ' Text +'=' Operator +' ' Text +'true' Keyword.Constant +'\n' Text diff --git a/tests/snippets/scala/test_package_name.txt b/tests/snippets/scala/test_package_name.txt new file mode 100644 index 00000000..6b1f3482 --- /dev/null +++ b/tests/snippets/scala/test_package_name.txt @@ -0,0 +1,11 @@ +---input--- +package p1.p2: + +---tokens--- +'package' Keyword +' ' Text +'p1' Name.Namespace +'.' Punctuation +'p2' Name +':' Punctuation +'\n' Text diff --git a/tests/snippets/scala/test_prepend_operator.txt b/tests/snippets/scala/test_prepend_operator.txt new file mode 100644 index 00000000..db850479 --- /dev/null +++ b/tests/snippets/scala/test_prepend_operator.txt @@ -0,0 +1,10 @@ +---input--- +a +: b + +---tokens--- +'a' Name +' ' Text +'+:' Operator +' ' Text +'b' Name +'\n' Text diff --git a/tests/snippets/scala/test_qualified_name.txt b/tests/snippets/scala/test_qualified_name.txt new file mode 100644 index 00000000..8a1f06ff --- /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 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 00000000..b9d47c94 --- /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 diff --git a/tests/snippets/scala/test_script_header.txt b/tests/snippets/scala/test_script_header.txt new file mode 100644 index 00000000..f15ded80 --- /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 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 00000000..5d8a14f5 --- /dev/null +++ b/tests/snippets/scala/test_symbol_followed_by_op.txt @@ -0,0 +1,7 @@ +---input--- +symbol* + +---tokens--- +'symbol' Name +'*' Operator +'\n' Text 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 00000000..bb1d987f --- /dev/null +++ b/tests/snippets/scala/test_symbol_name_ending_with_star.txt @@ -0,0 +1,6 @@ +---input--- +symbol_* + +---tokens--- +'symbol_*' Name +'\n' Text diff --git a/tests/snippets/scala/test_underscore_name.txt b/tests/snippets/scala/test_underscore_name.txt new file mode 100644 index 00000000..f27754fd --- /dev/null +++ b/tests/snippets/scala/test_underscore_name.txt @@ -0,0 +1,12 @@ +---input--- +val head = _head + +---tokens--- +'val' Keyword.Declaration +' ' Text +'head' Name +' ' Text +'=' Operator +' ' Text +'_head' Name +'\n' Text |