phpython Code
a python interpreter written in php
Status: Pre-Alpha
Brought to you by:
francescobianco
--- a/trunk/python/python-tokenizer.php +++ b/trunk/python/python-tokenizer.php @@ -121,7 +121,6 @@ $preg_ignore = $preg_whitespace + any("\\\r?\n" + $preg_whitespace) + maybe($preg_comment); $preg_name = "[a-zA-Z_]\w*"; - function python_tokenize($pycode) { $line = $pycode; @@ -137,7 +136,13 @@ $out[] = $regs[0]; $line = substr($line, strlen($regs[0])); - } else if (preg_match('/^[A-Za-z]+/', $line, $regs)) { + } else if (preg_match('/^"(([^\\"]|\\\\|\\")*)"/', $line, $regs)) { + # It's a double quoted string + var_dump($regs); + $out[] = $regs[1]; + $line = substr($line, strlen($regs[0])); + + } else if (preg_match('/^[A-Za-z_][A-Za-z0-1_]*/', $line, $regs)) { # It's a variable name $out[] = $regs[0]; $line = substr($line, strlen($regs[0]));