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

212 lines
5.0 KiB
Plaintext

================================================================================
Handle end of file (issue #1)
================================================================================
foo
--------------------------------------------------------------------------------
(source_file
(shape (shape_key))
)
================================================================================
Simple shape key
================================================================================
foo
bar
--------------------------------------------------------------------------------
(source_file
(shape (shape_key))
(shape (shape_key))
)
================================================================================
Complex shape key
================================================================================
Foo bar
-Biz-baz-
imAShape
im_a$_shape
im a shape
i'm a shape
a-shape
changeTeam(member, props, ctx)
--------------------------------------------------------------------------------
(source_file
(shape (shape_key))
(shape (shape_key))
(shape (shape_key))
(shape (shape_key))
(shape (shape_key))
(shape (shape_key))
(shape (shape_key))
(shape (shape_key))
)
================================================================================
Use quoted string as a shape key
================================================================================
'foo'
--------------------------------------------------------------------------------
(source_file
(shape (shape_key (string (string_fragment))))
)
================================================================================
Define multiple shapes using semicolons
================================================================================
a;b;c
--------------------------------------------------------------------------------
(source_file
(shape (shape_key))
(shape (shape_key))
(shape (shape_key))
)
================================================================================
Labeled shapes
================================================================================
a: Foo Bar
a: Foo Bar; b: Biz Baz
--------------------------------------------------------------------------------
(source_file
(shape (shape_key) (label))
(shape (shape_key) (label))
(shape (shape_key) (label))
)
================================================================================
It should skip white spaces
================================================================================
foo
bar : Foo Bar; baz
--------------------------------------------------------------------------------
(source_file
(shape (shape_key))
(shape (shape_key) (label))
(shape (shape_key))
)
================================================================================
Use quoted string as shape key and label
================================================================================
'foo': "Label"
--------------------------------------------------------------------------------
(source_file
(shape
(shape_key (string (string_fragment)))
(label (string (string_fragment))))
)
================================================================================
Basic text block
================================================================================
foo: |
- hello
|
--------------------------------------------------------------------------------
(source_file
(shape
(shape_key)
(text_block
(raw_text)
)
)
)
================================================================================
Text block with specific language
================================================================================
foo: |go
awsSession := From(c.Request.Context())
client := s3.New(awsSession)
ctx, cancelFn := context.WithTimeout(c.Request.Context(), AWS_TIMEOUT)
defer cancelFn()
|
--------------------------------------------------------------------------------
(source_file
(shape
(shape_key)
(text_block
(language)
(raw_text)
)
)
)
================================================================================
Text block with quotes (d2-vim style)
================================================================================
foo: |`go
awsSession := From(c.Request.Context())
client := s3.New(awsSession)
ctx, cancelFn := context.WithTimeout(c.Request.Context(), AWS_TIMEOUT)
defer cancelFn()
`|
--------------------------------------------------------------------------------
(source_file
(shape
(shape_key)
(text_block
(language)
(raw_text)
)
)
)
================================================================================
Online text block
================================================================================
foo: | helo world |
bar: |%%md ## hello world %%|
--------------------------------------------------------------------------------
(source_file
(shape
(shape_key)
(text_block
(raw_text)
)
)
(shape
(shape_key)
(text_block
(language)
(raw_text)
)
)
)