Implementation based on Nette Tokenizer (New BSD License; https://github.com/nette/tokenizer)
Methods | ||
---|---|---|
public
|
__construct(ParserConfig $config)
|
# |
public
|
tokenize(string $s): list<array{string, int, int}>
|
# |
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_DOCTRINE_TAG = 18
|
# |
public
|
TOKEN_FLOAT = 19
|
# |
public
|
TOKEN_INTEGER = 20
|
# |
public
|
TOKEN_SINGLE_QUOTED_STRING = 21
|
# |
public
|
TOKEN_DOUBLE_QUOTED_STRING = 22
|
# |
public
|
TOKEN_DOCTRINE_ANNOTATION_STRING = 23
|
# |
public
|
TOKEN_IDENTIFIER = 24
|
# |
public
|
TOKEN_THIS_VARIABLE = 25
|
# |
public
|
TOKEN_VARIABLE = 26
|
# |
public
|
TOKEN_HORIZONTAL_WS = 27
|
# |
public
|
TOKEN_PHPDOC_EOL = 28
|
# |
public
|
TOKEN_OTHER = 29
|
# |
public
|
TOKEN_END = 30
|
# |
public
|
TOKEN_COLON = 31
|
# |
public
|
TOKEN_WILDCARD = 32
|
# |
public
|
TOKEN_OPEN_CURLY_BRACKET = 33
|
# |
public
|
TOKEN_CLOSE_CURLY_BRACKET = 34
|
# |
public
|
TOKEN_NEGATED = 35
|
# |
public
|
TOKEN_ARROW = 36
|
# |
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_DOCTRINE_TAG => 'TOKEN_DOCTRINE_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_DOCTRINE_ANNOTATION_STRING => 'TOKEN_DOCTRINE_ANNOTATION_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
|
# |
public
|
LINE_OFFSET = 2
|
# |