Reorganize tests into a real spec suite

This commit is contained in:
2024-08-04 19:18:43 -03:00
parent 57c160173c
commit e7c2053222
693 changed files with 136 additions and 116 deletions

View File

@ -0,0 +1,101 @@
# Test keywords are identified
---input---
mutable struct MutableType end
struct ImmutableType end
abstract type AbstractMyType end
primitive type MyPrimitive 32 end
(abstract, mutable, type) = true, π, missing
abstract type AbstractMyType end
primitive type MyPrimitive 32 end
mutable struct MutableType end
---tokens---
'mutable' Keyword
' ' Text.Whitespace
'struct' Keyword
' ' Text
'MutableType' Keyword.Type
' ' Text.Whitespace
'end' Keyword
'\n' Text.Whitespace
'struct' Keyword
' ' Text
'ImmutableType' Keyword.Type
' ' Text.Whitespace
'end' Keyword
'\n' Text.Whitespace
'abstract' Keyword
' ' Text.Whitespace
'type' Keyword
' ' Text
'AbstractMyType' Keyword.Type
' ' Text.Whitespace
'end' Keyword
'\n' Text.Whitespace
'primitive' Keyword
' ' Text.Whitespace
'type' Keyword
' ' Text
'MyPrimitive' Keyword.Type
' ' Text.Whitespace
'32' Literal.Number.Integer
' ' Text.Whitespace
'end' Keyword
'\n' Text.Whitespace
'(' Punctuation
'abstract' Name
',' Punctuation
' ' Text.Whitespace
'mutable' Name
',' Punctuation
' ' Text.Whitespace
'type' Name
')' Punctuation
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'true' Name.Builtin
',' Punctuation
' ' Text.Whitespace
'π' Name.Builtin
',' Punctuation
' ' Text.Whitespace
'missing' Name.Builtin
'\n' Text.Whitespace
'\n' Text.Whitespace
'abstract' Keyword
' ' Text.Whitespace
'type' Keyword
' ' Text
'AbstractMyType' Keyword.Type
' ' Text.Whitespace
'end' Keyword
'\n' Text.Whitespace
'primitive' Keyword
' \t' Text.Whitespace
'type' Keyword
' ' Text
'MyPrimitive' Keyword.Type
' ' Text.Whitespace
'32' Literal.Number.Integer
' ' Text.Whitespace
'end' Keyword
'\n' Text.Whitespace
'mutable' Keyword
' ' Text.Whitespace
'struct' Keyword
' ' Text
'MutableType' Keyword.Type
' ' Text.Whitespace
'end' Keyword
'\n' Text.Whitespace

View File

@ -0,0 +1,56 @@
# Test that macros are parsed, including ones which are defined as symbols
---input---
@generated function
@. a + b
@~ a + b
@± a + b
@mymacro(a, b)
@+¹ᵀ a
---tokens---
'@generated' Name.Decorator
' ' Text.Whitespace
'function' Keyword
'\n' Text.Whitespace
'@.' Name.Decorator
' ' Text.Whitespace
'a' Name
' ' Text.Whitespace
'+' Operator
' ' Text.Whitespace
'b' Name
'\n' Text.Whitespace
'@~' Name.Decorator
' ' Text.Whitespace
'a' Name
' ' Text.Whitespace
'+' Operator
' ' Text.Whitespace
'b' Name
'\n' Text.Whitespace
'@±' Name.Decorator
' ' Text.Whitespace
'a' Name
' ' Text.Whitespace
'+' Operator
' ' Text.Whitespace
'b' Name
'\n' Text.Whitespace
'@mymacro' Name.Decorator
'(' Punctuation
'a' Name
',' Punctuation
' ' Text.Whitespace
'b' Name
')' Punctuation
'\n' Text.Whitespace
'@+¹ᵀ' Name.Decorator
' ' Text.Whitespace
'a' Name
'\n' Text.Whitespace

View File

@ -0,0 +1,148 @@
# Test that the range of Julia variable names are correctly identified
---input---
a # single character variable
a_simple_name
_leading_underscore
5implicit_mul
6_more_mul
nums1
nums_2
nameswith!
multiple!!
embedded!_inthemiddle
embed!1
prime_suffix
for_each # starts with keyword substring
# variables with characters > \u00A1
ð # category Ll
Aʺ # category Lm -- \U02BA (MODIFIER LETTER DOUBLE PRIME), not \U2033 (DOUBLE PRIME)
א # category Lo
Ð # category Lu
A̅ # category Mn -- \U0305 (COMBINING OVERLINE)
ⅿ # category Nl -- \U217F (SMALL ROMAN NUMERAL ONE THOUSAND)
A₁ # category No
A² # category No
€ # category Sc
© # category So
# number-like names
𝟙 # category Nd
𝟏 # category Nd
---tokens---
'a' Name
' ' Text.Whitespace
'# single character variable' Comment
'\n' Text.Whitespace
'a_simple_name' Name
'\n' Text.Whitespace
'_leading_underscore' Name
'\n' Text.Whitespace
'5' Literal.Number.Integer
'implicit_mul' Name
'\n' Text.Whitespace
'6' Literal.Number.Integer
'_more_mul' Name
'\n' Text.Whitespace
'nums1' Name
'\n' Text.Whitespace
'nums_2' Name
'\n' Text.Whitespace
'nameswith!' Name
'\n' Text.Whitespace
'multiple!!' Name
'\n' Text.Whitespace
'embedded!_inthemiddle' Name
'\n' Text.Whitespace
'embed!1' Name
'\n' Text.Whitespace
'prime_suffix' Name
'\n' Text.Whitespace
'for_each' Name
' ' Text.Whitespace
'# starts with keyword substring' Comment
'\n' Text.Whitespace
'\n' Text.Whitespace
'# variables with characters > \\u00A1' Comment
'\n' Text.Whitespace
'ð' Name
' ' Text.Whitespace
'# category Ll' Comment
'\n' Text.Whitespace
'Aʺ' Name
' ' Text.Whitespace
'# category Lm -- \\U02BA (MODIFIER LETTER DOUBLE PRIME), not \\U2033 (DOUBLE PRIME)' Comment
'\n' Text.Whitespace
'א' Name
' ' Text.Whitespace
'# category Lo' Comment
'\n' Text.Whitespace
'Ð' Name
' ' Text.Whitespace
'# category Lu' Comment
'\n' Text.Whitespace
'A̅' Name
' ' Text.Whitespace
'# category Mn -- \\U0305 (COMBINING OVERLINE)' Comment
'\n' Text.Whitespace
'ⅿ' Name
' ' Text.Whitespace
'# category Nl -- \\U217F (SMALL ROMAN NUMERAL ONE THOUSAND)' Comment
'\n' Text.Whitespace
'A₁' Name
' ' Text.Whitespace
'# category No' Comment
'\n' Text.Whitespace
'A²' Name
' ' Text.Whitespace
'# category No' Comment
'\n' Text.Whitespace
'€' Name
' ' Text.Whitespace
'# category Sc' Comment
'\n' Text.Whitespace
'©' Name
' ' Text.Whitespace
'# category So' Comment
'\n' Text.Whitespace
'\n' Text.Whitespace
'# number-like names' Comment
'\n' Text.Whitespace
'𝟙' Name
' ' Text.Whitespace
'# category Nd' Comment
'\n' Text.Whitespace
'𝟏' Name
' ' Text.Whitespace
'# category Nd' Comment
'\n' Text.Whitespace

View File

@ -0,0 +1,261 @@
# Tests identification of number forms
---input---
# floats
1e1 1e+1 1e-1
1.1e1 1.1e+1 1.1e-1 .1e1 .1_1e1 1_1.1e1 1.1_1e1 1.1_11e1
1.1E1 1.1E+1 1.1E-1 .1E1 .1_1E1 1_1.1E1 1.1_1E1 1.1_11E1
1.1f1 1.1f+1 1.1f-1 .1f1 .1_1f1 1_1.1f1 1.1_1f1 1.1_11f1
1E1 1E+1 1E-1
1f1 1f+1 1f-1
.1 1. 1.1 1.1_1 1.1_11 .1_1 .1_11 1_1.1_1
# hex floats
0x1p1 0xa_bp10 0x01_ap11 0x01_abp1
0x1.1p1 0xA.Bp10 0x0.1_Ap9 0x0_1.Ap1 0x0_1.A_Bp9
# integers
1 01 10_1 10_11
# non-decimal
0xf 0xf_0 0xfff_000
0o7 0o7_0 0o777_000
0b1 0b1_0 0b111_000
# invalid in Julia - out of range values
0xg 0o8 0b2 0x1pA
# invalid in Julia - no trailing underscores
1_ 1.1_ 0xf_ 0o7_ 0b1_ 0xF_p1
# parsed as juxtaposed numeral + variable in Julia (no underscores in exponents)
1e1_1 1E1_1 1f1_1 0xfp1_1
# not floats -- range-like expression parts
1..1 ..1 1..
---tokens---
'# floats' Comment
'\n' Text.Whitespace
' ' Text.Whitespace
'1e1' Literal.Number.Float
' ' Text.Whitespace
'1e+1' Literal.Number.Float
' ' Text.Whitespace
'1e-1' Literal.Number.Float
'\n' Text.Whitespace
'1.1e1' Literal.Number.Float
' ' Text.Whitespace
'1.1e+1' Literal.Number.Float
' ' Text.Whitespace
'1.1e-1' Literal.Number.Float
' ' Text.Whitespace
'.1e1' Literal.Number.Float
' ' Text.Whitespace
'.1_1e1' Literal.Number.Float
' ' Text.Whitespace
'1_1.1e1' Literal.Number.Float
' ' Text.Whitespace
'1.1_1e1' Literal.Number.Float
' ' Text.Whitespace
'1.1_11e1' Literal.Number.Float
'\n' Text.Whitespace
'1.1E1' Literal.Number.Float
' ' Text.Whitespace
'1.1E+1' Literal.Number.Float
' ' Text.Whitespace
'1.1E-1' Literal.Number.Float
' ' Text.Whitespace
'.1E1' Literal.Number.Float
' ' Text.Whitespace
'.1_1E1' Literal.Number.Float
' ' Text.Whitespace
'1_1.1E1' Literal.Number.Float
' ' Text.Whitespace
'1.1_1E1' Literal.Number.Float
' ' Text.Whitespace
'1.1_11E1' Literal.Number.Float
'\n' Text.Whitespace
'1.1f1' Literal.Number.Float
' ' Text.Whitespace
'1.1f+1' Literal.Number.Float
' ' Text.Whitespace
'1.1f-1' Literal.Number.Float
' ' Text.Whitespace
'.1f1' Literal.Number.Float
' ' Text.Whitespace
'.1_1f1' Literal.Number.Float
' ' Text.Whitespace
'1_1.1f1' Literal.Number.Float
' ' Text.Whitespace
'1.1_1f1' Literal.Number.Float
' ' Text.Whitespace
'1.1_11f1' Literal.Number.Float
'\n' Text.Whitespace
'1E1' Literal.Number.Float
' ' Text.Whitespace
'1E+1' Literal.Number.Float
' ' Text.Whitespace
'1E-1' Literal.Number.Float
'\n' Text.Whitespace
'1f1' Literal.Number.Float
' ' Text.Whitespace
'1f+1' Literal.Number.Float
' ' Text.Whitespace
'1f-1' Literal.Number.Float
'\n' Text.Whitespace
'.1' Literal.Number.Float
' ' Text.Whitespace
'1.' Literal.Number.Float
' ' Text.Whitespace
'1.1' Literal.Number.Float
' ' Text.Whitespace
'1.1_1' Literal.Number.Float
' ' Text.Whitespace
'1.1_11' Literal.Number.Float
' ' Text.Whitespace
'.1_1' Literal.Number.Float
' ' Text.Whitespace
'.1_11' Literal.Number.Float
' ' Text.Whitespace
'1_1.1_1' Literal.Number.Float
'\n' Text.Whitespace
'# hex floats' Comment
'\n' Text.Whitespace
'0x1p1' Literal.Number.Float
' ' Text.Whitespace
'0xa_bp10' Literal.Number.Float
' ' Text.Whitespace
'0x01_ap11' Literal.Number.Float
' ' Text.Whitespace
'0x01_abp1' Literal.Number.Float
'\n' Text.Whitespace
'0x1.1p1' Literal.Number.Float
' ' Text.Whitespace
'0xA.Bp10' Literal.Number.Float
' ' Text.Whitespace
'0x0.1_Ap9' Literal.Number.Float
' ' Text.Whitespace
'0x0_1.Ap1' Literal.Number.Float
' ' Text.Whitespace
'0x0_1.A_Bp9' Literal.Number.Float
'\n' Text.Whitespace
'\n' Text.Whitespace
'# integers' Comment
'\n' Text.Whitespace
'1' Literal.Number.Integer
' ' Text.Whitespace
'01' Literal.Number.Integer
' ' Text.Whitespace
'10_1' Literal.Number.Integer
' ' Text.Whitespace
'10_11' Literal.Number.Integer
'\n' Text.Whitespace
'\n' Text.Whitespace
'# non-decimal' Comment
'\n' Text.Whitespace
'0xf' Literal.Number.Hex
' ' Text.Whitespace
'0xf_0' Literal.Number.Hex
' ' Text.Whitespace
'0xfff_000' Literal.Number.Hex
'\n' Text.Whitespace
'0o7' Literal.Number.Oct
' ' Text.Whitespace
'0o7_0' Literal.Number.Oct
' ' Text.Whitespace
'0o777_000' Literal.Number.Oct
'\n' Text.Whitespace
'0b1' Literal.Number.Bin
' ' Text.Whitespace
'0b1_0' Literal.Number.Bin
' ' Text.Whitespace
'0b111_000' Literal.Number.Bin
'\n' Text.Whitespace
'\n' Text.Whitespace
'# invalid in Julia - out of range values' Comment
'\n' Text.Whitespace
'0' Literal.Number.Integer
'xg' Name
' ' Text.Whitespace
'0' Literal.Number.Integer
'o8' Name
' ' Text.Whitespace
'0' Literal.Number.Integer
'b2' Name
' ' Text.Whitespace
'0x1' Literal.Number.Hex
'pA' Name
'\n' Text.Whitespace
'# invalid in Julia - no trailing underscores' Comment
'\n' Text.Whitespace
'1' Literal.Number.Integer
'_' Name
' ' Text.Whitespace
'1.1' Literal.Number.Float
'_' Name
' ' Text.Whitespace
'0xf' Literal.Number.Hex
'_' Name
' ' Text.Whitespace
'0o7' Literal.Number.Oct
'_' Name
' ' Text.Whitespace
'0b1' Literal.Number.Bin
'_' Name
' ' Text.Whitespace
'0xF' Literal.Number.Hex
'_p1' Name
'\n' Text.Whitespace
'# parsed as juxtaposed numeral + variable in Julia (no underscores in exponents)' Comment
'\n' Text.Whitespace
'1e1' Literal.Number.Float
'_1' Name
' ' Text.Whitespace
'1E1' Literal.Number.Float
'_1' Name
' ' Text.Whitespace
'1f1' Literal.Number.Float
'_1' Name
' ' Text.Whitespace
'0xfp1' Literal.Number.Float
'_1' Name
'\n' Text.Whitespace
'\n' Text.Whitespace
'# not floats -- range-like expression parts' Comment
'\n' Text.Whitespace
'1' Literal.Number.Integer
'..' Operator
'1' Literal.Number.Integer
' ' Text.Whitespace
'..' Operator
'1' Literal.Number.Integer
' ' Text.Whitespace
'1' Literal.Number.Integer
'..' Operator
'\n' Text.Whitespace

View File

@ -0,0 +1,172 @@
# Test that operators --- dotted and unicode --- are identified correctly.
---input---
a += b.c
a .÷= .~b.c
a = !b ⋆ c!
a = b ? c : d ⊕ e
a = √(5)
a -> (a...) .+ 1
a \ b
1..2
a = a === b
a <: T
a >: T
a::T
[adjoint]'
(identity)''
adjoint'''
transpose'ᵀ
suffixed +¹ operator
suffixed +¹²³ operator
---tokens---
'a' Name
' ' Text.Whitespace
'+=' Operator
' ' Text.Whitespace
'b' Name
'.' Operator
'c' Name
'\n' Text.Whitespace
'a' Name
' ' Text.Whitespace
'.÷=' Operator
' ' Text.Whitespace
'.~' Operator
'b' Name
'.' Operator
'c' Name
'\n' Text.Whitespace
'a' Name
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'!' Operator
'b' Name
' ' Text.Whitespace
'⋆' Operator
' ' Text.Whitespace
'c!' Name
'\n' Text.Whitespace
'a' Name
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'b' Name
' ' Text.Whitespace
'?' Operator
' ' Text.Whitespace
'c' Name
' ' Text.Whitespace
':' Operator
' ' Text.Whitespace
'd' Name
' ' Text.Whitespace
'⊕' Operator
' ' Text.Whitespace
'e' Name
'\n' Text.Whitespace
'a' Name
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'√' Operator
'(' Punctuation
'5' Literal.Number.Integer
')' Punctuation
'\n' Text.Whitespace
'a' Name
' ' Text.Whitespace
'->' Operator
' ' Text.Whitespace
'(' Punctuation
'a' Name
'...' Operator
')' Punctuation
' ' Text.Whitespace
'.+' Operator
' ' Text.Whitespace
'1' Literal.Number.Integer
'\n' Text.Whitespace
'a' Name
' ' Text.Whitespace
'\\' Operator
' ' Text.Whitespace
'b' Name
'\n' Text.Whitespace
'1' Literal.Number.Integer
'..' Operator
'2' Literal.Number.Integer
'\n' Text.Whitespace
'a' Name
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'a' Name
' ' Text.Whitespace
'===' Operator
' ' Text.Whitespace
'b' Name
'\n' Text.Whitespace
'a' Keyword.Type
' ' Text.Whitespace
'<:' Operator
' ' Text.Whitespace
'T' Keyword.Type
'\n' Text.Whitespace
'a' Keyword.Type
' ' Text.Whitespace
'>:' Operator
' ' Text.Whitespace
'T' Keyword.Type
'\n' Text.Whitespace
'a' Name
'::' Operator
'T' Keyword.Type
'\n' Text.Whitespace
'[' Punctuation
'adjoint' Name
']' Punctuation
"'" Operator
'\n' Text.Whitespace
'(' Punctuation
'identity' Name
')' Punctuation
"''" Operator
'\n' Text.Whitespace
'adjoint' Name
"'''" Operator
'\n' Text.Whitespace
'transpose' Name
"'ᵀ" Operator
'\n' Text.Whitespace
'suffixed' Name
' ' Text.Whitespace
'+¹' Operator
' ' Text.Whitespace
'operator' Name
'\n' Text.Whitespace
'suffixed' Name
' ' Text.Whitespace
'+¹²³' Operator
' ' Text.Whitespace
'operator' Name
'\n' Text.Whitespace

View File

@ -0,0 +1,225 @@
# Tests string forms
---input---
"global function"
"An $interpolated variable"
"An $(a + 1) expression"
"""a"""
"""
global function
de e f
"inner string"
"""
raw"\\ a \" $interp $(1 + 1) \""
raw"""
"inner string"
$interp
$(1 + 1)
"""
# commented "string"
@sprintf "%0.2f" var
v"1.0"
var"#nonstandard#"
r"^[abs]+$"m
arbi"trary"suff
arbi"trary"1234
`global function`
`abc \` \$ $interpolated`
`abc $(a + 1)`
```a```
```
global function
"thing" ` \$
`now` $(now())
```
# commented `command`
arbi`trary`suff
arbi`trary`1234
---tokens---
'"' Literal.String
'global function' Literal.String
'"' Literal.String
'\n' Text.Whitespace
'"' Literal.String
'An ' Literal.String
'$interpolated' Literal.String.Interpol
' variable' Literal.String
'"' Literal.String
'\n' Text.Whitespace
'"' Literal.String
'An ' Literal.String
'$' Literal.String.Interpol
'(' Punctuation
'a' Name
' ' Text.Whitespace
'+' Operator
' ' Text.Whitespace
'1' Literal.Number.Integer
')' Punctuation
' expression' Literal.String
'"' Literal.String
'\n' Text.Whitespace
'"""' Literal.String
'a' Literal.String
'"""' Literal.String
'\n' Text.Whitespace
'"""' Literal.String
'\nglobal function\nde e f\n' Literal.String
'"' Literal.String
'inner string' Literal.String
'"' Literal.String
'\n' Literal.String
'"""' Literal.String
'\n' Text.Whitespace
'raw' Literal.String.Affix
'"' Literal.String
'\\\\ a ' Literal.String
'\\"' Literal.String.Escape
' $interp $(1 + 1) ' Literal.String
'\\"' Literal.String.Escape
'"' Literal.String
'\n' Text.Whitespace
'raw' Literal.String.Affix
'"""' Literal.String
'\n"inner string"\n$interp\n$(1 + 1)\n' Literal.String
'"""' Literal.String
'\n' Text.Whitespace
'# commented "string"' Comment
'\n' Text.Whitespace
'\n' Text.Whitespace
'@sprintf' Name.Decorator
' ' Text.Whitespace
'"' Literal.String
'%0.2f' Literal.String.Interpol
'"' Literal.String
' ' Text.Whitespace
'var' Name
'\n' Text.Whitespace
'v' Literal.String.Affix
'"' Literal.String
'1.0' Literal.String
'"' Literal.String
'\n' Text.Whitespace
'var' Literal.String.Affix
'"' Literal.String
'#nonstandard#' Literal.String
'"' Literal.String
'\n' Text.Whitespace
'\n' Text.Whitespace
'r' Literal.String.Affix
'"' Literal.String.Regex
'^[abs]+$' Literal.String.Regex
'"' Literal.String.Regex
'm' Literal.String.Affix
'\n' Text.Whitespace
'arbi' Literal.String.Affix
'"' Literal.String
'trary' Literal.String
'"' Literal.String
'suff' Literal.String.Affix
'\n' Text.Whitespace
'arbi' Literal.String.Affix
'"' Literal.String
'trary' Literal.String
'"' Literal.String
'1234' Literal.String.Affix
'\n' Text.Whitespace
'\n' Text.Whitespace
'`' Literal.String.Backtick
'global function' Literal.String.Backtick
'`' Literal.String.Backtick
'\n' Text.Whitespace
'`' Literal.String.Backtick
'abc ' Literal.String.Backtick
'\\`' Literal.String.Escape
' ' Literal.String.Backtick
'\\$' Literal.String.Escape
' ' Literal.String.Backtick
'$interpolated' Literal.String.Interpol
'`' Literal.String.Backtick
'\n' Text.Whitespace
'`' Literal.String.Backtick
'abc ' Literal.String.Backtick
'$' Literal.String.Interpol
'(' Punctuation
'a' Name
' ' Text.Whitespace
'+' Operator
' ' Text.Whitespace
'1' Literal.Number.Integer
')' Punctuation
'`' Literal.String.Backtick
'\n' Text.Whitespace
'```' Literal.String.Backtick
'a' Literal.String.Backtick
'```' Literal.String.Backtick
'\n' Text.Whitespace
'```' Literal.String.Backtick
'\nglobal function\n"thing" ' Literal.String.Backtick
'`' Literal.String.Backtick
' ' Literal.String.Backtick
'\\$' Literal.String.Escape
'\n' Literal.String.Backtick
'`' Literal.String.Backtick
'now' Literal.String.Backtick
'`' Literal.String.Backtick
' ' Literal.String.Backtick
'$' Literal.String.Interpol
'(' Punctuation
'now' Name
'(' Punctuation
')' Punctuation
')' Punctuation
'\n' Literal.String.Backtick
'```' Literal.String.Backtick
'\n' Text.Whitespace
'# commented `command`' Comment
'\n' Text.Whitespace
'\n' Text.Whitespace
'arbi' Literal.String.Affix
'`' Literal.String.Backtick
'trary' Literal.String.Backtick
'`' Literal.String.Backtick
'suff' Literal.String.Affix
'\n' Text.Whitespace
'arbi' Literal.String.Affix
'`' Literal.String.Backtick
'trary' Literal.String.Backtick
'`' Literal.String.Backtick
'1234' Literal.String.Affix
'\n' Text.Whitespace

View File

@ -0,0 +1,78 @@
# Tests that symbols are parsed as special literals
---input---
:abc_123
:abc_def
:α
Val{:mysymbol}
# non-symbols
a:b
1:b
1.:b
a::T
a<:T
a>:T
UInt(1):UInt(2)
---tokens---
':abc_123' Literal.String.Symbol
'\n' Text.Whitespace
':abc_def' Literal.String.Symbol
'\n' Text.Whitespace
':α' Literal.String.Symbol
'\n' Text.Whitespace
'Val' Keyword.Type
'{' Punctuation
':mysymbol' Literal.String.Symbol
'}' Punctuation
'\n' Text.Whitespace
'\n' Text.Whitespace
'# non-symbols' Comment
'\n' Text.Whitespace
'a' Name
':' Operator
'b' Name
'\n' Text.Whitespace
'1' Literal.Number.Integer
':' Operator
'b' Name
'\n' Text.Whitespace
'1.' Literal.Number.Float
':' Operator
'b' Name
'\n' Text.Whitespace
'a' Name
'::' Operator
'T' Keyword.Type
'\n' Text.Whitespace
'a' Keyword.Type
'<:' Operator
'T' Keyword.Type
'\n' Text.Whitespace
'a' Keyword.Type
'>:' Operator
'T' Keyword.Type
'\n' Text.Whitespace
'UInt' Keyword.Type
'(' Punctuation
'1' Literal.Number.Integer
')' Punctuation
':' Operator
'UInt' Keyword.Type
'(' Punctuation
'2' Literal.Number.Integer
')' Punctuation
'\n' Text.Whitespace

View File

@ -0,0 +1,196 @@
# Tests identifying names which must be types from context
---input---
Union{}
MyType{Nothing, Any}
f(::Union{T,S}) where S where T = 1
f(::T) where {T} = 1
f(::Type{<:T}) = 1
f(::AT) where AT <: AbstractArray{MyType,1} = 1
f(::Val{:named}) = 1
f(::typeof(sin)) = 1
MyInt <: Integer
Number >: MyInt
AT{T,1} <: B
B>:AT{T,1}
A <: f(B)
g(C) <: T
---tokens---
'Union' Keyword.Type
'{' Punctuation
'}' Punctuation
'\n' Text.Whitespace
'MyType' Keyword.Type
'{' Punctuation
'Nothing' Keyword.Type
',' Punctuation
' ' Text.Whitespace
'Any' Keyword.Type
'}' Punctuation
'\n' Text.Whitespace
'f' Name
'(' Punctuation
'::' Operator
'Union' Keyword.Type
'{' Punctuation
'T' Keyword.Type
',' Punctuation
'S' Keyword.Type
'}' Punctuation
')' Punctuation
' ' Text.Whitespace
'where' Keyword
' ' Text.Whitespace
'S' Keyword.Type
' ' Text.Whitespace
'where' Keyword
' ' Text.Whitespace
'T' Keyword.Type
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'1' Literal.Number.Integer
'\n' Text.Whitespace
'f' Name
'(' Punctuation
'::' Operator
'T' Keyword.Type
')' Punctuation
' ' Text.Whitespace
'where' Keyword
' ' Text.Whitespace
'{' Punctuation
'T' Keyword.Type
'}' Punctuation
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'1' Literal.Number.Integer
'\n' Text.Whitespace
'f' Name
'(' Punctuation
'::' Operator
'Type' Keyword.Type
'{' Punctuation
'<:' Operator
'T' Keyword.Type
'}' Punctuation
')' Punctuation
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'1' Literal.Number.Integer
'\n' Text.Whitespace
'f' Name
'(' Punctuation
'::' Operator
'AT' Keyword.Type
')' Punctuation
' ' Text.Whitespace
'where' Keyword
' ' Text.Whitespace
'AT' Keyword.Type
' ' Text.Whitespace
'<:' Operator
' ' Text.Whitespace
'AbstractArray' Keyword.Type
'{' Punctuation
'MyType' Keyword.Type
',' Punctuation
'1' Literal.Number.Integer
'}' Punctuation
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'1' Literal.Number.Integer
'\n' Text.Whitespace
'f' Name
'(' Punctuation
'::' Operator
'Val' Keyword.Type
'{' Punctuation
':named' Literal.String.Symbol
'}' Punctuation
')' Punctuation
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'1' Literal.Number.Integer
'\n' Text.Whitespace
'f' Name
'(' Punctuation
'::' Operator
'typeof' Name
'(' Punctuation
'sin' Name
')' Punctuation
')' Punctuation
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'1' Literal.Number.Integer
'\n' Text.Whitespace
'MyInt' Keyword.Type
' ' Text.Whitespace
'<:' Operator
' ' Text.Whitespace
'Integer' Keyword.Type
'\n' Text.Whitespace
'Number' Keyword.Type
' ' Text.Whitespace
'>:' Operator
' ' Text.Whitespace
'MyInt' Keyword.Type
'\n' Text.Whitespace
'AT' Keyword.Type
'{' Punctuation
'T' Keyword.Type
',' Punctuation
'1' Literal.Number.Integer
'}' Punctuation
' ' Text.Whitespace
'<:' Operator
' ' Text.Whitespace
'B' Keyword.Type
'\n' Text.Whitespace
'B' Keyword.Type
'>:' Operator
'AT' Keyword.Type
'{' Punctuation
'T' Keyword.Type
',' Punctuation
'1' Literal.Number.Integer
'}' Punctuation
'\n' Text.Whitespace
'A' Keyword.Type
' ' Text.Whitespace
'<:' Operator
' ' Text.Whitespace
'f' Name
'(' Punctuation
'B' Name
')' Punctuation
'\n' Text.Whitespace
'g' Name
'(' Punctuation
'C' Name
')' Punctuation
' ' Text.Whitespace
'<:' Operator
' ' Text.Whitespace
'T' Keyword.Type
'\n' Text.Whitespace

View File

@ -0,0 +1,37 @@
# Test that unicode character, √, in an expression is recognized
---input---
s = √((1/n) * sum(count .^ 2) - mu .^2)
---tokens---
's' Name
' ' Text.Whitespace
'=' Operator
' ' Text.Whitespace
'√' Operator
'(' Punctuation
'(' Punctuation
'1' Literal.Number.Integer
'/' Operator
'n' Name
')' Punctuation
' ' Text.Whitespace
'*' Operator
' ' Text.Whitespace
'sum' Name
'(' Punctuation
'count' Name
' ' Text.Whitespace
'.^' Operator
' ' Text.Whitespace
'2' Literal.Number.Integer
')' Punctuation
' ' Text.Whitespace
'-' Operator
' ' Text.Whitespace
'mu' Name
' ' Text.Whitespace
'.^' Operator
'2' Literal.Number.Integer
')' Punctuation
'\n' Text.Whitespace