Skip to content

Instantly share code, notes, and snippets.

<?php
$lines = array();
while (!feof(STDIN)) {
$line = fgets(STDIN);
if ($line === false) break;
$lines[] = $line;
}
$data = implode('', $lines);
$tokens = token_get_all($data);
$line_num = 0;
# ----------------------------------------------------------------------
# phplex.py
#
# A lexer for PHP.
# ----------------------------------------------------------------------
import ply.lex as lex
# todo: end-of-line comments containing ?>
# todo: double-quoted strings