69 lines
1.5 KiB
Plaintext
69 lines
1.5 KiB
Plaintext
================================================================================
|
|
Simple Structure
|
|
================================================================================
|
|
|
|
struct Foo {
|
|
x <int>
|
|
y <float>
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(root
|
|
(statement
|
|
(type_definition
|
|
(struct_definition
|
|
(identifier)
|
|
(identifier)
|
|
(type_specification
|
|
(type))
|
|
(identifier)
|
|
(type_specification
|
|
(type))))))
|
|
|
|
================================================================================
|
|
Nested Structure
|
|
================================================================================
|
|
|
|
struct Foo {
|
|
x <int>
|
|
y <float> = 0.0
|
|
|
|
bar <Bar> = new Bar {
|
|
baz = 42
|
|
}
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(root
|
|
(statement
|
|
(type_definition
|
|
(struct_definition
|
|
(identifier)
|
|
(identifier)
|
|
(type_specification
|
|
(type))
|
|
(identifier)
|
|
(type_specification
|
|
(type))
|
|
(statement
|
|
(expression
|
|
(value
|
|
(float))))
|
|
(identifier)
|
|
(type_specification
|
|
(type
|
|
(identifier)))
|
|
(statement
|
|
(expression
|
|
(value
|
|
(struct_instance
|
|
(identifier)
|
|
(map
|
|
(identifier)
|
|
(statement
|
|
(expression
|
|
(value
|
|
(integer)))))))))))))
|