dust/tree-sitter-dust/corpus/struct.txt

74 lines
1.8 KiB
Plaintext
Raw Normal View History

2024-01-06 06:05:13 +00:00
================================================================================
Simple Structure
================================================================================
struct Foo {
2024-01-06 06:05:13 +00:00
x <int>
y <float>
}
--------------------------------------------------------------------------------
(root
(statement
2024-02-16 15:55:15 +00:00
(statement_kind
(type_definition
(struct_definition
(identifier)
(identifier)
(type_specification
(type))
(identifier)
(type_specification
(type)))))))
2024-01-06 06:05:13 +00:00
================================================================================
Nested Structure
2024-01-06 06:05:13 +00:00
================================================================================
struct Foo {
2024-01-06 06:05:13 +00:00
x <int>
y <float> = 0.0
2024-02-18 15:34:59 +00:00
bar <Bar> = Bar::{
2024-01-06 06:05:13 +00:00
baz = 42
}
}
--------------------------------------------------------------------------------
(root
(statement
2024-02-16 15:55:15 +00:00
(statement_kind
(type_definition
(struct_definition
(identifier)
(identifier)
(type_specification
(type))
(identifier)
(type_specification
(type))
(statement
(statement_kind
(expression
(value
(float)))))
(identifier)
(type_specification
(type
(identifier)))
(statement
(statement_kind
(expression
(value
(struct_instance
(identifier)
(map
(identifier)
(statement
(statement_kind
(expression
(value
(integer))))))))))))))))