Pregunta

I am playing around with the DemoApp that comes bundled with ParseKit and I am having a strange issue. I create this grammar:

 @start = tag; tag = '{' Word ';' Word '}';

and it parses a sentence like:

{foo;bar}

just fine. The issue arises when I change the grammar slightly to be:

@start = tag; tag = '{' Word '\' Word '}';

This causes the app the crash. ParseKit does not seem to like the \ token. Any ideas?

¿Fue útil?

Solución

Developer of ParseKit here.

Great example! You've found a bug in ParseKit related to escaped backslashes inside quoted strings. I've fixed the issue. Please update to HEAD of trunk from Google Code.

However, this is also an issue in your example grammar. You will need to escape the backslash in your quoted string. Otherwise it will be escaping the "close quote". So change to this:

@start = tag; tag = '{' Word '\\' Word '}';
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top