Escaping a Reserved Framing Symbol
A framing format can reserve a symbol for control and encode its occurrences inside payload with an escape convention.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace a reserved letter
In a toy format, an unescaped exclamation mark ends a record. A backslash introduces a literal next character, and a literal backslash is sent as two backslashes. To send one literal exclamation mark, write a backslash followed by the mark, then write a separate unescaped mark for the record ending. See separators and escaping.
Use a representative combination
Test a literal marker immediately before a real boundary and a record ending after only part of an escape. Stream framing gives alternative boundaries.[1][2]
Verify a literal marker passes through the framing layer
Suppose a toy stream uses | as delimiter and doubles it inside a record. Data A|B becomes A||B before appending the closing delimiter. Decoding needs a rule that distinguishes doubled markers from record boundaries. See separators and escaping.
Literal data: A|B
Encoded content: A||B
Single unescaped marker terminates under a grammar with unambiguous framing
Check whether the rule covers adjacent empty records
A pair of delimiters may also represent two consecutive boundaries, which makes this doubling rule ambiguous under some grammars. Use a separate escape symbol or other framing if both interpretations are allowed. Test an empty record following a delimiter.