srf-tree-sitter/test/corpus/length_prefixed.txt
2026-09-01 10:07:02 -07:00

155 lines
2 KiB
Text

==================
Length-prefixed value spanning lines
==================
#!srfv1
#!long
data with newlines must have a length:7:foo
bar
name::alice
---
(document
(magic)
(directive
(directive_long))
(field
(typed_field
(key)
(type_hint)
(value)))
(field
(untyped_field
(key)
(value))))
==================
Length-prefixed value from the SRF type table
==================
#!srfv1
#!long
bio:12:hello
world!
---
(document
(magic)
(directive
(directive_long))
(field
(typed_field
(key)
(type_hint)
(value))))
==================
Length-prefixed value containing commas in compact format
==================
#!srfv1
k:5:a,b,c,next::x
---
(document
(magic)
(field
(typed_field
(key)
(type_hint)
(value)))
(field
(untyped_field
(key)
(value))))
==================
Length counts bytes, not characters
==================
#!srfv1
#!long
yen:3:¥5
next::ok
---
(document
(magic)
(directive
(directive_long))
(field
(typed_field
(key)
(type_hint)
(value)))
(field
(untyped_field
(key)
(value))))
==================
Length-prefixed value containing field syntax
==================
#!srfv1
#!long
raw:14:k::not a field
name::alice
---
(document
(magic)
(directive
(directive_long))
(field
(typed_field
(key)
(type_hint)
(value)))
(field
(untyped_field
(key)
(value))))
==================
Zero length is an empty value
==================
#!srfv1
#!long
empty:0:
name::alice
---
(document
(magic)
(directive
(directive_long))
(field
(typed_field
(key)
(type_hint)))
(field
(untyped_field
(key)
(value))))
==================
Whitespace around a length hint
==================
#!srfv1
#!long
padded: 7 :foo
bar
---
(document
(magic)
(directive
(directive_long))
(field
(typed_field
(key)
(type_hint)
(value))))