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

281 lines
6.8 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))))
)
================================================================================
Use escape sequence in quoted string as a shape key
================================================================================
'\# hello \# world'
"\# hello \# world"
--------------------------------------------------------------------------------
(source_file
(shape (shape_key (string (string_fragment))))
(shape (shape_key (string
(escape_sequence)
(string_fragment)
(escape_sequence)
(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))
)
================================================================================
Label with escape sequence
================================================================================
a: Foo\nB\#ar
a: Foo\nB\@r; b: Biz\nBaz
--------------------------------------------------------------------------------
(source_file
(shape (shape_key) (label (escape_sequence) (escape_sequence)))
(shape (shape_key) (label (escape_sequence) (escape_sequence)))
(shape (shape_key) (label (escape_sequence)))
)
================================================================================
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 (custom escape characters)
================================================================================
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)
)
)
)
================================================================================
Shape with oneline comment
================================================================================
foo # hello
# world
bar
--------------------------------------------------------------------------------
(source_file
(shape (shape_key))
(line_comment)
(line_comment)
(shape (shape_key))
)
================================================================================
Shape with block comment
================================================================================
foo
"""
hello world
"""
bar
--------------------------------------------------------------------------------
(source_file
(shape (shape_key))
(block_comment)
(shape (shape_key))
)