Add modules

This commit is contained in:
Bruno BELANYI 2024-04-08 01:36:27 +01:00
parent a78ad8139f
commit 8bd249fc90
5 changed files with 2209 additions and 1317 deletions

116
test/corpus/modules.txt Normal file
View file

@ -0,0 +1,116 @@
================================================================================
Empty module
================================================================================
foo{}
--------------------------------------------------------------------------------
(source_file
(module
(identifier)))
================================================================================
Empty module (newlines)
================================================================================
foo {
}
--------------------------------------------------------------------------------
(source_file
(module
(identifier)))
================================================================================
Single property
================================================================================
foo {
bar: 42
}
--------------------------------------------------------------------------------
(source_file
(module
(identifier)
(identifier)
(integer_literal)))
================================================================================
Single property (trailing comma)
================================================================================
foo {
bar: 42,
}
--------------------------------------------------------------------------------
(source_file
(module
(identifier)
(identifier)
(integer_literal)))
================================================================================
Mixed values
================================================================================
foo {
active: true,
value: "foo",
answer: 42,
}
--------------------------------------------------------------------------------
(source_file
(module
(identifier)
(identifier)
(boolean_literal)
(identifier)
(interpreted_string_literal)
(identifier)
(integer_literal)))
================================================================================
Complex value
================================================================================
foo {
some: [
{
complex: "value",
}
],
}
--------------------------------------------------------------------------------
(source_file
(module
(identifier)
(identifier)
(list_expression
(map_expression
(identifier)
(interpreted_string_literal)))))
================================================================================
Rogue comma
================================================================================
foo {
,
}
--------------------------------------------------------------------------------
(source_file
(module
(identifier)
(ERROR)))