GitXplorerGitXplorer
w

JLexPHP

public
32 stars
7 forks
1 issues

Commits

List of commits on branch master.
Unverified
3b6130a811c0cee7ecc1f197140c24848349b647

Merge pull request #2 from vonloxley/patch-1

wwez committed 12 years ago
Unverified
affb5301421d605f8ebe3ebdc799ad68f3a18010

Fix size-calculation

vvonloxley committed 12 years ago
Unverified
53bb22c1df8711dd8bbca1c3c2f4aca485c5cfb4

Update the buffer start to be relative to the index regardless, otherwise token pointer never advances.

ddhobsd committed 13 years ago
Unverified
3d6a30528c396635c98fd0d15ab895c16304b361

remove old email

wwez committed 14 years ago
Unverified
39c2812de1a4eebb0a1af63ca242774cd33b6ecd

remove dist script

wwez committed 14 years ago
Unverified
bb249b2ce5a3d24ccea478a5c854aeece0d4f30d

add comment handling

wwez committed 18 years ago

README

The README file for this repository.

JLexPHP: a Lexical Analyzer Generator for PHP, based on JLex. For copyright and licensing information, see the COPYING file.

This is an adaptation of some Java code that generates lexers from lex style input files.

The porting effort was pretty trivial, with the hardest part being the buffer management.

Usage is fairly typical of lexers; you'll want to create a lexer file like this:

----8<------

yytext(), "\n"; } . { echo "Something else ", $this->yytext(), "\n"; } ----8<------ Then run process this file: java -cp JLexPHP.jar JLexPHP.Main your.lex (the supplied makefile will create the jar file for you, or you can build it with: javac JLexPHP/Main.java jar cvf JLexPHP.jar JLexPHP/*.class ) JLexPHP will output your.lex.php. It will contain a class that will recognize the input stream described in your .lex file. Usage of that class is along the lines of: $scanner = new Yylex(fopen("file", "r")); while ($scanner->yylex()) ; A more complicated scanner will use the createToken() method to create a token object that can then be fed into a parser, such as a lemon based parser. You can see an example of that in the c.lex source file. It is designed to work in conjunction with it's corresponding c.y file in my lemon port for php. You can find more information on the lexer syntax in the JLex manual: http://www.cs.princeton.edu/~appel/modern/java/JLex/current/manual.html Enjoy! --Wez.