tree-sitter-d2/test/corpus/container.txt

162 lines
3.2 KiB
Text
Raw Normal View History

2022-12-07 23:22:40 +03:00
================================================================================
Declare a shape inside a container
================================================================================
foo.baz
2022-12-09 09:00:07 +03:00
foo.bar.biz
2022-12-07 23:22:40 +03:00
--------------------------------------------------------------------------------
(source_file
2022-12-09 09:00:07 +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
)
================================================================================
Use quoted string as a shape key
================================================================================
'foo'.'baz'
--------------------------------------------------------------------------------
(source_file
2022-12-09 09:00:07 +03:00
(container
(container_key (string)) (dot)
(shape (shape_key (string)))
)
2022-12-07 23:22:40 +03:00
)
================================================================================
Declare container inside a container using block
================================================================================
foo: {
bar: {
baz: {
biz
}
}
}
--------------------------------------------------------------------------------
(source_file
2022-12-09 09:00:07 +03:00
(container
(container_key)
(block
(container
(container_key)
(block
(container
(container_key)
(block
(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)
2022-12-07 23:22:40 +03:00
(block
2022-12-09 09:00:07 +03:00
(container
(container_key)
(block
(container
(container_key)
(block
(shape (shape_key))
)
)
)
2022-12-07 23:22:40 +03:00
)
)
)
)
================================================================================
2022-12-09 09:00:07 +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 09:00:07 +03:00
(container
(container_key)
(label)
2022-12-07 23:22:40 +03:00
(block
2022-12-09 09:00:07 +03:00
(container
(container_key)
(label)
(block
(container
(container_key)
(label)
(block
(shape (shape_key) (label))
)
)
)
2022-12-07 23:22:40 +03:00
)
)
)
)
================================================================================
Declare many shapes inside a container
================================================================================
foo: {
bar
biz
baz
}
--------------------------------------------------------------------------------
(source_file
2022-12-09 09:00:07 +03:00
(container
(container_key)
(block
(shape (shape_key))
(shape (shape_key))
(shape (shape_key))
)
)
)