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

390 lines
8 KiB
Text
Raw Permalink Normal View History

2022-12-06 00:34:41 +03:00
================================================================================
2022-12-04 03:21:42 +03:00
Simple connection
2022-12-06 00:34:41 +03:00
================================================================================
2022-12-04 00:07:26 +03:00
foo--bar
2022-12-04 03:21:42 +03:00
biz->baz
biz<->baz
biz<-baz
2022-12-04 00:07:26 +03:00
2022-12-06 00:34:41 +03:00
--------------------------------------------------------------------------------
2022-12-04 00:07:26 +03:00
(source_file
(connection
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 00:07:26 +03:00
(arrow)
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:21:42 +03:00
)
(connection
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:21:42 +03:00
(arrow)
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:21:42 +03:00
)
(connection
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:21:42 +03:00
(arrow)
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:21:42 +03:00
)
(connection
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:21:42 +03:00
(arrow)
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:21:42 +03:00
)
)
2022-12-06 00:34:41 +03:00
================================================================================
2022-12-04 18:35:37 +03:00
Formatted connection
2022-12-06 00:34:41 +03:00
================================================================================
2022-12-04 18:35:37 +03:00
foo -- bar
biz -> baz
biz <-> baz
biz <- baz
2022-12-06 00:34:41 +03:00
--------------------------------------------------------------------------------
2022-12-04 18:35:37 +03:00
(source_file
(connection
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 18:35:37 +03:00
(arrow)
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 18:35:37 +03:00
)
(connection
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 18:35:37 +03:00
(arrow)
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 18:35:37 +03:00
)
(connection
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 18:35:37 +03:00
(arrow)
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 18:35:37 +03:00
)
(connection
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 18:35:37 +03:00
(arrow)
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 18:35:37 +03:00
)
)
================================================================================
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)
)
)
2022-12-04 18:35:37 +03:00
2022-12-06 00:34:41 +03:00
================================================================================
2022-12-04 03:21:42 +03:00
Complex identifier connection
2022-12-06 00:34:41 +03:00
================================================================================
2022-12-04 03:21:42 +03:00
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
2022-12-04 03:21:42 +03:00
2022-12-06 00:34:41 +03:00
--------------------------------------------------------------------------------
2022-12-04 03:21:42 +03:00
(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))
2022-12-04 03:21:42 +03:00
)
2022-12-06 00:34:41 +03:00
================================================================================
2022-12-04 03:21:42 +03:00
Inline connection
2022-12-06 00:34:41 +03:00
================================================================================
2022-12-04 03:21:42 +03:00
foo--bar->biz->baz
2022-12-06 00:34:41 +03:00
--------------------------------------------------------------------------------
2022-12-04 03:21:42 +03:00
(source_file
(connection
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:21:42 +03:00
(arrow)
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:21:42 +03:00
(arrow)
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:21:42 +03:00
(arrow)
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:21:42 +03:00
)
)
2022-12-04 03:25:38 +03:00
2022-12-06 00:34:41 +03:00
================================================================================
2022-12-04 03:27:27 +03:00
Many connections inline
2022-12-06 00:34:41 +03:00
================================================================================
2022-12-04 03:27:27 +03:00
foo--bar;biz->baz
2022-12-06 00:34:41 +03:00
--------------------------------------------------------------------------------
2022-12-04 03:27:27 +03:00
(source_file
(connection
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:27:27 +03:00
(arrow)
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:27:27 +03:00
)
(connection
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:27:27 +03:00
(arrow)
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:27:27 +03:00
)
)
2022-12-06 00:34:41 +03:00
================================================================================
Labeled connections
================================================================================
2022-12-04 03:25:38 +03:00
foo--bar: Question?
2022-12-06 00:34:41 +03:00
bar -> baz: Yes
2022-12-04 03:25:38 +03:00
2022-12-06 00:34:41 +03:00
--------------------------------------------------------------------------------
2022-12-04 03:25:38 +03:00
(source_file
(connection
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:25:38 +03:00
(arrow)
2022-12-07 23:14:25 +03:00
(shape_key)
2024-07-12 20:36:24 +03:00
(colon)
2022-12-04 03:25:38 +03:00
(label)
)
(connection
2022-12-07 23:14:25 +03:00
(shape_key)
2022-12-04 03:25:38 +03:00
(arrow)
2022-12-07 23:14:25 +03:00
(shape_key)
2024-07-12 20:36:24 +03:00
(colon)
2022-12-07 23:14:25 +03:00
(label)
)
)
================================================================================
2022-12-08 01:15:09 +03:00
Connection of shapes inside a containers
2022-12-07 23:14:25 +03:00
================================================================================
foo.biz.baz -> bar.baz.biz: Label
--------------------------------------------------------------------------------
(source_file
(connection
2022-12-08 01:15:09 +03:00
(container_key) (dot) (container_key) (dot) (shape_key)
2022-12-07 23:14:25 +03:00
(arrow)
2022-12-08 01:15:09 +03:00
(container_key) (dot) (container_key) (dot) (shape_key)
2024-07-12 20:36:24 +03:00
(colon)
2022-12-04 03:25:38 +03:00
(label)
)
)
================================================================================
Connection of shapes inside a block of container
================================================================================
foo.baz: {
foo -> biz: Label
}
--------------------------------------------------------------------------------
(source_file
(container
(container_key) (dot)
(container
(container_key)
2024-07-12 20:36:24 +03:00
(colon)
(block
(connection
(shape_key)
(arrow)
(shape_key)
2024-07-12 20:36:24 +03:00
(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)
)
)
)
================================================================================
2024-07-12 20:36:24 +03:00
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)
)
2024-07-12 20:36:24 +03:00
(colon)
(label)
)
(connection
(referencing
(shape_key)
(arrow)
(shape_key)
(index (integer))
)
2024-07-12 20:36:24 +03:00
(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)
)
2024-07-12 20:36:24 +03:00
(colon)
(block
(attribute
(keyword_style)
(dot)
(attribute
(attr_key)
2024-07-12 20:36:24 +03:00
(colon)
(attr_value
(escape_sequence)
)
)
)
)
)
(connection
(referencing
(shape_key)
(arrow)
(shape_key)
(index (integer))
)
2024-07-12 20:36:24 +03:00
(colon)
(block
(attribute
(keyword_style)
(dot)
(attribute
(attr_key)
2024-07-12 20:36:24 +03:00
(colon)
(attr_value
(escape_sequence)
)
)
)
)
)
)