2022-12-07 23:22:40 +03:00
|
|
|
================================================================================
|
|
|
|
Declare a shape inside a container
|
|
|
|
================================================================================
|
|
|
|
foo.baz
|
2022-12-09 12:36:31 +03:00
|
|
|
foo.bar.biz
|
2022-12-07 23:22:40 +03:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(source_file
|
2022-12-09 12:36:31 +03:00
|
|
|
(container
|
|
|
|
(container_key) (dot)
|
|
|
|
(shape (shape_key))
|
|
|
|
)
|
|
|
|
(container
|
|
|
|
(container_key) (dot)
|
|
|
|
(container
|
|
|
|
(container_key) (dot)
|
|
|
|
(shape (shape_key))
|
|
|
|
)
|
|
|
|
)
|
2022-12-07 23:22:40 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
================================================================================
|
2022-12-09 12:36:31 +03:00
|
|
|
Use quoted string as keys
|
2022-12-07 23:22:40 +03:00
|
|
|
================================================================================
|
|
|
|
'foo'.'baz'
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(source_file
|
2022-12-09 12:36:31 +03:00
|
|
|
(container
|
2022-12-10 05:23:27 +03:00
|
|
|
(container_key (string (string_fragment))) (dot)
|
|
|
|
(shape (shape_key (string (string_fragment))))
|
2022-12-09 12:36:31 +03:00
|
|
|
)
|
2022-12-07 23:22:40 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
================================================================================
|
|
|
|
Declare container inside a container using block
|
|
|
|
================================================================================
|
|
|
|
|
|
|
|
foo: {
|
|
|
|
bar: {
|
|
|
|
baz: {
|
|
|
|
biz
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(source_file
|
2022-12-09 12:36:31 +03:00
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-07 23:22:40 +03:00
|
|
|
(block
|
2022-12-09 12:36:31 +03:00
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-09 12:36:31 +03:00
|
|
|
(block
|
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-09 12:36:31 +03:00
|
|
|
(block
|
|
|
|
(shape (shape_key))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2022-12-07 23:22:40 +03:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
================================================================================
|
2022-12-09 12:36:31 +03:00
|
|
|
Declare labeled container inside a labeled container using block
|
2022-12-07 23:22:40 +03:00
|
|
|
================================================================================
|
|
|
|
|
|
|
|
foo: Foo {
|
|
|
|
bar: Bar {
|
|
|
|
baz: Baz {
|
|
|
|
biz: Biz
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(source_file
|
2022-12-09 12:36:31 +03:00
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-09 12:36:31 +03:00
|
|
|
(label)
|
2022-12-07 23:22:40 +03:00
|
|
|
(block
|
2022-12-09 12:36:31 +03:00
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-09 12:36:31 +03:00
|
|
|
(label)
|
|
|
|
(block
|
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-09 12:36:31 +03:00
|
|
|
(label)
|
|
|
|
(block
|
2024-07-12 20:36:24 +03:00
|
|
|
(shape (shape_key) (colon) (label))
|
2022-12-09 12:36:31 +03:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2022-12-07 23:22:40 +03:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2022-12-08 02:09:04 +03:00
|
|
|
================================================================================
|
|
|
|
Declare many shapes inside a container
|
|
|
|
================================================================================
|
|
|
|
|
|
|
|
foo: {
|
|
|
|
bar
|
|
|
|
biz
|
|
|
|
baz
|
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(source_file
|
2022-12-09 12:36:31 +03:00
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-09 12:36:31 +03:00
|
|
|
(block
|
|
|
|
(shape (shape_key))
|
|
|
|
(shape (shape_key))
|
|
|
|
(shape (shape_key))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
================================================================================
|
|
|
|
Declare a container with complex keys
|
|
|
|
================================================================================
|
|
|
|
|
|
|
|
Foo biz bar: {
|
|
|
|
bar biz baz: {
|
|
|
|
-biz-baz-Baz-: {
|
|
|
|
Helo world
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(source_file
|
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-09 12:36:31 +03:00
|
|
|
(block
|
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-09 12:36:31 +03:00
|
|
|
(block
|
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-09 12:36:31 +03:00
|
|
|
(block
|
|
|
|
(shape (shape_key))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
================================================================================
|
|
|
|
Declare a container with complex keys and labels
|
|
|
|
================================================================================
|
|
|
|
|
|
|
|
Foo biz bar: Biz biz Bar {
|
|
|
|
bar biz baz: baz baz biz {
|
|
|
|
-biz-baz-Baz-: Biz buz Baz {
|
|
|
|
Helo world
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(source_file
|
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-09 12:36:31 +03:00
|
|
|
(label)
|
|
|
|
(block
|
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-09 12:36:31 +03:00
|
|
|
(label)
|
|
|
|
(block
|
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-09 12:36:31 +03:00
|
|
|
(label)
|
|
|
|
(block
|
|
|
|
(shape (shape_key))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2022-12-08 02:09:04 +03:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2022-12-09 12:36:31 +03:00
|
|
|
================================================================================
|
|
|
|
Declare shapes sparsely in a container
|
|
|
|
================================================================================
|
|
|
|
|
|
|
|
Foo: Baz {
|
|
|
|
|
|
|
|
biz
|
|
|
|
|
|
|
|
baz
|
|
|
|
|
|
|
|
bar
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(source_file
|
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-09 12:36:31 +03:00
|
|
|
(label)
|
|
|
|
(block
|
|
|
|
(shape (shape_key))
|
|
|
|
(shape (shape_key))
|
|
|
|
(shape (shape_key))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2022-12-13 16:41:34 +03:00
|
|
|
|
|
|
|
================================================================================
|
|
|
|
Declare shapes in a container in single-line (Issue #11)
|
|
|
|
================================================================================
|
|
|
|
primty: Primitive types {
|
|
|
|
Never: {"!"}
|
|
|
|
|
|
|
|
Boolean: {bool}
|
|
|
|
|
|
|
|
Textual: {char; str}
|
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(source_file
|
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-13 16:41:34 +03:00
|
|
|
(label)
|
|
|
|
(block
|
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-13 16:41:34 +03:00
|
|
|
(block
|
|
|
|
(shape
|
|
|
|
(shape_key (string (string_fragment)))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-13 16:41:34 +03:00
|
|
|
(block
|
|
|
|
(shape (shape_key))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2022-12-13 16:41:34 +03:00
|
|
|
(block
|
|
|
|
(shape (shape_key))
|
|
|
|
(shape (shape_key))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2023-06-16 07:42:49 +03:00
|
|
|
|
|
|
|
================================================================================
|
|
|
|
Declare a container with a references to the parent container
|
|
|
|
================================================================================
|
|
|
|
container: {
|
|
|
|
_.foo: baz
|
|
|
|
}
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(source_file
|
|
|
|
(container
|
|
|
|
(container_key)
|
2024-07-12 20:36:24 +03:00
|
|
|
(colon)
|
2023-06-16 07:42:49 +03:00
|
|
|
(block
|
|
|
|
(container
|
|
|
|
(container_key (keyword_underscore))
|
|
|
|
(dot)
|
2024-07-12 20:36:24 +03:00
|
|
|
(shape (shape_key) (colon) (label))
|
2023-06-16 07:42:49 +03:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|