#!/usr/bin/env php T_.*?)\b)m', $incontent, $matches); foreach ($matches['token_name'] as $tokenName) { if ($tokenName === 'T_NOELSE' || $tokenName === 'T_ERROR') { continue; } $result .= "/**\n * @var int\n * @cvalue $tokenName\n */\n"; $result .= "const $tokenName = UNKNOWN;\n"; } $result .= "/**\n * @var int\n * @cvalue T_PAAMAYIM_NEKUDOTAYIM\n */\n"; $result .= "const T_DOUBLE_COLON = UNKNOWN;\n"; file_put_contents($outfile_stub, $result); echo "Wrote $outfile_stub\n"; $result = << | +----------------------------------------------------------------------+ */ /* DO NOT EDIT THIS FILE! This file is generated using tokenizer_data_gen.php */ #include "php.h" #include "zend.h" #include char *get_token_type_name(int token_type) { \tswitch (token_type) { CODE; foreach ($matches['token_name'] as $tokenName) { if ($tokenName === 'T_NOELSE' || $tokenName === 'T_ERROR') { continue; } if ($tokenName === 'T_PAAMAYIM_NEKUDOTAYIM') { $result .= "\t\tcase T_PAAMAYIM_NEKUDOTAYIM: return \"T_DOUBLE_COLON\";\n"; } else { $result .= "\t\tcase $tokenName: return \"$tokenName\";\n"; } } $result .= <<