@@ 22-37 (lines=16) @@ | ||
19 | /** |
|
20 | * @return iterable |
|
21 | */ |
|
22 | public function tokens(): array |
|
23 | { |
|
24 | return [ |
|
25 | 'T_STRING' => '"[^"\\\\]*(\\\\.[^"\\\\]*)*"', |
|
26 | 'T_BLOCK_STRING' => '"""(?:\\\\"""|(?!""").|\\s)*"""', |
|
27 | 'T_DIRECTIVE' => '@\w+', |
|
28 | 'T_VARIABLE' => '\$\w+', |
|
29 | 'T_DIGIT' => '\d+', |
|
30 | 'T_COMMENT' => '#[^\n]', |
|
31 | 'T_TYPE' => '\w+\s*[:|\(]|\)|:', |
|
32 | 'T_KEYWORD' => '(directive|enum|extend|extends|false|from|fragment|implements|input|inputUnion|import|interface|namespace|null|on|scalar|schema|true|type|union|use)\b', |
|
33 | 'T_NOT_NULL' => '!', |
|
34 | 'T_NAME' => '\w+\b', |
|
35 | 'T_LIST' => '\[|\]', |
|
36 | ]; |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * @return array |
@@ 22-38 (lines=17) @@ | ||
19 | /** |
|
20 | * @return iterable |
|
21 | */ |
|
22 | public function tokens(): array |
|
23 | { |
|
24 | return [ |
|
25 | 'T_COMMENT' => '//[^\\n]*', |
|
26 | 'T_BLOCK_COMMENT' => '/\\*.*?\\*/', |
|
27 | 'T_MODIFIER' => '(public|private|protected|abstract)\b', |
|
28 | 'T_DEFINITION' => '(interface|class|namespace)\b', |
|
29 | 'T_KEYWORD' => '(new|__halt_compiler|and|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|or|print|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor)\b', |
|
30 | 'T_TYPE' => '(int|float|bool|iterable|array|string|resource|object|void)\b', |
|
31 | 'T_TAG' => '(<\?php|\?>|<\?=|<\?)\b', |
|
32 | 'T_STRING' => '("[^"\\\\]+(\\\\.[^"\\\\]*)*"|\'[^\'\\\\]+(\\\\.[^\'\\\\]*)*\')', |
|
33 | 'T_SYMBOL' => '(\?|=>|\->|__METHOD__|__LINE__|__DIR__|__FUNCTION__|__NAMESPACE__|__CLASS__)\b', |
|
34 | 'T_VARIABLE' => '\$\w+', |
|
35 | 'T_DIGIT' => '\d+', |
|
36 | 'T_NAME' => '[a-zA-Z_\\x7f-\\xff\\\\][a-zA-Z0-9_\\x7f-\\xff\\\\]*', |
|
37 | ]; |
|
38 | } |
|
39 | ||
40 | /** |
|
41 | * @return array |