php-peg icon indicating copy to clipboard operation
php-peg copied to clipboard

Escape single quotes

Open dgadmin opened this issue 8 years ago • 0 comments

Hello!

Single quotes in a literal would cause the PEG to crash with:

PHP Parse error:  syntax error, unexpected '';' (T_ENCAPSED_AND_WHITESPACE), expecting ';'

This happens because the literal gets eval()ed to check if it's a single character.

This patch escapes the quotes, and the parser gets generated correctly.

dgadmin avatar Aug 14 '17 20:08 dgadmin