views:

52

answers:

2

I've seen a couple of Python Javascript tokenizers and a cryptic document on Mozilla.org about a Javascript Lexer but can't find any Javascript tokenizers for PHP specifically. Are there any?

Thanks

+1  A: 

Check out Javascript for PHP5
http://j4p5.sourceforge.net/
(It's an older project, but IIRC had a pretty complete tokenizer.)

mario
+1  A: 

I 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 comes 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 come with a full Javascript tokenizer that you can maybe tap into. This looks the most interesting.

Pekka