handling escape characters

44 views
Skip to first unread message

Trevor N

unread,
Nov 20, 2024, 5:57:20 AMNov 20
to Treetop Development
Hi all
What is the best way to handle escape characters in a given data format I'm creating grammar for ? In this particular case, the escape character in the format is a '?', which can escape the terminal symbols of the format I'm parsing.

How can this be achieved with treetop, where the ? needs to escape the following symbol and be consumed so that it doesn't appear in the data matched ?


cheers

Clifford Heath

unread,
Nov 20, 2024, 11:11:28 PMNov 20
to treet...@googlegroups.com
You need to create a rule to parse a sequence of semantic characters, where the semantic character can be a complete escape or an individual character. I do it here: <https://github.com/cjheath/activefacts-cql/blob/905cc2e72be55178fdbdc2820f9d7ef7a2381df9/lib/activefacts/cql/parser/LexicalRules.treetop#L102-L137>

Clifford Heath.

--
You received this message because you are subscribed to the Google Groups "Treetop Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to treetop-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/treetop-dev/ce9d4e11-62d3-49f0-b962-bbb8c4aac008n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages