Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>
Clone
HTTPS:
git clone https://vervis.peers.community/repos/yEzqv
SSH:
git clone USERNAME@vervis.peers.community:yEzqv
Branches
Tags
2.mdwn
[[!template id=ticket class=task done=yes]] [[!tag /projects/kort/decisions]]
[[!meta title=“Value escape rules in the parser”]]
Problem
There are clear escape rules for Uids. But for values, there is the general syntax for the literal part, and specific rules for the various types. For example, \&
is an escape specific to Strings. At which parsing stages should Kort handle value escape rules?
Process
In the first parsing stage, there is no handling of type specifics, because these are specific to the current definitions of Smaoin and don’t make a Kort value’s validity change. Kort is indeed for Smaoin, but it’s more general than that and can be used for other models. Therefore, the parsing rules for value literals consider anything starting with \
as an escape sequence, and it’s enough to succesfully parse a literal and allow literals with }
to be written.
It also potentially allows any escape sequence, but these are type specific. In the first parsing stage, they can’t be handled. The only ones which could perhaps make sense here are \\
and \}
. But will they necessarily behave the same in any type? No. Perhaps the syntax allows literal \
and }
only using numeric escapes, e.g. \x5C
.
In the next stages, type specific sequences can be handled with confidence.
Decision
No unescaping in first stage. Only type-specific ones in later stages.