Add string literals

Once again, taking the rules more or less straight from tree-sitter-go.
This commit is contained in:
Bruno BELANYI 2024-04-07 23:16:31 +01:00
parent 62f5031144
commit 2b78a3365a
5 changed files with 712 additions and 181 deletions

View file

@ -31,3 +31,43 @@ foo = -42
(assignment
(identifier)
(integer_literal)))
================================================================================
String
================================================================================
foo = "Hello World!"
--------------------------------------------------------------------------------
(source_file
(assignment
(identifier)
(interpreted_string_literal)))
================================================================================
String (escape)
================================================================================
foo = "Hello\nWorld!"
--------------------------------------------------------------------------------
(source_file
(assignment
(identifier)
(interpreted_string_literal
(escape_sequence))))
================================================================================
String (raw)
================================================================================
foo = `Hello\nWorld!`
--------------------------------------------------------------------------------
(source_file
(assignment
(identifier)
(raw_string_literal)))