Add test for literals
This commit is contained in:
parent
508ea00920
commit
aa8472e73f
134
test/corpus/literals.txt
Normal file
134
test/corpus/literals.txt
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
================================================================================
|
||||||
|
Booelan literal
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = true
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(operator)
|
||||||
|
(boolean_literal)))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Integer literal
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = 42
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(operator)
|
||||||
|
(integer_literal)))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
String literal
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = "Hello World!"
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(operator)
|
||||||
|
(interpreted_string_literal)))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
String literal special character escapes
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = "Hello\nWorld!"
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(operator)
|
||||||
|
(interpreted_string_literal
|
||||||
|
(escape_sequence))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
String literal octal
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = "Hello World\041"
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(operator)
|
||||||
|
(interpreted_string_literal
|
||||||
|
(escape_sequence))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
String literal hex
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = "Hello World\x21"
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(operator)
|
||||||
|
(interpreted_string_literal
|
||||||
|
(escape_sequence))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
String literal character escapes
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = "Hello\\\"World\""
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(operator)
|
||||||
|
(interpreted_string_literal
|
||||||
|
(escape_sequence)
|
||||||
|
(escape_sequence)
|
||||||
|
(escape_sequence))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Unterminated string literal
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = "
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(operator)
|
||||||
|
(interpreted_string_literal
|
||||||
|
(MISSING """))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
String literal unterminated escape
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
foo = "\"
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(operator)
|
||||||
|
(interpreted_string_literal
|
||||||
|
(escape_sequence)
|
||||||
|
(MISSING """))))
|
Loading…
Reference in a new issue