mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-18 22:23:07 -03:00
Reorganize tests into a real spec suite
This commit is contained in:
@ -1,9 +1,112 @@
|
||||
require "./spec_helper"
|
||||
|
||||
describe Tartrazine do
|
||||
# TODO: Write tests
|
||||
# These are the testcases from Pygments
|
||||
testcases = Dir.glob("#{__DIR__}/tests/**/*txt").sort
|
||||
|
||||
it "works" do
|
||||
false.should eq(true)
|
||||
# These lexers don't load because of parsing issues
|
||||
failing_lexers = {
|
||||
"webgpu_shading_language",
|
||||
}
|
||||
|
||||
# These testcases fail because of differences in the way chroma and tartrazine
|
||||
# represent unicode, but they are actually correct
|
||||
unicode_problems = {
|
||||
"#{__DIR__}/tests/java/test_string_literals.txt",
|
||||
"#{__DIR__}/tests/json/test_strings.txt",
|
||||
"#{__DIR__}/tests/systemd/example1.txt",
|
||||
}
|
||||
|
||||
# These testcases fail because of differences in the way chroma and tartrazine tokenize
|
||||
# but tartrazine is correct
|
||||
bad_in_chroma = {
|
||||
"#{__DIR__}/tests/bash_session/test_comment_after_prompt.txt",
|
||||
"#{__DIR__}/tests/java/test_default.txt",
|
||||
"#{__DIR__}/tests/java/test_multiline_string.txt",
|
||||
"#{__DIR__}/tests/java/test_numeric_literals.txt",
|
||||
"#{__DIR__}/tests/php/test_string_escaping_run.txt",
|
||||
"#{__DIR__}/tests/python_2/test_cls_builtin.txt",
|
||||
}
|
||||
|
||||
known_bad = {
|
||||
"#{__DIR__}/tests/bash_session/fake_ps2_prompt.txt",
|
||||
"#{__DIR__}/tests/bash_session/prompt_in_output.txt",
|
||||
"#{__DIR__}/tests/bash_session/test_newline_in_echo_no_ps2.txt",
|
||||
"#{__DIR__}/tests/bash_session/test_newline_in_ls_ps2.txt",
|
||||
"#{__DIR__}/tests/bash_session/ps2_prompt.txt",
|
||||
"#{__DIR__}/tests/bash_session/test_newline_in_ls_no_ps2.txt",
|
||||
"#{__DIR__}/tests/bash_session/test_virtualenv.txt",
|
||||
"#{__DIR__}/tests/bash_session/test_newline_in_echo_ps2.txt",
|
||||
"#{__DIR__}/tests/c/test_string_resembling_decl_end.txt",
|
||||
"#{__DIR__}/tests/html/css_backtracking.txt",
|
||||
"#{__DIR__}/tests/mcfunction/data.txt",
|
||||
"#{__DIR__}/tests/mcfunction/selectors.txt",
|
||||
"#{__DIR__}/tests/php/anonymous_class.txt",
|
||||
"#{__DIR__}/tests/html/javascript_unclosed.txt",
|
||||
|
||||
}
|
||||
|
||||
# Tests that fail because of a limitation in PCRE2
|
||||
not_my_fault = {
|
||||
"#{__DIR__}/tests/fortran/test_string_cataback.txt",
|
||||
}
|
||||
|
||||
describe Tartrazine do
|
||||
describe "Lexer" do
|
||||
testcases.each do |testcase|
|
||||
if known_bad.includes?(testcase)
|
||||
pending "parses #{testcase}".split("/")[-2...].join("/") do
|
||||
end
|
||||
else
|
||||
it "parses #{testcase}".split("/")[-2...].join("/") do
|
||||
text = File.read(testcase).split("---input---\n").last.split("---tokens---").first
|
||||
lexer_name = File.basename(File.dirname(testcase)).downcase
|
||||
unless failing_lexers.includes?(lexer_name) ||
|
||||
unicode_problems.includes?(testcase) ||
|
||||
bad_in_chroma.includes?(testcase) ||
|
||||
not_my_fault.includes?(testcase)
|
||||
tokenize(lexer_name, text).should eq(chroma_tokenize(lexer_name, text))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Helper that creates lexer and tokenizes
|
||||
def tokenize(lexer_name, text)
|
||||
lexer = Tartrazine::Lexer.from_xml(File.read("lexers/#{lexer_name}.xml"))
|
||||
collapse_tokens(lexer.tokenize(text))
|
||||
end
|
||||
|
||||
# Helper that tokenizes using chroma to validate the lexer
|
||||
def chroma_tokenize(lexer_name, text)
|
||||
output = IO::Memory.new
|
||||
input = IO::Memory.new(text)
|
||||
Process.run(
|
||||
"chroma",
|
||||
["-f", "json", "-l", lexer_name],
|
||||
input: input, output: output
|
||||
)
|
||||
collapse_tokens(Array(Tartrazine::Token).from_json(output.to_s))
|
||||
end
|
||||
|
||||
# Collapse consecutive tokens of the same type for easier comparison
|
||||
def collapse_tokens(tokens : Array(Tartrazine::Token))
|
||||
result = [] of Tartrazine::Token
|
||||
|
||||
tokens.each do |token|
|
||||
if result.empty?
|
||||
result << token
|
||||
next
|
||||
end
|
||||
last = result.last
|
||||
if last[:type] == token[:type]
|
||||
new_token = {type: last[:type], value: last[:value] + token[:value]}
|
||||
result.pop
|
||||
result << new_token
|
||||
else
|
||||
result << token
|
||||
end
|
||||
end
|
||||
result
|
||||
end
|
||||
|
12
spec/tests/apacheconf/test_directive_no_args.txt
Normal file
12
spec/tests/apacheconf/test_directive_no_args.txt
Normal file
@ -0,0 +1,12 @@
|
||||
---input---
|
||||
Example
|
||||
ServerName localhost
|
||||
|
||||
---tokens---
|
||||
'Example' Name.Builtin
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'ServerName' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'localhost' Text
|
||||
'\n' Text.Whitespace
|
8
spec/tests/apacheconf/test_fix_lock_absolute_path.txt
Normal file
8
spec/tests/apacheconf/test_fix_lock_absolute_path.txt
Normal file
@ -0,0 +1,8 @@
|
||||
---input---
|
||||
LockFile /var/lock/apache2/accept.lock
|
||||
|
||||
---tokens---
|
||||
'LockFile' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'/var/lock/apache2/accept.lock' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
8
spec/tests/apacheconf/test_include_globs.txt
Normal file
8
spec/tests/apacheconf/test_include_globs.txt
Normal file
@ -0,0 +1,8 @@
|
||||
---input---
|
||||
Include /etc/httpd/conf.d/*.conf
|
||||
|
||||
---tokens---
|
||||
'Include' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'/etc/httpd/conf.d/*.conf' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
@ -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
|
8
spec/tests/apacheconf/test_multi_include_globs.txt
Normal file
8
spec/tests/apacheconf/test_multi_include_globs.txt
Normal file
@ -0,0 +1,8 @@
|
||||
---input---
|
||||
Include /etc/httpd/conf.d/*/*.conf
|
||||
|
||||
---tokens---
|
||||
'Include' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'/etc/httpd/conf.d/*/*.conf' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
8
spec/tests/apacheconf/test_multi_include_globs_root.txt
Normal file
8
spec/tests/apacheconf/test_multi_include_globs_root.txt
Normal file
@ -0,0 +1,8 @@
|
||||
---input---
|
||||
Include /*conf/*.conf
|
||||
|
||||
---tokens---
|
||||
'Include' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'/*conf/*.conf' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
20
spec/tests/apacheconf/test_multiline_argument.txt
Normal file
20
spec/tests/apacheconf/test_multiline_argument.txt
Normal file
@ -0,0 +1,20 @@
|
||||
---input---
|
||||
SecAction \
|
||||
"id:'900001', \
|
||||
phase:1, \
|
||||
t:none, \
|
||||
setvar:tx.critical_anomaly_score=5, \
|
||||
setvar:tx.error_anomaly_score=4, \
|
||||
setvar:tx.warning_anomaly_score=3, \
|
||||
setvar:tx.notice_anomaly_score=2, \
|
||||
nolog, \
|
||||
pass"
|
||||
|
||||
---tokens---
|
||||
'SecAction' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'\\\n' Text
|
||||
|
||||
' ' Text.Whitespace
|
||||
'"id:\'900001\', \\\n phase:1, \\\n t:none, \\\n setvar:tx.critical_anomaly_score=5, \\\n setvar:tx.error_anomaly_score=4, \\\n setvar:tx.warning_anomaly_score=3, \\\n setvar:tx.notice_anomaly_score=2, \\\n nolog, \\\n pass"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
12
spec/tests/apacheconf/test_multiline_comment.txt
Normal file
12
spec/tests/apacheconf/test_multiline_comment.txt
Normal file
@ -0,0 +1,12 @@
|
||||
---input---
|
||||
#SecAction \
|
||||
"id:'900004', \
|
||||
phase:1, \
|
||||
t:none, \
|
||||
setvar:tx.anomaly_score_blocking=on, \
|
||||
nolog, \
|
||||
pass"
|
||||
|
||||
---tokens---
|
||||
'#SecAction \\\n "id:\'900004\', \\\n phase:1, \\\n t:none, \\\n setvar:tx.anomaly_score_blocking=on, \\\n nolog, \\\n pass"' Comment
|
||||
'\n' Text.Whitespace
|
14
spec/tests/apacheconf/test_normal_scoped_directive.txt
Normal file
14
spec/tests/apacheconf/test_normal_scoped_directive.txt
Normal file
@ -0,0 +1,14 @@
|
||||
---input---
|
||||
<VirtualHost "test">
|
||||
</VirtualHost>
|
||||
|
||||
---tokens---
|
||||
'<VirtualHost' Name.Tag
|
||||
' ' Text.Whitespace
|
||||
'"test"' Literal.String
|
||||
'>' Name.Tag
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'</VirtualHost' Name.Tag
|
||||
'>' Name.Tag
|
||||
'\n' Text.Whitespace
|
26
spec/tests/apl/test_leading_underscore.txt
Normal file
26
spec/tests/apl/test_leading_underscore.txt
Normal file
@ -0,0 +1,26 @@
|
||||
---input---
|
||||
_op_←{_←⍺ ⍵⋄(⍺⍺ ⍺)+⍵⍵ ⍵}
|
||||
|
||||
---tokens---
|
||||
'_op_' Name.Variable
|
||||
'←' Keyword.Declaration
|
||||
'{' Keyword.Type
|
||||
'_' Name.Variable
|
||||
'←' Keyword.Declaration
|
||||
'⍺' Name.Builtin.Pseudo
|
||||
' ' Text.Whitespace
|
||||
'⍵' Name.Builtin.Pseudo
|
||||
'⋄' Punctuation
|
||||
'(' Punctuation
|
||||
'⍺' Name.Builtin.Pseudo
|
||||
'⍺' Name.Builtin.Pseudo
|
||||
' ' Text.Whitespace
|
||||
'⍺' Name.Builtin.Pseudo
|
||||
')' Punctuation
|
||||
'+' Operator
|
||||
'⍵' Name.Builtin.Pseudo
|
||||
'⍵' Name.Builtin.Pseudo
|
||||
' ' Text.Whitespace
|
||||
'⍵' Name.Builtin.Pseudo
|
||||
'}' Keyword.Type
|
||||
'\n' Text.Whitespace
|
34
spec/tests/awk/test_ternary.txt
Normal file
34
spec/tests/awk/test_ternary.txt
Normal file
@ -0,0 +1,34 @@
|
||||
---input---
|
||||
BEGIN {a = 5;b=6; print (a==b)? "a==b" : "a!=b"}
|
||||
|
||||
---tokens---
|
||||
'BEGIN' Name.Builtin
|
||||
' ' Text
|
||||
'{' Punctuation
|
||||
'a' Name.Other
|
||||
' ' Text
|
||||
'=' Operator
|
||||
' ' Text
|
||||
'5' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
'b' Name.Other
|
||||
'=' Operator
|
||||
'6' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
' ' Text
|
||||
'print' Keyword.Reserved
|
||||
' ' Text
|
||||
'(' Punctuation
|
||||
'a' Name.Other
|
||||
'==' Operator
|
||||
'b' Name.Other
|
||||
')' Punctuation
|
||||
'?' Operator
|
||||
' ' Text
|
||||
'"a==b"' Literal.String.Double
|
||||
' ' Text
|
||||
':' Operator
|
||||
' ' Text
|
||||
'"a!=b"' Literal.String.Double
|
||||
'}' Punctuation
|
||||
'\n' Text
|
14
spec/tests/bash/test_array_nums.txt
Normal file
14
spec/tests/bash/test_array_nums.txt
Normal file
@ -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
|
15
spec/tests/bash/test_curly_no_escape_and_quotes.txt
Normal file
15
spec/tests/bash/test_curly_no_escape_and_quotes.txt
Normal file
@ -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
|
13
spec/tests/bash/test_curly_with_escape.txt
Normal file
13
spec/tests/bash/test_curly_with_escape.txt
Normal file
@ -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
|
15
spec/tests/bash/test_end_of_line_nums.txt
Normal file
15
spec/tests/bash/test_end_of_line_nums.txt
Normal file
@ -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
|
672
spec/tests/bash/test_math.txt
Normal file
672
spec/tests/bash/test_math.txt
Normal file
@ -0,0 +1,672 @@
|
||||
---input---
|
||||
# TODO: Find git dir; global options
|
||||
# TODO: LIBEXECDIR or something
|
||||
GIT_DIR="${GIT_DIR:-.git}"
|
||||
|
||||
INDEX_VERSION=2
|
||||
|
||||
gitsort() (
|
||||
# This will still often be wrong
|
||||
LANG=C sort
|
||||
)
|
||||
|
||||
# Is it hacky? Hell yes. Is it POSIX? HELL YES.
|
||||
write_hex() {
|
||||
hex="$1"
|
||||
while [ -n "$hex" ]
|
||||
do
|
||||
cur=$(printf "%s" "$hex" | cut -c1-2)
|
||||
next=$(printf "%s" "$hex" | cut -c3-)
|
||||
printf "\\x$(printf "%s" "$cur")"
|
||||
hex="$next"
|
||||
done
|
||||
}
|
||||
|
||||
# Prints an integer to stdout in binary, big-endian
|
||||
write_int32() (
|
||||
n="$1"
|
||||
hex=$(printf "%08X" "$n")
|
||||
write_hex "$hex"
|
||||
)
|
||||
|
||||
write_int16() (
|
||||
n="$1"
|
||||
hex=$(printf "%04X" "$n")
|
||||
write_hex "$hex"
|
||||
)
|
||||
|
||||
read_text() (
|
||||
path="$1"
|
||||
offs="$2"
|
||||
len="$3"
|
||||
for oct in $(od -An -txC -N"$len" -j"$offs" "$index")
|
||||
do
|
||||
printf "\x$oct"
|
||||
done
|
||||
)
|
||||
|
||||
read_int16() (
|
||||
path="$1"
|
||||
offs="$2"
|
||||
i16=$(od -An -tdS -j"$offs" -N2 "$path" | tr -d ' ')
|
||||
i16=$((((i16>>8)&0xff) | ((i16<<8)&0xff00)))
|
||||
echo "$i16"
|
||||
)
|
||||
|
||||
read_int32() (
|
||||
path="$1"
|
||||
offs="$2"
|
||||
i32=$(od -An -tdI -j"$offs" -N4 "$path" | tr -d ' ')
|
||||
i32=$((((i32>>24)&0xff) |
|
||||
((i32<<8)&0xff0000) |
|
||||
((i32>>8)&0xff00) |
|
||||
((i32<<24)&0xff000000)))
|
||||
echo "$i32"
|
||||
)
|
||||
|
||||
read_hex() (
|
||||
path="$1"
|
||||
offs="$2"
|
||||
len="$3"
|
||||
od -An -txC -N"$len" -j"$offs" "$path" | tr -d ' \n'
|
||||
)
|
||||
|
||||
normalize_path() (
|
||||
path="$1"
|
||||
path="${path#./}"
|
||||
# TODO: Remove the leading / if fully qualified
|
||||
if [ "${path#.git}" != "$path" ]
|
||||
then
|
||||
printf '%s' 'Invalid path %s\n' "$path"
|
||||
exit 1
|
||||
fi
|
||||
printf "%s" "$path"
|
||||
)
|
||||
|
||||
---tokens---
|
||||
'# TODO: Find git dir; global options\n' Comment.Single
|
||||
|
||||
'# TODO: LIBEXECDIR or something\n' Comment.Single
|
||||
|
||||
'GIT_DIR' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'${' Literal.String.Interpol
|
||||
'GIT_DIR' Name.Variable
|
||||
':-' Keyword
|
||||
'.git' Punctuation
|
||||
'}' Literal.String.Interpol
|
||||
'"' Literal.String.Double
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'INDEX_VERSION' Name.Variable
|
||||
'=' Operator
|
||||
'2' Literal.Number
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'gitsort' Text
|
||||
'(' Operator
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'(' Operator
|
||||
'\n\t' Text.Whitespace
|
||||
'# This will still often be wrong\n' Comment.Single
|
||||
|
||||
'\t' Text.Whitespace
|
||||
'LANG' Name.Variable
|
||||
'=' Operator
|
||||
'C' Text
|
||||
' ' Text.Whitespace
|
||||
'sort' Text
|
||||
'\n' Text.Whitespace
|
||||
|
||||
')' Operator
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'# Is it hacky? Hell yes. Is it POSIX? HELL YES.\n' Comment.Single
|
||||
|
||||
'write_hex' Text
|
||||
'(' Operator
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'{' Operator
|
||||
'\n\t' Text.Whitespace
|
||||
'hex' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'$1' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'while' Keyword
|
||||
' ' Text.Whitespace
|
||||
'[' Operator
|
||||
' ' Text.Whitespace
|
||||
'-n' Text
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$hex' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
']' Operator
|
||||
'\n\t' Text.Whitespace
|
||||
'do' Keyword
|
||||
'\n\t\t' Text.Whitespace
|
||||
'cur' Name.Variable
|
||||
'=' Operator
|
||||
'$(' Keyword
|
||||
'printf' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'"%s"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$hex' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'|' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'cut' Text
|
||||
' ' Text.Whitespace
|
||||
'-c1-2' Text
|
||||
')' Keyword
|
||||
'\n\t\t' Text.Whitespace
|
||||
'next' Name.Variable
|
||||
'=' Operator
|
||||
'$(' Keyword
|
||||
'printf' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'"%s"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$hex' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'|' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'cut' Text
|
||||
' ' Text.Whitespace
|
||||
'-c3-' Text
|
||||
')' Keyword
|
||||
'\n\t\t' Text.Whitespace
|
||||
'printf' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'\\\\x' Literal.String.Double
|
||||
'$(' Keyword
|
||||
'printf' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'"%s"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$cur' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
')' Keyword
|
||||
'"' Literal.String.Double
|
||||
'\n\t\t' Text.Whitespace
|
||||
'hex' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'$next' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'done' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Operator
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'# Prints an integer to stdout in binary, big-endian\n' Comment.Single
|
||||
|
||||
'write_int32' Text
|
||||
'(' Operator
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'(' Operator
|
||||
'\n\t' Text.Whitespace
|
||||
'n' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'$1' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'hex' Name.Variable
|
||||
'=' Operator
|
||||
'$(' Keyword
|
||||
'printf' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'"%08X"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$n' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
')' Keyword
|
||||
'\n\t' Text.Whitespace
|
||||
'write_hex' Text
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$hex' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
')' Operator
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'write_int16' Text
|
||||
'(' Operator
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'(' Operator
|
||||
'\n\t' Text.Whitespace
|
||||
'n' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'$1' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'hex' Name.Variable
|
||||
'=' Operator
|
||||
'$(' Keyword
|
||||
'printf' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'"%04X"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$n' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
')' Keyword
|
||||
'\n\t' Text.Whitespace
|
||||
'write_hex' Text
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$hex' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
')' Operator
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'read_text' Text
|
||||
'(' Operator
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'(' Operator
|
||||
'\n\t' Text.Whitespace
|
||||
'path' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'$1' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'offs' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'$2' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'len' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'$3' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'for' Keyword
|
||||
' ' Text.Whitespace
|
||||
'oct' Text
|
||||
' ' Text.Whitespace
|
||||
'in' Keyword
|
||||
' ' Text.Whitespace
|
||||
'$(' Keyword
|
||||
'od' Text
|
||||
' ' Text.Whitespace
|
||||
'-An' Text
|
||||
' ' Text.Whitespace
|
||||
'-txC' Text
|
||||
' ' Text.Whitespace
|
||||
'-N' Text
|
||||
'"' Literal.String.Double
|
||||
'$len' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'-j' Text
|
||||
'"' Literal.String.Double
|
||||
'$offs' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$index' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
')' Keyword
|
||||
'\n\t' Text.Whitespace
|
||||
'do' Keyword
|
||||
'\n\t\t' Text.Whitespace
|
||||
'printf' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'\\x' Literal.String.Double
|
||||
'$oct' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'done' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
')' Operator
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'read_int16' Text
|
||||
'(' Operator
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'(' Operator
|
||||
'\n\t' Text.Whitespace
|
||||
'path' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'$1' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'offs' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'$2' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'i16' Name.Variable
|
||||
'=' Operator
|
||||
'$(' Keyword
|
||||
'od' Text
|
||||
' ' Text.Whitespace
|
||||
'-An' Text
|
||||
' ' Text.Whitespace
|
||||
'-tdS' Text
|
||||
' ' Text.Whitespace
|
||||
'-j' Text
|
||||
'"' Literal.String.Double
|
||||
'$offs' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'-N2' Text
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$path' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'|' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'tr' Text
|
||||
' ' Text.Whitespace
|
||||
'-d' Text
|
||||
' ' Text.Whitespace
|
||||
"' '" Literal.String.Single
|
||||
')' Keyword
|
||||
'\n\t' Text.Whitespace
|
||||
'i16' Name.Variable
|
||||
'=' Operator
|
||||
'$((' Keyword
|
||||
'(' Operator
|
||||
'(' Operator
|
||||
'i16' Name.Variable
|
||||
'>>' Operator
|
||||
'8' Literal.Number
|
||||
')' Operator
|
||||
'&' Operator
|
||||
'0xff' Literal.Number
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'|' Operator
|
||||
' ' Text.Whitespace
|
||||
'(' Operator
|
||||
'(' Operator
|
||||
'i16' Name.Variable
|
||||
'<<' Operator
|
||||
'8' Literal.Number
|
||||
')' Operator
|
||||
'&' Operator
|
||||
'0xff00' Literal.Number
|
||||
'))' Keyword
|
||||
')' Operator
|
||||
'\n\t' Text.Whitespace
|
||||
'echo' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$i16' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
')' Operator
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'read_int32' Text
|
||||
'(' Operator
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'(' Operator
|
||||
'\n\t' Text.Whitespace
|
||||
'path' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'$1' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'offs' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'$2' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'i32' Name.Variable
|
||||
'=' Operator
|
||||
'$(' Keyword
|
||||
'od' Text
|
||||
' ' Text.Whitespace
|
||||
'-An' Text
|
||||
' ' Text.Whitespace
|
||||
'-tdI' Text
|
||||
' ' Text.Whitespace
|
||||
'-j' Text
|
||||
'"' Literal.String.Double
|
||||
'$offs' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'-N4' Text
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$path' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'|' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'tr' Text
|
||||
' ' Text.Whitespace
|
||||
'-d' Text
|
||||
' ' Text.Whitespace
|
||||
"' '" Literal.String.Single
|
||||
')' Keyword
|
||||
'\n\t' Text.Whitespace
|
||||
'i32' Name.Variable
|
||||
'=' Operator
|
||||
'$((' Keyword
|
||||
'(' Operator
|
||||
'(' Operator
|
||||
'i32' Name.Variable
|
||||
'>>' Operator
|
||||
'24' Literal.Number
|
||||
')' Operator
|
||||
'&' Operator
|
||||
'0xff' Literal.Number
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'|' Operator
|
||||
'\n\t\t' Text.Whitespace
|
||||
'(' Operator
|
||||
'(' Operator
|
||||
'i32' Name.Variable
|
||||
'<<' Operator
|
||||
'8' Literal.Number
|
||||
')' Operator
|
||||
'&' Operator
|
||||
'0xff0000' Literal.Number
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'|' Operator
|
||||
'\n\t\t' Text.Whitespace
|
||||
'(' Operator
|
||||
'(' Operator
|
||||
'i32' Name.Variable
|
||||
'>>' Operator
|
||||
'8' Literal.Number
|
||||
')' Operator
|
||||
'&' Operator
|
||||
'0xff00' Literal.Number
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'|' Operator
|
||||
'\n\t\t' Text.Whitespace
|
||||
'(' Operator
|
||||
'(' Operator
|
||||
'i32' Name.Variable
|
||||
'<<' Operator
|
||||
'24' Literal.Number
|
||||
')' Operator
|
||||
'&' Operator
|
||||
'0xff000000' Literal.Number
|
||||
'))' Keyword
|
||||
')' Operator
|
||||
'\n\t' Text.Whitespace
|
||||
'echo' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$i32' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
')' Operator
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'read_hex' Text
|
||||
'(' Operator
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'(' Operator
|
||||
'\n\t' Text.Whitespace
|
||||
'path' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'$1' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'offs' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'$2' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'len' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'$3' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'od' Text
|
||||
' ' Text.Whitespace
|
||||
'-An' Text
|
||||
' ' Text.Whitespace
|
||||
'-txC' Text
|
||||
' ' Text.Whitespace
|
||||
'-N' Text
|
||||
'"' Literal.String.Double
|
||||
'$len' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'-j' Text
|
||||
'"' Literal.String.Double
|
||||
'$offs' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$path' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'|' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'tr' Text
|
||||
' ' Text.Whitespace
|
||||
'-d' Text
|
||||
' ' Text.Whitespace
|
||||
"' \\n'" Literal.String.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
')' Operator
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'normalize_path' Text
|
||||
'(' Operator
|
||||
')' Operator
|
||||
' ' Text.Whitespace
|
||||
'(' Operator
|
||||
'\n\t' Text.Whitespace
|
||||
'path' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'$1' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'path' Name.Variable
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'${' Literal.String.Interpol
|
||||
'path' Name.Variable
|
||||
'#./' Punctuation
|
||||
'}' Literal.String.Interpol
|
||||
'"' Literal.String.Double
|
||||
'\n\t' Text.Whitespace
|
||||
'# TODO: Remove the leading / if fully qualified\n' Comment.Single
|
||||
|
||||
'\t' Text.Whitespace
|
||||
'if' Keyword
|
||||
' ' Text.Whitespace
|
||||
'[' Operator
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'${' Literal.String.Interpol
|
||||
'path' Name.Variable
|
||||
'#.git' Punctuation
|
||||
'}' Literal.String.Interpol
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'!' Text
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$path' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
']' Operator
|
||||
'\n\t' Text.Whitespace
|
||||
'then' Keyword
|
||||
'\n\t\t' Text.Whitespace
|
||||
'printf' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
"'%s'" Literal.String.Single
|
||||
' ' Text.Whitespace
|
||||
"'Invalid path %s\\n'" Literal.String.Single
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$path' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n\t\t' Text.Whitespace
|
||||
'exit' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'1' Literal.Number
|
||||
'\n\t' Text.Whitespace
|
||||
'fi' Keyword
|
||||
'\n\t' Text.Whitespace
|
||||
'printf' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'"%s"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'$path' Name.Variable
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
')' Operator
|
||||
'\n' Text.Whitespace
|
8
spec/tests/bash/test_parsed_single.txt
Normal file
8
spec/tests/bash/test_parsed_single.txt
Normal file
@ -0,0 +1,8 @@
|
||||
---input---
|
||||
a=$'abc\''
|
||||
|
||||
---tokens---
|
||||
'a' Name.Variable
|
||||
'=' Operator
|
||||
"$'abc\\''" Literal.String.Single
|
||||
'\n' Text.Whitespace
|
26
spec/tests/bash/test_short_variable_names.txt
Normal file
26
spec/tests/bash/test_short_variable_names.txt
Normal file
@ -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
|
14
spec/tests/bash_session/fake_ps2_prompt.txt
Normal file
14
spec/tests/bash_session/fake_ps2_prompt.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Test that missing backslash means it's no prompt.
|
||||
|
||||
---input---
|
||||
$ echo "> not a prompt"
|
||||
> not a prompt
|
||||
|
||||
---tokens---
|
||||
'$ ' Generic.Prompt
|
||||
'echo' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'"> not a prompt"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'> not a prompt\n' Generic.Output
|
21
spec/tests/bash_session/prompt_in_output.txt
Normal file
21
spec/tests/bash_session/prompt_in_output.txt
Normal file
@ -0,0 +1,21 @@
|
||||
# Test that output that looks like a prompt is not detected as such.
|
||||
|
||||
---input---
|
||||
$ cat \
|
||||
> test.txt
|
||||
line1
|
||||
> file content, not prompt!
|
||||
|
||||
---tokens---
|
||||
'$ ' Generic.Prompt
|
||||
'cat' Text
|
||||
' ' Text.Whitespace
|
||||
'\\\n' Literal.String.Escape
|
||||
|
||||
'> ' Generic.Prompt
|
||||
'test.txt' Text
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'line1\n' Generic.Output
|
||||
|
||||
'> file content, not prompt!\n' Generic.Output
|
15
spec/tests/bash_session/ps2_prompt.txt
Normal file
15
spec/tests/bash_session/ps2_prompt.txt
Normal file
@ -0,0 +1,15 @@
|
||||
---input---
|
||||
$ ls\
|
||||
> /does/not/exist
|
||||
ls: cannot access ...
|
||||
|
||||
---tokens---
|
||||
'$ ' Generic.Prompt
|
||||
'ls' Text
|
||||
'\\\n' Literal.String.Escape
|
||||
|
||||
'> ' Generic.Prompt
|
||||
'/does/not/exist' Text
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'ls: cannot access ...\n' Generic.Output
|
6
spec/tests/bash_session/test_comment_after_prompt.txt
Normal file
6
spec/tests/bash_session/test_comment_after_prompt.txt
Normal file
@ -0,0 +1,6 @@
|
||||
---input---
|
||||
$# comment
|
||||
|
||||
---tokens---
|
||||
'$' Generic.Prompt
|
||||
'# comment\n' Comment.Single
|
16
spec/tests/bash_session/test_newline_in_echo_no_ps2.txt
Normal file
16
spec/tests/bash_session/test_newline_in_echo_no_ps2.txt
Normal file
@ -0,0 +1,16 @@
|
||||
---input---
|
||||
$ echo \
|
||||
hi
|
||||
hi
|
||||
|
||||
---tokens---
|
||||
'$ ' Generic.Prompt
|
||||
'echo' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'\\\n' Literal.String.Escape
|
||||
|
||||
' ' Text.Whitespace
|
||||
'hi' Text
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'hi\n' Generic.Output
|
16
spec/tests/bash_session/test_newline_in_echo_ps2.txt
Normal file
16
spec/tests/bash_session/test_newline_in_echo_ps2.txt
Normal file
@ -0,0 +1,16 @@
|
||||
---input---
|
||||
$ echo \
|
||||
> hi
|
||||
hi
|
||||
|
||||
---tokens---
|
||||
'$ ' Generic.Prompt
|
||||
'echo' Name.Builtin
|
||||
' ' Text.Whitespace
|
||||
'\\\n' Literal.String.Escape
|
||||
|
||||
'> ' Generic.Prompt
|
||||
'hi' Text
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'hi\n' Generic.Output
|
16
spec/tests/bash_session/test_newline_in_ls_no_ps2.txt
Normal file
16
spec/tests/bash_session/test_newline_in_ls_no_ps2.txt
Normal file
@ -0,0 +1,16 @@
|
||||
---input---
|
||||
$ ls \
|
||||
hi
|
||||
hi
|
||||
|
||||
---tokens---
|
||||
'$ ' Generic.Prompt
|
||||
'ls' Text
|
||||
' ' Text.Whitespace
|
||||
'\\\n' Literal.String.Escape
|
||||
|
||||
' ' Text.Whitespace
|
||||
'hi' Text
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'hi\n' Generic.Output
|
16
spec/tests/bash_session/test_newline_in_ls_ps2.txt
Normal file
16
spec/tests/bash_session/test_newline_in_ls_ps2.txt
Normal file
@ -0,0 +1,16 @@
|
||||
---input---
|
||||
$ ls \
|
||||
> hi
|
||||
hi
|
||||
|
||||
---tokens---
|
||||
'$ ' Generic.Prompt
|
||||
'ls' Text
|
||||
' ' Text.Whitespace
|
||||
'\\\n' Literal.String.Escape
|
||||
|
||||
'> ' Generic.Prompt
|
||||
'hi' Text
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'hi\n' Generic.Output
|
11
spec/tests/bash_session/test_virtualenv.txt
Normal file
11
spec/tests/bash_session/test_virtualenv.txt
Normal file
@ -0,0 +1,11 @@
|
||||
---input---
|
||||
(env) [~/project]$ foo -h
|
||||
|
||||
---tokens---
|
||||
'(env)' Generic.Prompt.VirtualEnv
|
||||
' ' Text
|
||||
'[~/project]$ ' Generic.Prompt
|
||||
'foo' Text
|
||||
' ' Text.Whitespace
|
||||
'-h' Text
|
||||
'\n' Text.Whitespace
|
54
spec/tests/bibtex/test_basic_bst.txt
Normal file
54
spec/tests/bibtex/test_basic_bst.txt
Normal file
@ -0,0 +1,54 @@
|
||||
---input---
|
||||
% BibTeX standard bibliography style `plain'
|
||||
|
||||
INTEGERS { output.state before.all }
|
||||
|
||||
FUNCTION {sort.format.title}
|
||||
{ 't :=
|
||||
"A " #2
|
||||
"An " #3
|
||||
"The " #4 t chop.word
|
||||
chop.word
|
||||
chop.word
|
||||
sortify
|
||||
#1 global.max$ substring$
|
||||
}
|
||||
|
||||
ITERATE {call.type$}
|
||||
|
||||
---tokens---
|
||||
"% BibTeX standard bibliography style `plain'" Comment
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'INTEGERS { output.state before.all }' Comment
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'FUNCTION {sort.format.title}' Comment
|
||||
'\n' Text.Whitespace
|
||||
|
||||
"{ 't :=" Comment
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"A " #2' Comment
|
||||
'\n ' Text.Whitespace
|
||||
'"An " #3' Comment
|
||||
'\n ' Text.Whitespace
|
||||
'"The " #4 t chop.word' Comment
|
||||
'\n ' Text.Whitespace
|
||||
'chop.word' Comment
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'chop.word' Comment
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'sortify' Comment
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'#1 global.max$ substring$' Comment
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Comment
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'ITERATE {call.type$}' Comment
|
||||
'\n' Text.Whitespace
|
7
spec/tests/bibtex/test_comment.txt
Normal file
7
spec/tests/bibtex/test_comment.txt
Normal file
@ -0,0 +1,7 @@
|
||||
---input---
|
||||
@COMMENT{test}
|
||||
|
||||
---tokens---
|
||||
'@COMMENT' Comment
|
||||
'{test}' Comment
|
||||
'\n' Text.Whitespace
|
63
spec/tests/bibtex/test_entry.txt
Normal file
63
spec/tests/bibtex/test_entry.txt
Normal file
@ -0,0 +1,63 @@
|
||||
---input---
|
||||
This is a comment.
|
||||
|
||||
@ARTICLE{ruckenstein-diffusion,
|
||||
author = "Liu, Hongquin" # and # "Ruckenstein, Eli",
|
||||
year = 1997,
|
||||
month = JAN,
|
||||
pages = "888-895"
|
||||
}
|
||||
|
||||
---tokens---
|
||||
'This is a comment.' Comment
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'@ARTICLE' Name.Class
|
||||
'{' Punctuation
|
||||
'ruckenstein-diffusion' Name.Label
|
||||
',' Punctuation
|
||||
'\n ' Text.Whitespace
|
||||
'author' Name.Attribute
|
||||
' ' Text.Whitespace
|
||||
'=' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String
|
||||
'Liu, Hongquin' Literal.String
|
||||
'"' Literal.String
|
||||
' ' Text.Whitespace
|
||||
'#' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'and' Name.Variable
|
||||
' ' Text.Whitespace
|
||||
'#' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String
|
||||
'Ruckenstein, Eli' Literal.String
|
||||
'"' Literal.String
|
||||
',' Punctuation
|
||||
'\n ' Text.Whitespace
|
||||
'year' Name.Attribute
|
||||
' ' Text.Whitespace
|
||||
'=' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'1997' Literal.Number
|
||||
',' Punctuation
|
||||
'\n ' Text.Whitespace
|
||||
'month' Name.Attribute
|
||||
' ' Text.Whitespace
|
||||
'=' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'JAN' Name.Variable
|
||||
',' Punctuation
|
||||
'\n ' Text.Whitespace
|
||||
'pages' Name.Attribute
|
||||
' ' Text.Whitespace
|
||||
'=' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String
|
||||
'888-895' Literal.String
|
||||
'"' Literal.String
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
10
spec/tests/bibtex/test_mismatched_brace.txt
Normal file
10
spec/tests/bibtex/test_mismatched_brace.txt
Normal file
@ -0,0 +1,10 @@
|
||||
---input---
|
||||
@PREAMBLE(""}
|
||||
|
||||
---tokens---
|
||||
'@PREAMBLE' Name.Class
|
||||
'(' Punctuation
|
||||
'"' Literal.String
|
||||
'"' Literal.String
|
||||
'}' Error
|
||||
'\n' Text.Whitespace
|
10
spec/tests/bibtex/test_missing_body.txt
Normal file
10
spec/tests/bibtex/test_missing_body.txt
Normal file
@ -0,0 +1,10 @@
|
||||
---input---
|
||||
@ARTICLE xxx
|
||||
|
||||
---tokens---
|
||||
'@ARTICLE' Name.Class
|
||||
' ' Text.Whitespace
|
||||
'x' Error
|
||||
'x' Error
|
||||
'x' Error
|
||||
'\n' Text.Whitespace
|
11
spec/tests/bibtex/test_preamble.txt
Normal file
11
spec/tests/bibtex/test_preamble.txt
Normal file
@ -0,0 +1,11 @@
|
||||
---input---
|
||||
@PREAMBLE{"% some LaTeX code here"}
|
||||
|
||||
---tokens---
|
||||
'@PREAMBLE' Name.Class
|
||||
'{' Punctuation
|
||||
'"' Literal.String
|
||||
'% some LaTeX code here' Literal.String
|
||||
'"' Literal.String
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
15
spec/tests/bibtex/test_string.txt
Normal file
15
spec/tests/bibtex/test_string.txt
Normal file
@ -0,0 +1,15 @@
|
||||
---input---
|
||||
@STRING(SCI = "Science")
|
||||
|
||||
---tokens---
|
||||
'@STRING' Name.Class
|
||||
'(' Punctuation
|
||||
'SCI' Name.Attribute
|
||||
' ' Text.Whitespace
|
||||
'=' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String
|
||||
'Science' Literal.String
|
||||
'"' Literal.String
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
28
spec/tests/bqn/test_arguments.txt
Normal file
28
spec/tests/bqn/test_arguments.txt
Normal file
@ -0,0 +1,28 @@
|
||||
---input---
|
||||
Ambiv ← { ⟨1,𝕩⟩ ; ⟨2,𝕨,𝕩⟩ }
|
||||
|
||||
---tokens---
|
||||
'Ambiv' Operator
|
||||
' ' Text.Whitespace
|
||||
'←' Keyword.Declaration
|
||||
' ' Text.Whitespace
|
||||
'{' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'⟨' Punctuation
|
||||
'1' Literal.Number
|
||||
',' Punctuation
|
||||
'𝕩' Name.Entity
|
||||
'⟩' Punctuation
|
||||
' ' Text.Whitespace
|
||||
';' Name.Entity
|
||||
' ' Text.Whitespace
|
||||
'⟨' Punctuation
|
||||
'2' Literal.Number
|
||||
',' Punctuation
|
||||
'𝕨' Name.Entity
|
||||
',' Punctuation
|
||||
'𝕩' Name.Entity
|
||||
'⟩' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'}' Keyword.Type
|
||||
'\n' Text.Whitespace
|
12
spec/tests/bqn/test_comment.txt
Normal file
12
spec/tests/bqn/test_comment.txt
Normal file
@ -0,0 +1,12 @@
|
||||
---input---
|
||||
'#' - 1 #This is the comment
|
||||
|
||||
---tokens---
|
||||
"'#'" Literal.String.Single
|
||||
' ' Text.Whitespace
|
||||
'-' Operator
|
||||
' ' Text.Whitespace
|
||||
'1' Literal.Number
|
||||
' ' Text.Whitespace
|
||||
'#This is the comment' Comment.Single
|
||||
'\n' Text.Whitespace
|
42
spec/tests/bqn/test_define.txt
Normal file
42
spec/tests/bqn/test_define.txt
Normal file
@ -0,0 +1,42 @@
|
||||
---input---
|
||||
⟨alias⇐a, b⟩ ← {
|
||||
b‿c⇐
|
||||
a⇐2
|
||||
c←÷b↩1+a
|
||||
}
|
||||
|
||||
---tokens---
|
||||
'⟨' Punctuation
|
||||
'alias' Name.Variable
|
||||
'⇐' Keyword.Declaration
|
||||
'a' Name.Variable
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'b' Name.Variable
|
||||
'⟩' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'←' Keyword.Declaration
|
||||
' ' Text.Whitespace
|
||||
'{' Keyword.Type
|
||||
'\n ' Text.Whitespace
|
||||
'b' Name.Variable
|
||||
'‿' Punctuation
|
||||
'c' Name.Variable
|
||||
'⇐' Keyword.Declaration
|
||||
'\n ' Text.Whitespace
|
||||
'a' Name.Variable
|
||||
'⇐' Keyword.Declaration
|
||||
'2' Literal.Number
|
||||
'\n ' Text.Whitespace
|
||||
'c' Name.Variable
|
||||
'←' Keyword.Declaration
|
||||
'÷' Operator
|
||||
'b' Name.Variable
|
||||
'↩' Keyword.Declaration
|
||||
'1' Literal.Number
|
||||
'+' Operator
|
||||
'a' Name.Variable
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Keyword.Type
|
||||
'\n' Text.Whitespace
|
23
spec/tests/bqn/test_syntax_roles.txt
Normal file
23
spec/tests/bqn/test_syntax_roles.txt
Normal file
@ -0,0 +1,23 @@
|
||||
---input---
|
||||
⟨ט,√⟩ {𝕎𝕩}⌜ 1‿4‿9
|
||||
|
||||
---tokens---
|
||||
'⟨' Punctuation
|
||||
'×' Operator
|
||||
'˜' Name.Attribute
|
||||
',' Punctuation
|
||||
'√' Operator
|
||||
'⟩' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'{' Keyword.Type
|
||||
'𝕎' Operator
|
||||
'𝕩' Name.Entity
|
||||
'}' Keyword.Type
|
||||
'⌜' Name.Attribute
|
||||
' ' Text.Whitespace
|
||||
'1' Literal.Number
|
||||
'‿' Punctuation
|
||||
'4' Literal.Number
|
||||
'‿' Punctuation
|
||||
'9' Literal.Number
|
||||
'\n' Text.Whitespace
|
46
spec/tests/c++/alternative_tokens.txt
Normal file
46
spec/tests/c++/alternative_tokens.txt
Normal file
@ -0,0 +1,46 @@
|
||||
---input---
|
||||
and
|
||||
and_eq
|
||||
bitand
|
||||
bitor
|
||||
compl
|
||||
not
|
||||
not_eq
|
||||
or
|
||||
or_eq
|
||||
xor
|
||||
xor_eq
|
||||
|
||||
---tokens---
|
||||
'and' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'and_eq' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'bitand' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'bitor' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'compl' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'not' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'not_eq' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'or' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'or_eq' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'xor' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'xor_eq' Keyword
|
||||
'\n' Text.Whitespace
|
17
spec/tests/c++/extension_keywords.txt
Normal file
17
spec/tests/c++/extension_keywords.txt
Normal file
@ -0,0 +1,17 @@
|
||||
---input---
|
||||
__restrict
|
||||
__int128
|
||||
_BitInt(2)
|
||||
|
||||
---tokens---
|
||||
'__restrict' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'__int128' Keyword.Type
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'_BitInt' Keyword.Type
|
||||
'(' Punctuation
|
||||
'2' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
6
spec/tests/c++/test_good_comment.txt
Normal file
6
spec/tests/c++/test_good_comment.txt
Normal file
@ -0,0 +1,6 @@
|
||||
---input---
|
||||
/* foo */
|
||||
|
||||
---tokens---
|
||||
'/* foo */' Comment.Multiline
|
||||
'\n' Text.Whitespace
|
5
spec/tests/c++/test_open_comment.txt
Normal file
5
spec/tests/c++/test_open_comment.txt
Normal file
@ -0,0 +1,5 @@
|
||||
---input---
|
||||
/* foo
|
||||
|
||||
---tokens---
|
||||
'/* foo\n' Comment.Multiline
|
146
spec/tests/c++/test_unicode_identifiers.txt
Normal file
146
spec/tests/c++/test_unicode_identifiers.txt
Normal file
@ -0,0 +1,146 @@
|
||||
---input---
|
||||
namespace 𝐨𝐩𝐭𝐢𝐨𝐧 {
|
||||
int _hello();
|
||||
}
|
||||
|
||||
int cześć = 2;
|
||||
|
||||
class 𝐨𝐩𝐭𝐢𝐨𝐧𝐬 final {
|
||||
𝐨𝐩𝐭𝐢𝐨𝐧𝐬() {
|
||||
爴:
|
||||
int a = 𝐨𝐩𝐭𝐢𝐨𝐧::hello();
|
||||
};
|
||||
|
||||
static 𝐨𝐩𝐭𝐢𝐨𝐧𝐬 𝔡𝔢𝔣𝔞𝔲𝔩𝔱;
|
||||
static 𝐨𝐩𝐭𝐢𝐨𝐧𝐬 𝔢𝔵𝔠𝔢𝔭𝔱𝔦𝔬𝔫𝔰;
|
||||
};
|
||||
|
||||
enum class ⅭⅤ { red, green = 15, blue };
|
||||
|
||||
---tokens---
|
||||
'namespace' Keyword
|
||||
' ' Text.Whitespace
|
||||
'𝐨𝐩𝐭𝐢𝐨𝐧' Name.Namespace
|
||||
' ' Text.Whitespace
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'_hello' Name.Function
|
||||
'(' Punctuation
|
||||
')' Punctuation
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'cześć' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'2' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'class' Keyword
|
||||
' ' Text.Whitespace
|
||||
'𝐨𝐩𝐭𝐢𝐨𝐧𝐬' Name.Class
|
||||
' ' Text.Whitespace
|
||||
'final' Keyword
|
||||
' ' Text.Whitespace
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'𝐨𝐩𝐭𝐢𝐨𝐧𝐬' Name
|
||||
'(' Punctuation
|
||||
')' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'爴' Name.Label
|
||||
':' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'a' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'𝐨𝐩𝐭𝐢𝐨𝐧' Name
|
||||
':' Operator
|
||||
':' Operator
|
||||
'hello' Name
|
||||
'(' Punctuation
|
||||
')' Punctuation
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'}' Punctuation
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'static' Keyword
|
||||
' ' Text.Whitespace
|
||||
'𝐨𝐩𝐭𝐢𝐨𝐧𝐬' Name
|
||||
' ' Text.Whitespace
|
||||
'𝔡𝔢𝔣𝔞𝔲𝔩𝔱' Name
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'static' Keyword
|
||||
' ' Text.Whitespace
|
||||
'𝐨𝐩𝐭𝐢𝐨𝐧𝐬' Name
|
||||
' ' Text.Whitespace
|
||||
'𝔢𝔵𝔠𝔢𝔭𝔱𝔦𝔬𝔫𝔰' Name
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'enum' Keyword
|
||||
' ' Text.Whitespace
|
||||
'class' Keyword
|
||||
' ' Text.Whitespace
|
||||
'ⅭⅤ' Name.Class
|
||||
' ' Text.Whitespace
|
||||
'{' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'red' Name
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'green' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'15' Literal.Number.Integer
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'blue' Name
|
||||
' ' Text.Whitespace
|
||||
'}' Punctuation
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
13
spec/tests/c/builtin_types.txt
Normal file
13
spec/tests/c/builtin_types.txt
Normal file
@ -0,0 +1,13 @@
|
||||
---input---
|
||||
__int128
|
||||
_BitInt(2)
|
||||
|
||||
---tokens---
|
||||
'__int128' Keyword.Type
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'_BitInt' Keyword.Type
|
||||
'(' Punctuation
|
||||
'2' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
31
spec/tests/c/test_comment_end.txt
Normal file
31
spec/tests/c/test_comment_end.txt
Normal file
@ -0,0 +1,31 @@
|
||||
In the past the "*/" was marked as an error to "helpfully"
|
||||
indicate a wrong comment end.
|
||||
|
||||
---input---
|
||||
int m21=((result_0*0+result_1*/*0<-----*/1)%mod+mod)%mod;
|
||||
|
||||
---tokens---
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'm21' Name
|
||||
'=' Operator
|
||||
'(' Punctuation
|
||||
'(' Punctuation
|
||||
'result_0' Name
|
||||
'*' Operator
|
||||
'0' Literal.Number.Integer
|
||||
'+' Operator
|
||||
'result_1' Name
|
||||
'*' Operator
|
||||
'/*0<-----*/' Comment.Multiline
|
||||
'1' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
'%' Operator
|
||||
'mod' Name
|
||||
'+' Operator
|
||||
'mod' Name
|
||||
')' Punctuation
|
||||
'%' Operator
|
||||
'mod' Name
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
409
spec/tests/c/test_function_comments.txt
Normal file
409
spec/tests/c/test_function_comments.txt
Normal file
@ -0,0 +1,409 @@
|
||||
---input---
|
||||
int func1(int x, int y)
|
||||
/*@requires y >= 0*/
|
||||
{
|
||||
return x / y;
|
||||
}
|
||||
|
||||
|
||||
int func2(int x, int y) //@requires y >= 0;
|
||||
{
|
||||
return x / y;
|
||||
}
|
||||
|
||||
|
||||
void func3()
|
||||
//#test{};
|
||||
{
|
||||
fun(2,3)//test1;
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
int func4(int x, int y)
|
||||
/*@requires y >= 0;*/
|
||||
{
|
||||
return x / y;
|
||||
}
|
||||
|
||||
|
||||
int func5(int x, int y)
|
||||
/*@requires y >= 0
|
||||
{
|
||||
return x / y;
|
||||
}
|
||||
*/
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
//@requires y >= 0;
|
||||
//@requires y >= 0
|
||||
/*
|
||||
calling(2,5)
|
||||
*/
|
||||
/*
|
||||
calling(2,5);
|
||||
*/
|
||||
int func6(int x, int y)
|
||||
//@requires y >= 0
|
||||
//@requires y >= 0;
|
||||
/*
|
||||
hello(2,3);
|
||||
*/
|
||||
/*
|
||||
hello(2,3)
|
||||
*/
|
||||
{
|
||||
// haha(2,3);
|
||||
return x / y;
|
||||
/*
|
||||
callblabla(x, y);
|
||||
*/
|
||||
}
|
||||
//@requires y >= 0;
|
||||
//@requires y >= 0
|
||||
/*
|
||||
calling(2,5)
|
||||
*/
|
||||
/*
|
||||
calling(2,5);
|
||||
*/
|
||||
|
||||
|
||||
int * //@# a pointer to int
|
||||
func7 /* @# why a comment here? */ (
|
||||
int /* the index has to be an int */ a, // index into the array
|
||||
int *b //the array @!
|
||||
)
|
||||
/*
|
||||
The end of the func params @ (@ will result error if parsed incorrectly)
|
||||
*/
|
||||
{
|
||||
// yet another comment
|
||||
return b[a];
|
||||
}
|
||||
|
||||
---tokens---
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'func1' Name.Function
|
||||
'(' Punctuation
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'x' Name
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'y' Name
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'/*@requires y >= 0*/' Comment.Multiline
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'return' Keyword
|
||||
' ' Text.Whitespace
|
||||
'x' Name
|
||||
' ' Text.Whitespace
|
||||
'/' Operator
|
||||
' ' Text.Whitespace
|
||||
'y' Name
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'func2' Name.Function
|
||||
'(' Punctuation
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'x' Name
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'y' Name
|
||||
')' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'//@requires y >= 0;\n' Comment.Single
|
||||
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'return' Keyword
|
||||
' ' Text.Whitespace
|
||||
'x' Name
|
||||
' ' Text.Whitespace
|
||||
'/' Operator
|
||||
' ' Text.Whitespace
|
||||
'y' Name
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'void' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'func3' Name.Function
|
||||
'(' Punctuation
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'//#test{};\n' Comment.Single
|
||||
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'fun' Name
|
||||
'(' Punctuation
|
||||
'2' Literal.Number.Integer
|
||||
',' Punctuation
|
||||
'3' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
'//test1;\n' Comment.Single
|
||||
|
||||
' ' Text.Whitespace
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'func4' Name.Function
|
||||
'(' Punctuation
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'x' Name
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'y' Name
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'/*@requires y >= 0;*/' Comment.Multiline
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'return' Keyword
|
||||
' ' Text.Whitespace
|
||||
'x' Name
|
||||
' ' Text.Whitespace
|
||||
'/' Operator
|
||||
' ' Text.Whitespace
|
||||
'y' Name
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'func5' Name.Function
|
||||
'(' Punctuation
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'x' Name
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'y' Name
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'/*@requires y >= 0\n {\n return x / y;\n }\n */' Comment.Multiline
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'return' Keyword
|
||||
' ' Text.Whitespace
|
||||
'2' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'//@requires y >= 0;\n' Comment.Single
|
||||
|
||||
'//@requires y >= 0\n' Comment.Single
|
||||
|
||||
'/*\ncalling(2,5)\n*/' Comment.Multiline
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'/*\ncalling(2,5);\n*/' Comment.Multiline
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'func6' Name.Function
|
||||
'(' Punctuation
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'x' Name
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'y' Name
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'//@requires y >= 0\n' Comment.Single
|
||||
|
||||
' ' Text.Whitespace
|
||||
'//@requires y >= 0;\n' Comment.Single
|
||||
|
||||
' ' Text.Whitespace
|
||||
'/*\n hello(2,3);\n */' Comment.Multiline
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'/*\n hello(2,3)\n */' Comment.Multiline
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'// haha(2,3);\n' Comment.Single
|
||||
|
||||
' ' Text.Whitespace
|
||||
'return' Keyword
|
||||
' ' Text.Whitespace
|
||||
'x' Name
|
||||
' ' Text.Whitespace
|
||||
'/' Operator
|
||||
' ' Text.Whitespace
|
||||
'y' Name
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'/*\n callblabla(x, y);\n */' Comment.Multiline
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'//@requires y >= 0;\n' Comment.Single
|
||||
|
||||
'//@requires y >= 0\n' Comment.Single
|
||||
|
||||
'/*\ncalling(2,5)\n*/' Comment.Multiline
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'/*\ncalling(2,5);\n*/' Comment.Multiline
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'*' Operator
|
||||
' ' Text.Whitespace
|
||||
'//@# a pointer to int\n' Comment.Single
|
||||
|
||||
'func7' Name.Function
|
||||
' ' Text.Whitespace
|
||||
'/* @# why a comment here? */' Comment.Multiline
|
||||
' ' Text.Whitespace
|
||||
'(' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'/* the index has to be an int */' Comment.Multiline
|
||||
' ' Text.Whitespace
|
||||
'a' Name
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'// index into the array\n' Comment.Single
|
||||
|
||||
' ' Text.Whitespace
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'*' Operator
|
||||
'b' Name
|
||||
' ' Text.Whitespace
|
||||
'//the array @!\n' Comment.Single
|
||||
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'/*\n The end of the func params @ (@ will result error if parsed incorrectly)\n*/' Comment.Multiline
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'// yet another comment\n' Comment.Single
|
||||
|
||||
' ' Text.Whitespace
|
||||
'return' Keyword
|
||||
' ' Text.Whitespace
|
||||
'b' Name
|
||||
'[' Punctuation
|
||||
'a' Name
|
||||
']' Punctuation
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
31
spec/tests/c/test_label.txt
Normal file
31
spec/tests/c/test_label.txt
Normal file
@ -0,0 +1,31 @@
|
||||
---input---
|
||||
int main()
|
||||
{
|
||||
foo:
|
||||
goto foo;
|
||||
}
|
||||
|
||||
---tokens---
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'main' Name.Function
|
||||
'(' Punctuation
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'foo' Name.Label
|
||||
':' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'goto' Keyword
|
||||
' ' Text.Whitespace
|
||||
'foo' Name
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
35
spec/tests/c/test_label_followed_by_statement.txt
Normal file
35
spec/tests/c/test_label_followed_by_statement.txt
Normal file
@ -0,0 +1,35 @@
|
||||
---input---
|
||||
int main()
|
||||
{
|
||||
foo:return 0;
|
||||
goto foo;
|
||||
}
|
||||
|
||||
---tokens---
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'main' Name.Function
|
||||
'(' Punctuation
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'foo' Name.Label
|
||||
':' Punctuation
|
||||
'return' Keyword
|
||||
' ' Text.Whitespace
|
||||
'0' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'goto' Keyword
|
||||
' ' Text.Whitespace
|
||||
'foo' Name
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
32
spec/tests/c/test_label_space_before_colon.txt
Normal file
32
spec/tests/c/test_label_space_before_colon.txt
Normal file
@ -0,0 +1,32 @@
|
||||
---input---
|
||||
int main()
|
||||
{
|
||||
foo :
|
||||
goto foo;
|
||||
}
|
||||
|
||||
---tokens---
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'main' Name.Function
|
||||
'(' Punctuation
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'foo' Name.Label
|
||||
' ' Text.Whitespace
|
||||
':' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'goto' Keyword
|
||||
' ' Text.Whitespace
|
||||
'foo' Name
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
20
spec/tests/c/test_numbers.txt
Normal file
20
spec/tests/c/test_numbers.txt
Normal file
@ -0,0 +1,20 @@
|
||||
---input---
|
||||
42 23.42 23. .42 023 0xdeadbeef 23e+42 42e-23
|
||||
|
||||
---tokens---
|
||||
'42' Literal.Number.Integer
|
||||
' ' Text.Whitespace
|
||||
'23.42' Literal.Number.Float
|
||||
' ' Text.Whitespace
|
||||
'23.' Literal.Number.Float
|
||||
' ' Text.Whitespace
|
||||
'.42' Literal.Number.Float
|
||||
' ' Text.Whitespace
|
||||
'023' Literal.Number.Oct
|
||||
' ' Text.Whitespace
|
||||
'0xdeadbeef' Literal.Number.Hex
|
||||
' ' Text.Whitespace
|
||||
'23e+42' Literal.Number.Float
|
||||
' ' Text.Whitespace
|
||||
'42e-23' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
17
spec/tests/c/test_preproc_file.txt
Normal file
17
spec/tests/c/test_preproc_file.txt
Normal file
@ -0,0 +1,17 @@
|
||||
---input---
|
||||
#include <foo>
|
||||
# include <foo>
|
||||
|
||||
---tokens---
|
||||
'#' Comment.Preproc
|
||||
'include' Comment.Preproc
|
||||
' ' Text.Whitespace
|
||||
'<foo>' Comment.PreprocFile
|
||||
'\n' Comment.Preproc
|
||||
|
||||
'#' Comment.Preproc
|
||||
' ' Text.Whitespace
|
||||
'include' Comment.Preproc
|
||||
' ' Text.Whitespace
|
||||
'<foo>' Comment.PreprocFile
|
||||
'\n' Comment.Preproc
|
17
spec/tests/c/test_preproc_file2.txt
Normal file
17
spec/tests/c/test_preproc_file2.txt
Normal file
@ -0,0 +1,17 @@
|
||||
---input---
|
||||
#include "foo.h"
|
||||
# include "foo.h"
|
||||
|
||||
---tokens---
|
||||
'#' Comment.Preproc
|
||||
'include' Comment.Preproc
|
||||
' ' Text.Whitespace
|
||||
'"foo.h"' Comment.PreprocFile
|
||||
'\n' Comment.Preproc
|
||||
|
||||
'#' Comment.Preproc
|
||||
' ' Text.Whitespace
|
||||
'include' Comment.Preproc
|
||||
' ' Text.Whitespace
|
||||
'"foo.h"' Comment.PreprocFile
|
||||
'\n' Comment.Preproc
|
18
spec/tests/c/test_preproc_file3.txt
Normal file
18
spec/tests/c/test_preproc_file3.txt
Normal file
@ -0,0 +1,18 @@
|
||||
Space around line break before macro is valid C, but failed to parse previously.
|
||||
|
||||
---input---
|
||||
foo();
|
||||
#define FOO 0
|
||||
|
||||
---tokens---
|
||||
'foo' Name
|
||||
'(' Punctuation
|
||||
')' Punctuation
|
||||
';' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'#' Comment.Preproc
|
||||
'define FOO 0' Comment.Preproc
|
||||
'\n' Comment.Preproc
|
13
spec/tests/c/test_preproc_file4.txt
Normal file
13
spec/tests/c/test_preproc_file4.txt
Normal file
@ -0,0 +1,13 @@
|
||||
Comments can precede preprocessor macros
|
||||
|
||||
---input---
|
||||
/* Comment */ /* Another */ #define FOO 0
|
||||
|
||||
---tokens---
|
||||
'/* Comment */' Comment.Multiline
|
||||
' ' Text.Whitespace
|
||||
'/* Another */' Comment.Multiline
|
||||
' ' Text.Whitespace
|
||||
'#' Comment.Preproc
|
||||
'define FOO 0' Comment.Preproc
|
||||
'\n' Comment.Preproc
|
19
spec/tests/c/test_preproc_file5.txt
Normal file
19
spec/tests/c/test_preproc_file5.txt
Normal file
@ -0,0 +1,19 @@
|
||||
Preprocessor macros should appear only at the beginning of the line.
|
||||
Otherwise we should produce an error token.
|
||||
|
||||
---input---
|
||||
foo(); #define FOO 0
|
||||
|
||||
---tokens---
|
||||
'foo' Name
|
||||
'(' Punctuation
|
||||
')' Punctuation
|
||||
';' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'#' Error
|
||||
'define' Name
|
||||
' ' Text.Whitespace
|
||||
'FOO' Name
|
||||
' ' Text.Whitespace
|
||||
'0' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
41
spec/tests/c/test_string_resembling_decl_end.txt
Normal file
41
spec/tests/c/test_string_resembling_decl_end.txt
Normal file
@ -0,0 +1,41 @@
|
||||
---input---
|
||||
// This should not be recognized as a function declaration followed by
|
||||
// garbage.
|
||||
string xyz(");");
|
||||
|
||||
// This should not be recognized as a function definition.
|
||||
|
||||
string xyz("){ }");
|
||||
|
||||
---tokens---
|
||||
'// This should not be recognized as a function declaration followed by\n' Comment.Single
|
||||
|
||||
'// garbage.\n' Comment.Single
|
||||
|
||||
'string' Name
|
||||
' ' Text.Whitespace
|
||||
'xyz' Name
|
||||
'(' Punctuation
|
||||
'"' Literal.String
|
||||
');' Literal.String
|
||||
'"' Literal.String
|
||||
')' Punctuation
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'// This should not be recognized as a function definition.\n' Comment.Single
|
||||
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'string' Name
|
||||
' ' Text.Whitespace
|
||||
'xyz' Name
|
||||
'(' Punctuation
|
||||
'"' Literal.String
|
||||
'){ }' Literal.String
|
||||
'"' Literal.String
|
||||
')' Punctuation
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
56
spec/tests/c/test_switch.txt
Normal file
56
spec/tests/c/test_switch.txt
Normal file
@ -0,0 +1,56 @@
|
||||
---input---
|
||||
int main()
|
||||
{
|
||||
switch (0)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
---tokens---
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'main' Name.Function
|
||||
'(' Punctuation
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'switch' Keyword
|
||||
' ' Text.Whitespace
|
||||
'(' Punctuation
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'case' Keyword
|
||||
' ' Text.Whitespace
|
||||
'0' Literal.Number.Integer
|
||||
':' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'default' Keyword
|
||||
':' Operator
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
58
spec/tests/c/test_switch_space_before_colon.txt
Normal file
58
spec/tests/c/test_switch_space_before_colon.txt
Normal file
@ -0,0 +1,58 @@
|
||||
---input---
|
||||
int main()
|
||||
{
|
||||
switch (0)
|
||||
{
|
||||
case 0 :
|
||||
default :
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
---tokens---
|
||||
'int' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'main' Name.Function
|
||||
'(' Punctuation
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'switch' Keyword
|
||||
' ' Text.Whitespace
|
||||
'(' Punctuation
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'{' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'case' Keyword
|
||||
' ' Text.Whitespace
|
||||
'0' Literal.Number.Integer
|
||||
' ' Text.Whitespace
|
||||
':' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'default' Keyword
|
||||
' ' Text.Whitespace
|
||||
':' Operator
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
'\n' Text.Whitespace
|
14
spec/tests/coffeescript/test_beware_infinite_loop.txt
Normal file
14
spec/tests/coffeescript/test_beware_infinite_loop.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# This demonstrates the case that "This isn't really guarding" comment
|
||||
# refers to.
|
||||
|
||||
---input---
|
||||
/a/x;
|
||||
|
||||
---tokens---
|
||||
'' Text
|
||||
'/' Operator
|
||||
'a' Name.Other
|
||||
'/' Operator
|
||||
'x' Name.Other
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
13
spec/tests/coffeescript/test_mixed_slashes.txt
Normal file
13
spec/tests/coffeescript/test_mixed_slashes.txt
Normal file
@ -0,0 +1,13 @@
|
||||
---input---
|
||||
a?/foo/:1/2;
|
||||
|
||||
---tokens---
|
||||
'a' Name.Other
|
||||
'?' Operator
|
||||
'/foo/' Literal.String.Regex
|
||||
':' Operator
|
||||
'1' Literal.Number.Integer
|
||||
'/' Operator
|
||||
'2' Literal.Number.Integer
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
15
spec/tests/coq/test_unicode.txt
Normal file
15
spec/tests/coq/test_unicode.txt
Normal file
@ -0,0 +1,15 @@
|
||||
---input---
|
||||
Check (α ≻ β).
|
||||
|
||||
---tokens---
|
||||
'Check' Keyword.Namespace
|
||||
' ' Text
|
||||
'(' Operator
|
||||
'α' Name
|
||||
' ' Text
|
||||
'≻' Name.Builtin.Pseudo
|
||||
' ' Text
|
||||
'β' Name
|
||||
')' Operator
|
||||
'.' Operator
|
||||
'\n' Text
|
16
spec/tests/crystal/test_annotation.txt
Normal file
16
spec/tests/crystal/test_annotation.txt
Normal file
@ -0,0 +1,16 @@
|
||||
---input---
|
||||
@[FOO::Bar::Baz(opt: "xx")]
|
||||
|
||||
---tokens---
|
||||
'@[' Operator
|
||||
'FOO::Bar::Baz' Name.Decorator
|
||||
'(' Punctuation
|
||||
'opt' Literal.String.Symbol
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'xx' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
')' Punctuation
|
||||
']' Operator
|
||||
'\n' Text.Whitespace
|
11
spec/tests/crystal/test_array_access.txt
Normal file
11
spec/tests/crystal/test_array_access.txt
Normal file
@ -0,0 +1,11 @@
|
||||
---input---
|
||||
[5][5]?
|
||||
|
||||
---tokens---
|
||||
'[' Operator
|
||||
'5' Literal.Number.Integer
|
||||
']' Operator
|
||||
'[' Operator
|
||||
'5' Literal.Number.Integer
|
||||
']?' Operator
|
||||
'\n' Text.Whitespace
|
25
spec/tests/crystal/test_chars.txt
Normal file
25
spec/tests/crystal/test_chars.txt
Normal file
@ -0,0 +1,25 @@
|
||||
---input---
|
||||
'a'
|
||||
'я'
|
||||
'\u{1234}'
|
||||
'
|
||||
'
|
||||
'abc'
|
||||
|
||||
---tokens---
|
||||
"'a'" Literal.String.Char
|
||||
'\n' Text.Whitespace
|
||||
|
||||
"'я'" Literal.String.Char
|
||||
'\n' Text.Whitespace
|
||||
|
||||
"'\\u{1234}'" Literal.String.Char
|
||||
'\n' Text.Whitespace
|
||||
|
||||
"'\n'" Literal.String.Char
|
||||
'\n' Text.Whitespace
|
||||
|
||||
"'" Error
|
||||
'abc' Name
|
||||
"'" Error
|
||||
'\n' Text.Whitespace
|
14
spec/tests/crystal/test_constant_and_module.txt
Normal file
14
spec/tests/crystal/test_constant_and_module.txt
Normal file
@ -0,0 +1,14 @@
|
||||
---input---
|
||||
HTTP
|
||||
HTTP::Server.new
|
||||
|
||||
---tokens---
|
||||
'HTTP' Name.Constant
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'HTTP' Name
|
||||
'::' Operator
|
||||
'Server' Name
|
||||
'.' Operator
|
||||
'new' Name
|
||||
'\n' Text.Whitespace
|
27
spec/tests/crystal/test_empty_percent_strings.txt
Normal file
27
spec/tests/crystal/test_empty_percent_strings.txt
Normal file
@ -0,0 +1,27 @@
|
||||
---input---
|
||||
%()
|
||||
%[]
|
||||
%{}
|
||||
%<>
|
||||
%||
|
||||
|
||||
---tokens---
|
||||
'%(' Literal.String.Other
|
||||
')' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'%[' Literal.String.Other
|
||||
']' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'%{' Literal.String.Other
|
||||
'}' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'%<' Literal.String.Other
|
||||
'>' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'%|' Literal.String.Other
|
||||
'|' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
19
spec/tests/crystal/test_escaped_bracestring.txt
Normal file
19
spec/tests/crystal/test_escaped_bracestring.txt
Normal file
@ -0,0 +1,19 @@
|
||||
---input---
|
||||
str.gsub(%r{\\\\}, "/")
|
||||
|
||||
---tokens---
|
||||
'str' Name
|
||||
'.' Operator
|
||||
'gsub' Name
|
||||
'(' Punctuation
|
||||
'%r{' Literal.String.Regex
|
||||
'\\\\' Literal.String.Regex
|
||||
'\\\\' Literal.String.Regex
|
||||
'}' Literal.String.Regex
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'/' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
9
spec/tests/crystal/test_escaped_interpolation.txt
Normal file
9
spec/tests/crystal/test_escaped_interpolation.txt
Normal file
@ -0,0 +1,9 @@
|
||||
---input---
|
||||
"\#{a + b}"
|
||||
|
||||
---tokens---
|
||||
'"' Literal.String.Double
|
||||
'\\#' Literal.String.Escape
|
||||
'{a + b}' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
56
spec/tests/crystal/test_interpolation_nested_curly.txt
Normal file
56
spec/tests/crystal/test_interpolation_nested_curly.txt
Normal file
@ -0,0 +1,56 @@
|
||||
---input---
|
||||
"A#{ (3..5).group_by { |x| x/2}.map do |k,v| "#{k}" end.join }" + "Z"
|
||||
|
||||
---tokens---
|
||||
'"' Literal.String.Double
|
||||
'A' Literal.String.Double
|
||||
'#{' Literal.String.Interpol
|
||||
' ' Text.Whitespace
|
||||
'(' Punctuation
|
||||
'3' Literal.Number.Integer
|
||||
'..' Operator
|
||||
'5' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
'.' Operator
|
||||
'group_by' Name
|
||||
' ' Text.Whitespace
|
||||
'{' Literal.String.Interpol
|
||||
' ' Text.Whitespace
|
||||
'|' Operator
|
||||
'x' Name
|
||||
'|' Operator
|
||||
' ' Text.Whitespace
|
||||
'x' Name
|
||||
'/' Operator
|
||||
'2' Literal.Number.Integer
|
||||
'}' Literal.String.Interpol
|
||||
'.' Operator
|
||||
'map' Name
|
||||
' ' Text.Whitespace
|
||||
'do' Keyword
|
||||
' ' Text.Whitespace
|
||||
'|' Operator
|
||||
'k' Name
|
||||
',' Punctuation
|
||||
'v' Name
|
||||
'|' Operator
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'#{' Literal.String.Interpol
|
||||
'k' Name
|
||||
'}' Literal.String.Interpol
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'end' Keyword
|
||||
'.' Operator
|
||||
'join' Name
|
||||
' ' Text.Whitespace
|
||||
'}' Literal.String.Interpol
|
||||
'"' Literal.String.Double
|
||||
' ' Text.Whitespace
|
||||
'+' Operator
|
||||
' ' Text.Whitespace
|
||||
'"' Literal.String.Double
|
||||
'Z' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
58
spec/tests/crystal/test_lib.txt
Normal file
58
spec/tests/crystal/test_lib.txt
Normal file
@ -0,0 +1,58 @@
|
||||
---input---
|
||||
@[Link("some")]
|
||||
lib LibSome
|
||||
@[CallConvention("X86_StdCall")]
|
||||
fun foo="some.foo"(thing : Void*) : LibC::Int
|
||||
end
|
||||
|
||||
---tokens---
|
||||
'@[' Operator
|
||||
'Link' Name.Decorator
|
||||
'(' Punctuation
|
||||
'"' Literal.String.Double
|
||||
'some' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
')' Punctuation
|
||||
']' Operator
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'lib' Keyword
|
||||
' ' Text.Whitespace
|
||||
'LibSome' Name.Namespace
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'@[' Operator
|
||||
'CallConvention' Name.Decorator
|
||||
'(' Punctuation
|
||||
'"' Literal.String.Double
|
||||
'X86_StdCall' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
')' Punctuation
|
||||
']' Operator
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'fun' Keyword
|
||||
' ' Text.Whitespace
|
||||
'foo' Name.Function
|
||||
'=' Operator
|
||||
'"' Literal.String.Double
|
||||
'some.foo' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'(' Punctuation
|
||||
'thing' Name
|
||||
' ' Text.Whitespace
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'Void' Name
|
||||
'*' Operator
|
||||
')' Punctuation
|
||||
' ' Text.Whitespace
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'LibC' Name
|
||||
'::' Operator
|
||||
'Int' Name
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'end' Keyword
|
||||
'\n' Text.Whitespace
|
76
spec/tests/crystal/test_macro.txt
Normal file
76
spec/tests/crystal/test_macro.txt
Normal file
@ -0,0 +1,76 @@
|
||||
---input---
|
||||
def<=>(other : self) : Int
|
||||
{%for field in %w(first_name middle_name last_name)%}
|
||||
cmp={{field.id}}<=>other.{{field.id}}
|
||||
return cmp if cmp!=0
|
||||
{%end%}
|
||||
0
|
||||
end
|
||||
|
||||
---tokens---
|
||||
'def' Keyword
|
||||
'<=>' Name.Function
|
||||
'(' Punctuation
|
||||
'other' Name
|
||||
' ' Text.Whitespace
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'self' Keyword
|
||||
')' Punctuation
|
||||
' ' Text.Whitespace
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'Int' Name
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'{%' Literal.String.Interpol
|
||||
'for' Keyword
|
||||
' ' Text.Whitespace
|
||||
'field' Name
|
||||
' ' Text.Whitespace
|
||||
'in' Keyword
|
||||
' ' Text.Whitespace
|
||||
'%w(' Literal.String.Other
|
||||
'first_name middle_name last_name' Literal.String.Other
|
||||
')' Literal.String.Other
|
||||
'%}' Literal.String.Interpol
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'cmp' Name
|
||||
'=' Operator
|
||||
'{{' Literal.String.Interpol
|
||||
'field' Name
|
||||
'.' Operator
|
||||
'id' Name
|
||||
'}}' Literal.String.Interpol
|
||||
'<=>' Operator
|
||||
'other' Name
|
||||
'.' Operator
|
||||
'{{' Literal.String.Interpol
|
||||
'field' Name
|
||||
'.' Operator
|
||||
'id' Name
|
||||
'}}' Literal.String.Interpol
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'return' Keyword
|
||||
' ' Text.Whitespace
|
||||
'cmp' Name
|
||||
' ' Text.Whitespace
|
||||
'if' Keyword
|
||||
' ' Text.Whitespace
|
||||
'cmp' Name
|
||||
'!=' Operator
|
||||
'0' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'{%' Literal.String.Interpol
|
||||
'end' Keyword
|
||||
'%}' Literal.String.Interpol
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'0' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'end' Keyword
|
||||
'\n' Text.Whitespace
|
84
spec/tests/crystal/test_numbers.txt
Normal file
84
spec/tests/crystal/test_numbers.txt
Normal file
@ -0,0 +1,84 @@
|
||||
---input---
|
||||
# Integers
|
||||
0
|
||||
1
|
||||
1_000_000
|
||||
1u8
|
||||
11231231231121312i64
|
||||
|
||||
# Floats
|
||||
0.0
|
||||
1.0_f32
|
||||
1_f32
|
||||
0f64
|
||||
1e+4
|
||||
1e111
|
||||
1_234.567_890
|
||||
|
||||
# Error
|
||||
01
|
||||
0b2
|
||||
0x129g2
|
||||
0o12358
|
||||
|
||||
---tokens---
|
||||
'# Integers' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'0' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'1' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'1_000_000' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'1u8' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'11231231231121312i64' Literal.Number.Integer
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'# Floats' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'0.0' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'1.0_f32' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'1_f32' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'0f64' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'1e+4' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'1e111' Literal.Number.Float
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'1_234.567_890' Literal.Number.Float
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'# Error' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'0' Error
|
||||
'1' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'0' Error
|
||||
'b2' Name
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'0' Error
|
||||
'x129g2' Name
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'0' Error
|
||||
'o12358' Name
|
||||
'\n' Text.Whitespace
|
18
spec/tests/crystal/test_operator_methods.txt
Normal file
18
spec/tests/crystal/test_operator_methods.txt
Normal file
@ -0,0 +1,18 @@
|
||||
---input---
|
||||
([] of Int32).[]?(5)
|
||||
|
||||
---tokens---
|
||||
'(' Punctuation
|
||||
'[' Operator
|
||||
']' Operator
|
||||
' ' Text.Whitespace
|
||||
'of' Keyword
|
||||
' ' Text.Whitespace
|
||||
'Int32' Name
|
||||
')' Punctuation
|
||||
'.' Operator
|
||||
'[]?' Name.Operator
|
||||
'(' Punctuation
|
||||
'5' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
41
spec/tests/crystal/test_percent_strings.txt
Normal file
41
spec/tests/crystal/test_percent_strings.txt
Normal file
@ -0,0 +1,41 @@
|
||||
---input---
|
||||
%(hello ("world"))
|
||||
%[hello ["world"]]
|
||||
%{hello "world"}
|
||||
%<hello <"world">>
|
||||
%|hello "world"|
|
||||
|
||||
---tokens---
|
||||
'%(' Literal.String.Other
|
||||
'hello ' Literal.String.Other
|
||||
'(' Literal.String.Other
|
||||
'"world"' Literal.String.Other
|
||||
')' Literal.String.Other
|
||||
')' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'%[' Literal.String.Other
|
||||
'hello ' Literal.String.Other
|
||||
'[' Literal.String.Other
|
||||
'"world"' Literal.String.Other
|
||||
']' Literal.String.Other
|
||||
']' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'%{' Literal.String.Other
|
||||
'hello "world"' Literal.String.Other
|
||||
'}' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'%<' Literal.String.Other
|
||||
'hello ' Literal.String.Other
|
||||
'<' Literal.String.Other
|
||||
'"world"' Literal.String.Other
|
||||
'>' Literal.String.Other
|
||||
'>' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'%|' Literal.String.Other
|
||||
'hello "world"' Literal.String.Other
|
||||
'|' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
31
spec/tests/crystal/test_percent_strings_special.txt
Normal file
31
spec/tests/crystal/test_percent_strings_special.txt
Normal file
@ -0,0 +1,31 @@
|
||||
---input---
|
||||
%Q(hello \n #{name})
|
||||
%q(hello \n #{name})
|
||||
%w(foo\nbar baz)
|
||||
|
||||
---tokens---
|
||||
'%Q(' Literal.String.Other
|
||||
'hello ' Literal.String.Other
|
||||
'\\n' Literal.String.Escape
|
||||
' ' Literal.String.Other
|
||||
'#{' Literal.String.Interpol
|
||||
'name' Name
|
||||
'}' Literal.String.Interpol
|
||||
')' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'%q(' Literal.String.Other
|
||||
'hello ' Literal.String.Other
|
||||
'\\' Literal.String.Other
|
||||
'n ' Literal.String.Other
|
||||
'#' Literal.String.Other
|
||||
'{name}' Literal.String.Other
|
||||
')' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'%w(' Literal.String.Other
|
||||
'foo' Literal.String.Other
|
||||
'\\' Literal.String.Other
|
||||
'nbar baz' Literal.String.Other
|
||||
')' Literal.String.Other
|
||||
'\n' Text.Whitespace
|
20
spec/tests/crystal/test_pseudo_builtins.txt
Normal file
20
spec/tests/crystal/test_pseudo_builtins.txt
Normal file
@ -0,0 +1,20 @@
|
||||
---input---
|
||||
record Cls do
|
||||
def_equals s
|
||||
end
|
||||
|
||||
---tokens---
|
||||
'record' Name.Builtin.Pseudo
|
||||
' ' Text.Whitespace
|
||||
'Cls' Name
|
||||
' ' Text.Whitespace
|
||||
'do' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'def_equals' Name.Builtin.Pseudo
|
||||
' ' Text.Whitespace
|
||||
's' Name
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'end' Keyword
|
||||
'\n' Text.Whitespace
|
50
spec/tests/crystal/test_pseudo_keywords.txt
Normal file
50
spec/tests/crystal/test_pseudo_keywords.txt
Normal file
@ -0,0 +1,50 @@
|
||||
---input---
|
||||
def f(x : T, line = __LINE__) forall T
|
||||
if x.is_a?(String)
|
||||
pp! x
|
||||
end
|
||||
end
|
||||
|
||||
---tokens---
|
||||
'def' Keyword
|
||||
' ' Text.Whitespace
|
||||
'f' Name.Function
|
||||
'(' Punctuation
|
||||
'x' Name
|
||||
' ' Text.Whitespace
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'T' Name
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'line' Name
|
||||
' ' Text.Whitespace
|
||||
'=' Operator
|
||||
' ' Text.Whitespace
|
||||
'__LINE__' Keyword.Pseudo
|
||||
')' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'forall' Keyword.Pseudo
|
||||
' ' Text.Whitespace
|
||||
'T' Name
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'if' Keyword
|
||||
' ' Text.Whitespace
|
||||
'x' Name
|
||||
'.is_a?' Keyword.Pseudo
|
||||
'(' Punctuation
|
||||
'String' Name
|
||||
')' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'pp!' Name.Builtin.Pseudo
|
||||
' ' Text.Whitespace
|
||||
'x' Name
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'end' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'end' Keyword
|
||||
'\n' Text.Whitespace
|
8
spec/tests/crystal/test_range_syntax1.txt
Normal file
8
spec/tests/crystal/test_range_syntax1.txt
Normal file
@ -0,0 +1,8 @@
|
||||
---input---
|
||||
1...3
|
||||
|
||||
---tokens---
|
||||
'1' Literal.Number.Integer
|
||||
'...' Operator
|
||||
'3' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
10
spec/tests/crystal/test_range_syntax2.txt
Normal file
10
spec/tests/crystal/test_range_syntax2.txt
Normal file
@ -0,0 +1,10 @@
|
||||
---input---
|
||||
1 .. 3
|
||||
|
||||
---tokens---
|
||||
'1' Literal.Number.Integer
|
||||
' ' Text.Whitespace
|
||||
'..' Operator
|
||||
' ' Text.Whitespace
|
||||
'3' Literal.Number.Integer
|
||||
'\n' Text.Whitespace
|
58
spec/tests/crystal/test_string_escapes.txt
Normal file
58
spec/tests/crystal/test_string_escapes.txt
Normal file
@ -0,0 +1,58 @@
|
||||
---input---
|
||||
"a\nz"
|
||||
"a\az"
|
||||
"a\xffz"
|
||||
"a\u1234z"
|
||||
"a\000z"
|
||||
"a\u{0}z"
|
||||
"a\u{10AfF9}z"
|
||||
|
||||
---tokens---
|
||||
'"' Literal.String.Double
|
||||
'a' Literal.String.Double
|
||||
'\\n' Literal.String.Escape
|
||||
'z' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"' Literal.String.Double
|
||||
'a' Literal.String.Double
|
||||
'\\a' Literal.String.Escape
|
||||
'z' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"' Literal.String.Double
|
||||
'a' Literal.String.Double
|
||||
'\\xff' Literal.String.Escape
|
||||
'z' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"' Literal.String.Double
|
||||
'a' Literal.String.Double
|
||||
'\\u1234' Literal.String.Escape
|
||||
'z' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"' Literal.String.Double
|
||||
'a' Literal.String.Double
|
||||
'\\000' Literal.String.Escape
|
||||
'z' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"' Literal.String.Double
|
||||
'a' Literal.String.Double
|
||||
'\\u{0}' Literal.String.Escape
|
||||
'z' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'"' Literal.String.Double
|
||||
'a' Literal.String.Double
|
||||
'\\u{10AfF9}' Literal.String.Escape
|
||||
'z' Literal.String.Double
|
||||
'"' Literal.String.Double
|
||||
'\n' Text.Whitespace
|
20
spec/tests/crystal/test_symbols.txt
Normal file
20
spec/tests/crystal/test_symbols.txt
Normal file
@ -0,0 +1,20 @@
|
||||
---input---
|
||||
:sym_bol
|
||||
:あ
|
||||
:question?
|
||||
:"symbol"
|
||||
|
||||
---tokens---
|
||||
':sym_bol' Literal.String.Symbol
|
||||
'\n' Text.Whitespace
|
||||
|
||||
':あ' Literal.String.Symbol
|
||||
'\n' Text.Whitespace
|
||||
|
||||
':question?' Literal.String.Symbol
|
||||
'\n' Text.Whitespace
|
||||
|
||||
':"' Literal.String.Symbol
|
||||
'symbol' Literal.String.Symbol
|
||||
'"' Literal.String.Symbol
|
||||
'\n' Text.Whitespace
|
51
spec/tests/css/percent_in_func.txt
Normal file
51
spec/tests/css/percent_in_func.txt
Normal file
@ -0,0 +1,51 @@
|
||||
---input---
|
||||
.target-img {
|
||||
position: absolute;
|
||||
top: 25%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
---tokens---
|
||||
'.' Punctuation
|
||||
'target-img' Name.Class
|
||||
' ' Text.Whitespace
|
||||
'{' Punctuation
|
||||
'\n ' Text.Whitespace
|
||||
'position' Keyword
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'absolute' Keyword.Constant
|
||||
';' Punctuation
|
||||
' \n ' Text.Whitespace
|
||||
'top' Keyword
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'25' Literal.Number.Integer
|
||||
'%' Keyword.Type
|
||||
';' Punctuation
|
||||
' \n ' Text.Whitespace
|
||||
'left' Keyword
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'50' Literal.Number.Integer
|
||||
'%' Keyword.Type
|
||||
';' Punctuation
|
||||
' \n ' Text.Whitespace
|
||||
'transform' Keyword
|
||||
':' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'translate' Name.Builtin
|
||||
'(' Punctuation
|
||||
'-50' Literal.Number.Integer
|
||||
'%' Keyword.Type
|
||||
',' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'-50' Literal.Number.Integer
|
||||
'%' Keyword.Type
|
||||
')' Punctuation
|
||||
';' Punctuation
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'}' Punctuation
|
||||
' \n' Text.Whitespace
|
107
spec/tests/desktop_entry/example.txt
Normal file
107
spec/tests/desktop_entry/example.txt
Normal file
@ -0,0 +1,107 @@
|
||||
---input---
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Type=Application
|
||||
Name=Foo Viewer
|
||||
Comment=The best viewer for Foo objects available!
|
||||
Comment[fr]=Le meilleur visionneur d'objets Foo disponible !
|
||||
TryExec=fooview
|
||||
Exec=fooview %F
|
||||
Icon=fooview
|
||||
MimeType=image/x-foo;
|
||||
Actions=Gallery;Create;
|
||||
|
||||
[Desktop Action Gallery]
|
||||
Exec=fooview --gallery
|
||||
Name=Browse Gallery
|
||||
|
||||
[Desktop Action Create]
|
||||
Exec=fooview --create-new
|
||||
Name=Create a new Foo!
|
||||
Icon=fooview-new
|
||||
|
||||
---tokens---
|
||||
'[Desktop Entry]' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'Version' Name.Attribute
|
||||
'=' Operator
|
||||
'1.0' Literal.String
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'Type' Name.Attribute
|
||||
'=' Operator
|
||||
'Application' Literal.String
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'Name' Name.Attribute
|
||||
'=' Operator
|
||||
'Foo Viewer' Literal.String
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'Comment' Name.Attribute
|
||||
'=' Operator
|
||||
'The best viewer for Foo objects available!' Literal.String
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'Comment' Name.Attribute
|
||||
'[fr]' Name.Namespace
|
||||
'=' Operator
|
||||
"Le meilleur visionneur d'objets Foo disponible !" Literal.String
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'TryExec' Name.Attribute
|
||||
'=' Operator
|
||||
'fooview' Literal.String
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'Exec' Name.Attribute
|
||||
'=' Operator
|
||||
'fooview %F' Literal.String
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'Icon' Name.Attribute
|
||||
'=' Operator
|
||||
'fooview' Literal.String
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'MimeType' Name.Attribute
|
||||
'=' Operator
|
||||
'image/x-foo;' Literal.String
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'Actions' Name.Attribute
|
||||
'=' Operator
|
||||
'Gallery;Create;' Literal.String
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'[Desktop Action Gallery]' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'Exec' Name.Attribute
|
||||
'=' Operator
|
||||
'fooview --gallery' Literal.String
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'Name' Name.Attribute
|
||||
'=' Operator
|
||||
'Browse Gallery' Literal.String
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
'[Desktop Action Create]' Keyword
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'Exec' Name.Attribute
|
||||
'=' Operator
|
||||
'fooview --create-new' Literal.String
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'Name' Name.Attribute
|
||||
'=' Operator
|
||||
'Create a new Foo!' Literal.String
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'Icon' Name.Attribute
|
||||
'=' Operator
|
||||
'fooview-new' Literal.String
|
||||
'\n' Text.Whitespace
|
38
spec/tests/diff/normal.txt
Normal file
38
spec/tests/diff/normal.txt
Normal file
@ -0,0 +1,38 @@
|
||||
---input---
|
||||
1,2d0
|
||||
< A
|
||||
< A
|
||||
4c2
|
||||
< C
|
||||
---
|
||||
> F
|
||||
5a4
|
||||
> E
|
||||
|
||||
---tokens---
|
||||
'1,2d0' Generic.Subheading
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'< A' Generic.Deleted
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'< A' Generic.Deleted
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'4c2' Generic.Subheading
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'< C' Generic.Deleted
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'---' Generic.Strong
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'> F' Generic.Inserted
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'5a4' Generic.Subheading
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'> E' Generic.Inserted
|
||||
'\n' Text.Whitespace
|
44
spec/tests/diff/unified.txt
Normal file
44
spec/tests/diff/unified.txt
Normal file
@ -0,0 +1,44 @@
|
||||
---input---
|
||||
--- old.txt 2023-01-17 21:02:15.449417575 -0700
|
||||
+++ new.txt 2023-01-17 21:02:12.489441682 -0700
|
||||
@@ -1,5 +1,4 @@
|
||||
-A
|
||||
-A
|
||||
B
|
||||
-C
|
||||
+F
|
||||
D
|
||||
+E
|
||||
|
||||
---tokens---
|
||||
'--- old.txt\t2023-01-17 21:02:15.449417575 -0700' Generic.Deleted
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'+++ new.txt\t2023-01-17 21:02:12.489441682 -0700' Generic.Inserted
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'@@ -1,5 +1,4 @@' Generic.Subheading
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'-A' Generic.Deleted
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'-A' Generic.Deleted
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'B' Text
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'-C' Generic.Deleted
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'+F' Generic.Inserted
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'D' Text
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'+E' Generic.Inserted
|
||||
'\n' Text.Whitespace
|
20
spec/tests/dns/a-record.txt
Normal file
20
spec/tests/dns/a-record.txt
Normal file
@ -0,0 +1,20 @@
|
||||
---input---
|
||||
delta A 192.0.2.4 ; comment
|
||||
delta2 A 192.0.2.5
|
||||
|
||||
---tokens---
|
||||
'delta' Name
|
||||
' ' Text.Whitespace
|
||||
'A' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'192.0.2.4' Literal
|
||||
' ' Text.Whitespace
|
||||
'; comment' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
'delta2' Name
|
||||
' ' Text.Whitespace
|
||||
'A' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'192.0.2.5' Literal
|
||||
'\n' Text.Whitespace
|
8
spec/tests/dns/include.txt
Normal file
8
spec/tests/dns/include.txt
Normal file
@ -0,0 +1,8 @@
|
||||
---input---
|
||||
$INCLUDE test.zone
|
||||
|
||||
---tokens---
|
||||
'$INCLUDE' Comment.Preproc
|
||||
' ' Text.Whitespace
|
||||
'test.zone' Comment.PreprocFile
|
||||
'\n' Text.Whitespace
|
55
spec/tests/dns/soa.txt
Normal file
55
spec/tests/dns/soa.txt
Normal file
@ -0,0 +1,55 @@
|
||||
---input---
|
||||
@ IN SOA ns root ( ; E-mail
|
||||
42 ; Serial
|
||||
2h ; Refresh
|
||||
1h ; Retry
|
||||
14d ; Expire
|
||||
1h ) ; Negative Cache TTL
|
||||
|
||||
---tokens---
|
||||
'@' Operator
|
||||
' ' Text.Whitespace
|
||||
'IN' Name.Class
|
||||
' ' Text.Whitespace
|
||||
'SOA' Keyword.Type
|
||||
' ' Text.Whitespace
|
||||
'ns' Literal
|
||||
' ' Text.Whitespace
|
||||
'root' Literal
|
||||
' ' Text.Whitespace
|
||||
'(' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'; E-mail' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'42' Literal.Number.Integer
|
||||
' ' Text.Whitespace
|
||||
'; Serial' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'2h' Literal.Number.Integer
|
||||
' ' Text.Whitespace
|
||||
'; Refresh' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'1h' Literal.Number.Integer
|
||||
' ' Text.Whitespace
|
||||
'; Retry' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'14d' Literal.Number.Integer
|
||||
' ' Text.Whitespace
|
||||
'; Expire' Comment.Single
|
||||
'\n' Text.Whitespace
|
||||
|
||||
' ' Text.Whitespace
|
||||
'1h' Literal.Number.Integer
|
||||
' ' Text.Whitespace
|
||||
')' Punctuation
|
||||
' ' Text.Whitespace
|
||||
'; Negative Cache TTL' Comment.Single
|
||||
'\n' Text.Whitespace
|
112
spec/tests/fortran/test_string_cataback.txt
Normal file
112
spec/tests/fortran/test_string_cataback.txt
Normal file
@ -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
|
29
spec/tests/gas/test_comments.txt
Normal file
29
spec/tests/gas/test_comments.txt
Normal file
@ -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
|
9
spec/tests/gas/test_cpuid.txt
Normal file
9
spec/tests/gas/test_cpuid.txt
Normal file
@ -0,0 +1,9 @@
|
||||
# CPU is a valid directive, and we don't want to parse this as
|
||||
# cpu id, but as a single token. See bug #1517
|
||||
|
||||
---input---
|
||||
cpuid
|
||||
|
||||
---tokens---
|
||||
'cpuid' Name.Function
|
||||
'\n' Text.Whitespace
|
6
spec/tests/gdscript/test_comment.txt
Normal file
6
spec/tests/gdscript/test_comment.txt
Normal file
@ -0,0 +1,6 @@
|
||||
---input---
|
||||
# Comment
|
||||
|
||||
---tokens---
|
||||
'# Comment' Comment.Single
|
||||
'\n' Text.Whitespace
|
17
spec/tests/gdscript/test_export_array.txt
Normal file
17
spec/tests/gdscript/test_export_array.txt
Normal file
@ -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
|
33
spec/tests/gdscript/test_function_with_types.txt
Normal file
33
spec/tests/gdscript/test_function_with_types.txt
Normal file
@ -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
|
20
spec/tests/gdscript/test_inner_class.txt
Normal file
20
spec/tests/gdscript/test_inner_class.txt
Normal file
@ -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
|
8
spec/tests/gdscript/test_multiline_string.txt
Normal file
8
spec/tests/gdscript/test_multiline_string.txt
Normal file
@ -0,0 +1,8 @@
|
||||
---input---
|
||||
"""
|
||||
Multiline
|
||||
"""
|
||||
|
||||
---tokens---
|
||||
'"""\nMultiline\n"""' Literal.String.Doc
|
||||
'\n' Text.Whitespace
|
15
spec/tests/gdscript/test_signal.txt
Normal file
15
spec/tests/gdscript/test_signal.txt
Normal file
@ -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
|
22
spec/tests/gdscript/test_simple_function.txt
Normal file
22
spec/tests/gdscript/test_simple_function.txt
Normal file
@ -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
|
@ -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
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user