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

379 lines
7.8 KiB
Plaintext

================================================================================
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)
(label)
)
(connection
(shape_key)
(arrow)
(shape_key)
(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)
(label)
)
)
================================================================================
Connection of shapes inside a block of container
================================================================================
foo.baz: {
foo -> biz: Label
}
--------------------------------------------------------------------------------
(source_file
(container
(container_key) (dot)
(container
(container_key)
(block
(connection
(shape_key)
(arrow)
(shape_key)
(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)
)
(label)
)
(connection
(referencing
(shape_key)
(arrow)
(shape_key)
(index (integer))
)
(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)
)
(block
(attribute
(keyword_style)
(dot)
(attribute
(attr_key)
(attr_value
(escape_sequence)
)
)
)
)
)
(connection
(referencing
(shape_key)
(arrow)
(shape_key)
(index (integer))
)
(block
(attribute
(keyword_style)
(dot)
(attribute
(attr_key)
(attr_value
(escape_sequence)
)
)
)
)
)
)