tree-sitter-bp/test/corpus/modules.txt

158 lines
3.4 KiB
Plaintext
Raw Permalink Normal View History

2024-04-08 02:36:27 +02:00
================================================================================
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))))
2024-04-08 02:36:27 +02:00
================================================================================
Single property (trailing comma)
================================================================================
foo {
bar: 42,
}
--------------------------------------------------------------------------------
(source_file
(module
(identifier)
(property
(identifier)
(integer_literal))))
2024-04-08 02:36:27 +02:00
================================================================================
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))))
2024-04-08 02:36:27 +02:00
================================================================================
Complex value
================================================================================
foo {
some: [
{
complex: "value",
}
],
}
--------------------------------------------------------------------------------
(source_file
(module
(identifier)
(property
(identifier)
(list_expression
(map_expression
(property
(identifier)
(interpreted_string_literal)))))))
2024-04-08 02:36:27 +02:00
2024-04-08 21:27:53 +02:00
================================================================================
Multiple modules
================================================================================
foo {
answer: 42,
value: "test",
}
bar {
baz: "qux",
done: true,
}
--------------------------------------------------------------------------------
(source_file
(module
(identifier)
(property
(identifier)
(integer_literal))
(property
(identifier)
(interpreted_string_literal)))
(module
(identifier)
(property
(identifier)
(interpreted_string_literal))
(property
(identifier)
(boolean_literal))))
2024-04-08 02:36:27 +02:00
================================================================================
Rogue comma
================================================================================
foo {
,
}
--------------------------------------------------------------------------------
(source_file
(module
(identifier)
(ERROR)))