PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » PHP » PHP_LexerGenerator

translate lexer files in lex2php format into a PHP 5 lexer

This package is unmaintained.

Download latest release 0.4.0 (archived versions might be outdated)

License: New BSD License

Description

Translate a lexer file with a format similar to re2c (http://re2c.org)
into a PHP 5 lexer for use with a parser.

Unlike re2c (as of re2c version 0.11), generated lexers are state-aware
out of the box.

Generated lexers are very efficient, more than twice as efficient as other
alternatives like csLex (written in C#) because they utilize PHP's
built-in Perl-compatible regular expressions to lex for tokens.

Now in version 0.3.0+, with processing instruction %longestmatch, generated
lexers will always pick the longest string to match, rather than the first.
Generated lexers are slightly slower, but match behavior of legacy lexers like
flex, lex, re2c.

Maintainers

Dependencies

Required

Releases

Bugs

IDStatusTypeVersionDateSummary
#8259ClosedBug0.2.12006-07-20Strange regex generated
#8593ClosedBug0.2.12006-08-30if no statename "const 1=1" inserted
#8618ClosedBug0.2.22006-09-02null causes regex to break
#8619DuplicateBug0.2.22006-09-02octal detected as backref
#8879ClosedReqCVS2006-10-06lexer not picking longest match
#9006ClosedBug0.2.32006-10-12wrong replacements for plex script
#9007ClosedBug0.2.32006-10-12yymore does not honor return value "true" to change state
#9211ClosedBug0.3.02006-11-01Typos
#9230ClosedBug0.3.02006-11-03Escape sequences
#9231ClosedBug0.3.02006-11-03Non-greedy regex extension
#9892ClosedBugCVS2007-01-20dirname(__FILE__) should not be used for include/require
#11132ClosedBug0.3.12007-05-24calls to substr_count had args in wrong order
#11808ClosedBug0.3.32007-08-09yymore broken
#11912ClosedReq0.3.42007-08-28Case-insensitive literal strings
#11914ClosedReq0.3.42007-08-28Single line comments
#11916ClosedBug0.3.42007-08-28Missing placeholder strings
#11917ClosedReq0.3.42007-08-28Faster regexp matching with \G instead of substr()
#11919ClosedBug0.3.42007-08-28Missing spaces in exception messages
#12144ClosedBugCVS2007-09-29Integrated patch + unit test
#12564OpenBugCVS2007-12-01Unicode support incomplete
#12638ClosedBug0.3.42007-12-07Undefined offset: 0 in PHP/LexerGenerator/Parser.php on line 390
#13221OpenReq0.3.4 and CVS2008-02-26Unescaped hyphen can't be used to express itself in character classes
#13222ClosedBug0.3.42008-02-26Incorrect enclosing quotes for rules with %matchlongest 1
#13252OpenReq0.3.42008-02-28Possibility to reuse a rule.
#13253BogusReq0.3.42008-02-28Allow use of digits in regexp names.
#14731OpenBug0.3.42008-10-02$ in regex is interpreted as an reference to variable
#16944OpenBug0.3.42009-12-26Bug in regexp lookahead
#18454OpenBug0.4.02011-04-18single quote is not escaped properly in yy_global_pattern
#19002ClosedBugSVN2011-11-14remove error_reporting (for PEAR QA team)