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

389 lines
8 KiB
Text

================================================================================
Simple connection
================================================================================
foo--bar
biz->baz
biz<->baz
biz<-baz
--------------------------------------------------------------------------------
(source_file
(connection
(shape_key)
(arrow)
(shape_key)
)
(connection
(shape_key)
(arrow)
(shape_key)
)
(connection
(shape_key)
(arrow)
(shape_key)
)
(connection
(shape_key)
(arrow)
(shape_key)
)
)
================================================================================
Formatted connection
================================================================================
foo -- bar
biz -> baz
biz <-> baz
biz <- baz
--------------------------------------------------------------------------------
(source_file
(connection
(shape_key)
(arrow)
(shape_key)
)
(connection
(shape_key)
(arrow)
(shape_key)
)
(connection
(shape_key)
(arrow)
(shape_key)
)
(connection
(shape_key)
(arrow)
(shape_key)
)
)
================================================================================
Connection with looooong arrow
================================================================================
foo ----------- bar
biz ----------> baz
biz <---------> baz
biz <---------- baz
--------------------------------------------------------------------------------
(source_file
(connection
(shape_key)
(arrow)
(shape_key)
)
(connection
(shape_key)
(arrow)
(shape_key)
)
(connection
(shape_key)
(arrow)
(shape_key)
)
(connection
(shape_key)
(arrow)
(shape_key)
)
)
================================================================================
Complex identifier connection
================================================================================
Foo Bar -- Biz Baz
-Bar-Foo- <- -Baz-Biz-
imAShape -- im_a_shape
im_a_shape -- im$AShape
im a shape -- i'm $a shape
i'm a shape -- a-sh$ape
a-shape -- im a sh$ape
foo' 'bar -- baz
--------------------------------------------------------------------------------
(source_file
(connection (shape_key) (arrow) (shape_key))
(connection (shape_key) (arrow) (shape_key))
(connection (shape_key) (arrow) (shape_key))
(connection (shape_key) (arrow) (shape_key))
(connection (shape_key) (arrow) (shape_key))
(connection (shape_key) (arrow) (shape_key))
(connection (shape_key) (arrow) (shape_key))
(connection (shape_key) (arrow) (shape_key))
)
================================================================================
Inline connection
================================================================================
foo--bar->biz->baz
--------------------------------------------------------------------------------
(source_file
(connection
(shape_key)
(arrow)
(shape_key)
(arrow)
(shape_key)
(arrow)
(shape_key)
)
)
================================================================================
Many connections inline
================================================================================
foo--bar;biz->baz
--------------------------------------------------------------------------------
(source_file
(connection
(shape_key)
(arrow)
(shape_key)
)
(connection
(shape_key)
(arrow)
(shape_key)
)
)
================================================================================
Labeled connections
================================================================================
foo--bar: Question?
bar -> baz: Yes
--------------------------------------------------------------------------------
(source_file
(connection
(shape_key)
(arrow)
(shape_key)
(colon)
(label)
)
(connection
(shape_key)
(arrow)
(shape_key)
(colon)
(label)
)
)
================================================================================
Connection of shapes inside a containers
================================================================================
foo.biz.baz -> bar.baz.biz: Label
--------------------------------------------------------------------------------
(source_file
(connection
(container_key) (dot) (container_key) (dot) (shape_key)
(arrow)
(container_key) (dot) (container_key) (dot) (shape_key)
(colon)
(label)
)
)
================================================================================
Connection of shapes inside a block of container
================================================================================
foo.baz: {
foo -> biz: Label
}
--------------------------------------------------------------------------------
(source_file
(container
(container_key) (dot)
(container
(container_key)
(colon)
(block
(connection
(shape_key)
(arrow)
(shape_key)
(colon)
(label)
)
)
)
)
)
================================================================================
Connection with espaced key fragments
================================================================================
\#(hello)- -- b\#-world
--------------------------------------------------------------------------------
(source_file
(connection
(shape_key
(escape_sequence)
)
(arrow)
(shape_key
(escape_sequence)
)
)
)
================================================================================
Diclare a connection with espaced key fragments
================================================================================
\#hello\[\] -- \[world\]
--------------------------------------------------------------------------------
(source_file
(connection
(shape_key
(escape_sequence)
(escape_sequence)
(escape_sequence)
)
(arrow)
(shape_key
(escape_sequence)
(escape_sequence)
)
)
)
================================================================================
Declare a referencing connection
================================================================================
(x() -> y())
(x() -> y())[0]
--------------------------------------------------------------------------------
(source_file
(connection
(referencing
(shape_key)
(arrow)
(shape_key)
)
)
(connection
(referencing
(shape_key)
(arrow)
(shape_key)
(index (integer))
)
)
)
================================================================================
Declare a referencing connection with label
================================================================================
(x -> y): label
(x -> y)[0]: label
--------------------------------------------------------------------------------
(source_file
(connection
(referencing
(shape_key)
(arrow)
(shape_key)
)
(colon)
(label)
)
(connection
(referencing
(shape_key)
(arrow)
(shape_key)
(index (integer))
)
(colon)
(label)
)
)
================================================================================
Declare a referencing connection with block
================================================================================
(x() -> y()): {
style.stroke: \#ff0000
}
(x -> y)[0]: {
style.stroke: \#ff0000
}
--------------------------------------------------------------------------------
(source_file
(connection
(referencing
(shape_key)
(arrow)
(shape_key)
)
(colon)
(block
(attribute
(keyword_style)
(dot)
(attribute
(attr_key)
(colon)
(attr_value
(escape_sequence)
)
)
)
)
)
(connection
(referencing
(shape_key)
(arrow)
(shape_key)
(index (integer))
)
(colon)
(block
(attribute
(keyword_style)
(dot)
(attribute
(attr_key)
(colon)
(attr_value
(escape_sequence)
)
)
)
)
)
)