I've seen a couple of Python Javascript tokenizers and a cryptic document on Mozilla about a Javascript Lexer but can't find any Javascript tokenizers for PHP specifically. Are there any?
Thanks
I've seen a couple of Python Javascript tokenizers and a cryptic document on Mozilla about a Javascript Lexer but can't find any Javascript tokenizers for PHP specifically. Are there any?
Thanks
Share Improve this question asked Aug 26, 2010 at 0:39 TomTom 1,0452 gold badges14 silver badges23 bronze badges4 Answers
Reset to default 2I have no experience with either, so I can't tell you anything about what they do and in what detail they tokenize code into, but I can see two:
JSLint is an executable but es with a PHP interface - probably not enough for you, as it probably doesn't publish the raw tokenization to the calling program
PHPSniffer claims to e with a full Javascript tokenizer that you can maybe tap into. This looks the most interesting.
Check out Javascript for PHP5
http://j4p5.sourceforge/
(It's an older project, but IIRC had a pretty plete tokenizer.)
JSMin+ a javascript minify implementation in PHP which includes a JSTokenizer.
It used Narcissus from Mozilla as a starting point.
jTokenizer / jParser. jTokenizer mimics the PHP tokenizer. jParser generates a parse tree, which can be traversed and manipulated.