Implementation based on Nette Tokenizer (New BSD License; https://github.com/nette/tokenizer)
Methods | ||
---|---|---|
public
|
tokenize(string $s): array
|
# |
Constants | ||
---|---|---|
public
|
TOKEN_REFERENCE = 0
|
# |
public
|
TOKEN_UNION = 1
|
# |
public
|
TOKEN_INTERSECTION = 2
|
# |
public
|
TOKEN_NULLABLE = 3
|
# |
public
|
TOKEN_OPEN_PARENTHESES = 4
|
# |
public
|
TOKEN_CLOSE_PARENTHESES = 5
|
# |
public
|
TOKEN_OPEN_ANGLE_BRACKET = 6
|
# |
public
|
TOKEN_CLOSE_ANGLE_BRACKET = 7
|
# |
public
|
TOKEN_OPEN_SQUARE_BRACKET = 8
|
# |
public
|
TOKEN_CLOSE_SQUARE_BRACKET = 9
|
# |
public
|
TOKEN_COMMA = 10
|
# |
public
|
TOKEN_VARIADIC = 11
|
# |
public
|
TOKEN_DOUBLE_COLON = 12
|
# |
public
|
TOKEN_DOUBLE_ARROW = 13
|
# |
public
|
TOKEN_EQUAL = 14
|
# |
public
|
TOKEN_OPEN_PHPDOC = 15
|
# |
public
|
TOKEN_CLOSE_PHPDOC = 16
|
# |
public
|
TOKEN_PHPDOC_TAG = 17
|
# |
public
|
TOKEN_FLOAT = 18
|
# |
public
|
TOKEN_INTEGER = 19
|
# |
public
|
TOKEN_SINGLE_QUOTED_STRING = 20
|
# |
public
|
TOKEN_DOUBLE_QUOTED_STRING = 21
|
# |
public
|
TOKEN_IDENTIFIER = 22
|
# |
public
|
TOKEN_THIS_VARIABLE = 23
|
# |
public
|
TOKEN_VARIABLE = 24
|
# |
public
|
TOKEN_HORIZONTAL_WS = 25
|
# |
public
|
TOKEN_PHPDOC_EOL = 26
|
# |
public
|
TOKEN_OTHER = 27
|
# |
public
|
TOKEN_END = 28
|
# |
public
|
TOKEN_COLON = 29
|
# |
public
|
TOKEN_WILDCARD = 30
|
# |
public
|
TOKEN_OPEN_CURLY_BRACKET = 31
|
# |
public
|
TOKEN_CLOSE_CURLY_BRACKET = 32
|
# |
public
|
TOKEN_NEGATED = 33
|
# |
public
|
TOKEN_ARROW = 34
|
# |
public
|
TOKEN_LABELS = [
self::TOKEN_REFERENCE => '\'&\'',
self::TOKEN_UNION => '\'|\'',
self::TOKEN_INTERSECTION => '\'&\'',
self::TOKEN_NULLABLE => '\'?\'',
self::TOKEN_NEGATED => '\'!\'',
self::TOKEN_OPEN_PARENTHESES => '\'(\'',
self::TOKEN_CLOSE_PARENTHESES => '\')\'',
self::TOKEN_OPEN_ANGLE_BRACKET => '\'<\'',
self::TOKEN_CLOSE_ANGLE_BRACKET => '\'>\'',
self::TOKEN_OPEN_SQUARE_BRACKET => '\'[\'',
self::TOKEN_CLOSE_SQUARE_BRACKET => '\']\'',
self::TOKEN_OPEN_CURLY_BRACKET => '\'{\'',
self::TOKEN_CLOSE_CURLY_BRACKET => '\'}\'',
self::TOKEN_COMMA => '\',\'',
self::TOKEN_COLON => '\':\'',
self::TOKEN_VARIADIC => '\'...\'',
self::TOKEN_DOUBLE_COLON => '\'::\'',
self::TOKEN_DOUBLE_ARROW => '\'=>\'',
self::TOKEN_ARROW => '\'->\'',
self::TOKEN_EQUAL => '\'=\'',
self::TOKEN_OPEN_PHPDOC => '\'/**\'',
self::TOKEN_CLOSE_PHPDOC => '\'*/\'',
self::TOKEN_PHPDOC_TAG => 'TOKEN_PHPDOC_TAG',
self::TOKEN_PHPDOC_EOL => 'TOKEN_PHPDOC_EOL',
self::TOKEN_FLOAT => 'TOKEN_FLOAT',
self::TOKEN_INTEGER => 'TOKEN_INTEGER',
self::TOKEN_SINGLE_QUOTED_STRING => 'TOKEN_SINGLE_QUOTED_STRING',
self::TOKEN_DOUBLE_QUOTED_STRING => 'TOKEN_DOUBLE_QUOTED_STRING',
self::TOKEN_IDENTIFIER => 'type',
self::TOKEN_THIS_VARIABLE => '\'$this\'',
self::TOKEN_VARIABLE => 'variable',
self::TOKEN_HORIZONTAL_WS => 'TOKEN_HORIZONTAL_WS',
self::TOKEN_OTHER => 'TOKEN_OTHER',
self::TOKEN_END => 'TOKEN_END',
self::TOKEN_WILDCARD => '*',
]
|
# |
public
|
VALUE_OFFSET = 0
|
# |
public
|
TYPE_OFFSET = 1
|
# |