Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.4.0

Bug #9230 Escape sequences
Submitted: 2006-11-04 00:22 UTC
From: tom at inflatablecookie dot com Assigned: cellog
Status: Closed Package: PHP_LexerGenerator (version 0.3.0)
PHP Version: 5.1.5 OS: Win XP SP2
Roadmaps: (Not assigned)    
Subscription  


 [2006-11-04 00:22 UTC] tom at inflatablecookie dot com (Tom Wright)
Description: ------------ The regex parser (PHP/LexerGenerator/Regex/Parser.php) doesn't handle escape sequences very well in plex file regex definitions when they come before certain other characters. The main cause of the issue is the fact that the regexes get compiled into double quoted strings rather than single quoted strings (which I can't see a need for). Characters such as " and $ and { need to be escaped locally in the compiler (which they are), however if you need a backslash before one of those, (as in /[\\"]/ inside a single quote regex) the preceding backslash gets stripped. Test script: --------------- /*!lex2php %input $this->data %counter $this->N %token $this->token %value $this->value %line $this->line delim1 = /["]/ delim2 = /[\"]/ delim3 = /[\\"]/ */ Expected result: ---------------- in /mycompiledlexer.php $yy_global_pattern = '/^(["]|[\\"]|[\\\\"])/'; Actual result: -------------- in /mycompiledlexer.php $yy_global_pattern = "/^([\"]|[\"]|[\\\\\"])/";

Comments

 [2006-11-04 00:44 UTC] tom at inflatablecookie dot com
This problem also affects octal ranges, but strangely in the opposite manner, and only on the right hand side of the range.. /[a-z_\x7f-\xff]/ will produce [a-z_\x7f-xff]/ in the compiled lexer.
 [2006-12-16 00:16 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-12-16 00:57 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!