================== Commas delimit fields by default ================== #!srfv1 name::alice,age:num:30 name::bob,age:num:25 --- (document (magic) (field (untyped_field (key) (value))) (field (typed_field (key) (type_hint) (value))) (field (untyped_field (key) (value))) (field (typed_field (key) (type_hint) (value)))) ================== Explicit compact directive ================== #!srfv1 #!compact name::alice,age:num:30 --- (document (magic) (directive (directive_compact)) (field (untyped_field (key) (value))) (field (typed_field (key) (type_hint) (value)))) ================== Last format directive wins ================== #!srfv1 #!long #!compact name::alice,age:num:30 --- (document (magic) (directive (directive_long)) (directive (directive_compact)) (field (untyped_field (key) (value))) (field (typed_field (key) (type_hint) (value)))) ================== Directives sharing a prefix with the format markers ================== #!srfv1 #!created=1772500000 #!longhand=1 #!compaction=1 name::alice,age:num:30 --- (document (magic) (directive (directive_created value: (timestamp))) (directive (directive_unknown)) (directive (directive_unknown)) (field (untyped_field (key) (value))) (field (typed_field (key) (type_hint) (value)))) ================== A format marker inside an inline comment is not a directive ================== #!srfv1 #!long # compact format is optional #!compact name::alice, bob --- (document (magic) (directive (directive_long (inline_comment))) (field (untyped_field (key) (value)))) ================== A format marker in a value is not a directive ================== #!srfv1 k::#!long,j::#!compact name::alice,age:num:30 --- (document (magic) (field (untyped_field (key) (value))) (field (untyped_field (key) (value))) (field (untyped_field (key) (value))) (field (typed_field (key) (type_hint) (value)))) ================== Compact format from the SRF README ================== #!srfv1 # mandatory comment with format and version. Parser instructions start with #! key::string value must have a length between colons or end with a comma,this is a number:num:5 ,null value:null:,array::array's don't exist. Use json or toml or something,data with newlines must have a length:7:foo bar,boolean value:bool:false key::this is the second record --- (document (magic (inline_comment)) (field (untyped_field (key) (value))) (field (typed_field (key) (type_hint) (value))) (field (typed_field (key) (type_hint))) (field (untyped_field (key) (value))) (field (typed_field (key) (type_hint) (value))) (field (typed_field (key) (type_hint) (value))) (field (untyped_field (key) (value))))