tree-sitter-bp/test/corpus/modules.txt
Bruno BELANYI 2549f6f0db Add 'property' alias
It makes the syntax tree more readable.
2024-04-08 20:15:59 +01:00

124 lines
2.8 KiB
Plaintext

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