Module refinery.lib.scripts.php.token
Expand source code Browse git
from __future__ import annotations
import enum
from dataclasses import dataclass
class PhpTokenKind(enum.Enum):
INLINE_HTML = 'inline-html' # noqa
OPEN_TAG = 'open-tag' # noqa
OPEN_TAG_ECHO = 'open-tag-echo' # noqa
CLOSE_TAG = 'close-tag' # noqa
INTEGER = 'integer' # noqa
FLOAT = 'float' # noqa
STRING_SINGLE = 'sq-string' # noqa
STRING_DOUBLE = 'dq-string' # noqa
SHELL_EXEC = 'backtick-string' # noqa
HEREDOC = 'heredoc' # noqa
NOWDOC = 'nowdoc' # noqa
VARIABLE = 'variable' # noqa
IDENTIFIER = 'identifier' # noqa
INCLUDE = 'include' # noqa
INCLUDE_ONCE = 'include_once' # noqa
REQUIRE = 'require' # noqa
REQUIRE_ONCE = 'require_once' # noqa
EVAL = 'eval' # noqa
PRINT = 'print' # noqa
ECHO = 'echo' # noqa
EXIT = 'exit' # noqa
LOGICAL_OR = 'or' # noqa
LOGICAL_XOR = 'xor' # noqa
LOGICAL_AND = 'and' # noqa
INSTANCEOF = 'instanceof' # noqa
NEW = 'new' # noqa
CLONE = 'clone' # noqa
YIELD = 'yield' # noqa
IF = 'if' # noqa
ELSEIF = 'elseif' # noqa
ELSE = 'else' # noqa
ENDIF = 'endif' # noqa
DO = 'do' # noqa
WHILE = 'while' # noqa
ENDWHILE = 'endwhile' # noqa
FOR = 'for' # noqa
ENDFOR = 'endfor' # noqa
FOREACH = 'foreach' # noqa
ENDFOREACH = 'endforeach' # noqa
SWITCH = 'switch' # noqa
ENDSWITCH = 'endswitch' # noqa
CASE = 'case' # noqa
DEFAULT = 'default' # noqa
MATCH = 'match' # noqa
BREAK = 'break' # noqa
CONTINUE = 'continue' # noqa
GOTO = 'goto' # noqa
RETURN = 'return' # noqa
THROW = 'throw' # noqa
TRY = 'try' # noqa
CATCH = 'catch' # noqa
FINALLY = 'finally' # noqa
DECLARE = 'declare' # noqa
ENDDECLARE = 'enddeclare' # noqa
AS = 'as' # noqa
FUNCTION = 'function' # noqa
FN = 'fn' # noqa
CONST = 'const' # noqa
USE = 'use' # noqa
INSTEADOF = 'insteadof' # noqa
GLOBAL = 'global' # noqa
STATIC = 'static' # noqa
ABSTRACT = 'abstract' # noqa
FINAL = 'final' # noqa
PRIVATE = 'private' # noqa
PROTECTED = 'protected' # noqa
PUBLIC = 'public' # noqa
READONLY = 'readonly' # noqa
VAR = 'var' # noqa
UNSET = 'unset' # noqa
ISSET = 'isset' # noqa
EMPTY = 'empty' # noqa
HALT_COMPILER = '__halt_compiler' # noqa
LIST = 'list' # noqa
ARRAY = 'array' # noqa
CALLABLE = 'callable' # noqa
CLASS = 'class' # noqa
TRAIT = 'trait' # noqa
INTERFACE = 'interface' # noqa
ENUM = 'enum' # noqa
EXTENDS = 'extends' # noqa
IMPLEMENTS = 'implements' # noqa
NAMESPACE = 'namespace' # noqa
LINE = '__LINE__' # noqa
FILE = '__FILE__' # noqa
DIR = '__DIR__' # noqa
CLASS_C = '__CLASS__' # noqa
TRAIT_C = '__TRAIT__' # noqa
METHOD_C = '__METHOD__' # noqa
FUNC_C = '__FUNCTION__' # noqa
NS_C = '__NAMESPACE__' # noqa
PLUS = '+' # noqa
MINUS = '-' # noqa
STAR = '*' # noqa
SLASH = '/' # noqa
PERCENT = '%' # noqa
POW = '**' # noqa
DOT = '.' # noqa
EQUALS = '=' # noqa
PLUS_EQUAL = '+=' # noqa
MINUS_EQUAL = '-=' # noqa
MUL_EQUAL = '*=' # noqa
DIV_EQUAL = '/=' # noqa
MOD_EQUAL = '%=' # noqa
POW_EQUAL = '**=' # noqa
CONCAT_EQUAL = '.=' # noqa
AND_EQUAL = '&=' # noqa
OR_EQUAL = '|=' # noqa
XOR_EQUAL = '^=' # noqa
SL_EQUAL = '<<=' # noqa
SR_EQUAL = '>>=' # noqa
COALESCE_EQUAL = '??=' # noqa
BOOLEAN_OR = '||' # noqa
BOOLEAN_AND = '&&' # noqa
IS_EQUAL = '==' # noqa
IS_NOT_EQUAL = '!=' # noqa
IS_IDENTICAL = '===' # noqa
IS_NOT_IDENTICAL = '!==' # noqa
LT = '<' # noqa
GT = '>' # noqa
IS_SMALLER_OR_EQUAL = '<=' # noqa
IS_GREATER_OR_EQUAL = '>=' # noqa
SPACESHIP = '<=>' # noqa
SL = '<<' # noqa
SR = '>>' # noqa
COALESCE = '??' # noqa
AMP = '&' # noqa
PIPE = '|' # noqa
CARET = '^' # noqa
TILDE = '~' # noqa
BANG = '!' # noqa
INC = '++' # noqa
DEC = '--' # noqa
AT = '@' # noqa
QUESTION = '?' # noqa
COLON = ':' # noqa
DOUBLE_ARROW = '=>' # noqa
OBJECT_OPERATOR = '->' # noqa
NULLSAFE_OPERATOR = '?->' # noqa
DOUBLE_COLON = '::' # noqa
NS_SEPARATOR = '\\' # noqa
ELLIPSIS = '...' # noqa
ATTRIBUTE = '\x23[' # noqa
INT_CAST = '(int)' # noqa
FLOAT_CAST = '(float)' # noqa
STRING_CAST = '(string)' # noqa
ARRAY_CAST = '(array)' # noqa
OBJECT_CAST = '(object)' # noqa
BOOL_CAST = '(bool)' # noqa
UNSET_CAST = '(unset)' # noqa
LPAREN = '(' # noqa
RPAREN = ')' # noqa
LBRACE = '{' # noqa
RBRACE = '}' # noqa
LBRACKET = '[' # noqa
RBRACKET = ']' # noqa
SEMICOLON = ';' # noqa
COMMA = ',' # noqa
DOLLAR = '$' # noqa
COMMENT = 'comment' # noqa
DOC_COMMENT = 'doc-comment' # noqa
NEWLINE = 'newline' # noqa
ERROR = 'error' # noqa
EOF = 'eof' # noqa
@property
def is_keyword(self) -> bool:
return self in _KEYWORDS_SET
@property
def is_cast(self) -> bool:
return self in _CAST_SET
KEYWORDS: dict[str, PhpTokenKind] = {
tok.value.lower(): tok for tok in [
PhpTokenKind.INCLUDE,
PhpTokenKind.INCLUDE_ONCE,
PhpTokenKind.REQUIRE,
PhpTokenKind.REQUIRE_ONCE,
PhpTokenKind.EVAL,
PhpTokenKind.PRINT,
PhpTokenKind.ECHO,
PhpTokenKind.EXIT,
PhpTokenKind.LOGICAL_OR,
PhpTokenKind.LOGICAL_XOR,
PhpTokenKind.LOGICAL_AND,
PhpTokenKind.INSTANCEOF,
PhpTokenKind.NEW,
PhpTokenKind.CLONE,
PhpTokenKind.YIELD,
PhpTokenKind.IF,
PhpTokenKind.ELSEIF,
PhpTokenKind.ELSE,
PhpTokenKind.ENDIF,
PhpTokenKind.DO,
PhpTokenKind.WHILE,
PhpTokenKind.ENDWHILE,
PhpTokenKind.FOR,
PhpTokenKind.ENDFOR,
PhpTokenKind.FOREACH,
PhpTokenKind.ENDFOREACH,
PhpTokenKind.SWITCH,
PhpTokenKind.ENDSWITCH,
PhpTokenKind.CASE,
PhpTokenKind.DEFAULT,
PhpTokenKind.MATCH,
PhpTokenKind.BREAK,
PhpTokenKind.CONTINUE,
PhpTokenKind.GOTO,
PhpTokenKind.RETURN,
PhpTokenKind.THROW,
PhpTokenKind.TRY,
PhpTokenKind.CATCH,
PhpTokenKind.FINALLY,
PhpTokenKind.DECLARE,
PhpTokenKind.ENDDECLARE,
PhpTokenKind.AS,
PhpTokenKind.FUNCTION,
PhpTokenKind.FN,
PhpTokenKind.CONST,
PhpTokenKind.USE,
PhpTokenKind.INSTEADOF,
PhpTokenKind.GLOBAL,
PhpTokenKind.STATIC,
PhpTokenKind.ABSTRACT,
PhpTokenKind.FINAL,
PhpTokenKind.PRIVATE,
PhpTokenKind.PROTECTED,
PhpTokenKind.PUBLIC,
PhpTokenKind.READONLY,
PhpTokenKind.VAR,
PhpTokenKind.UNSET,
PhpTokenKind.ISSET,
PhpTokenKind.EMPTY,
PhpTokenKind.HALT_COMPILER,
PhpTokenKind.LIST,
PhpTokenKind.ARRAY,
PhpTokenKind.CALLABLE,
PhpTokenKind.CLASS,
PhpTokenKind.TRAIT,
PhpTokenKind.INTERFACE,
PhpTokenKind.ENUM,
PhpTokenKind.EXTENDS,
PhpTokenKind.IMPLEMENTS,
PhpTokenKind.NAMESPACE,
PhpTokenKind.LINE,
PhpTokenKind.FILE,
PhpTokenKind.DIR,
PhpTokenKind.CLASS_C,
PhpTokenKind.TRAIT_C,
PhpTokenKind.METHOD_C,
PhpTokenKind.FUNC_C,
PhpTokenKind.NS_C,
]
}
_KEYWORDS_SET = frozenset(KEYWORDS.values())
_CAST_SET = frozenset({
PhpTokenKind.INT_CAST,
PhpTokenKind.FLOAT_CAST,
PhpTokenKind.STRING_CAST,
PhpTokenKind.ARRAY_CAST,
PhpTokenKind.OBJECT_CAST,
PhpTokenKind.BOOL_CAST,
PhpTokenKind.UNSET_CAST,
})
MAGIC_CONSTANTS = frozenset({
PhpTokenKind.LINE,
PhpTokenKind.FILE,
PhpTokenKind.DIR,
PhpTokenKind.CLASS_C,
PhpTokenKind.TRAIT_C,
PhpTokenKind.METHOD_C,
PhpTokenKind.FUNC_C,
PhpTokenKind.NS_C,
})
CAST_KEYWORDS: dict[str, PhpTokenKind] = {
'int' : PhpTokenKind.INT_CAST,
'integer' : PhpTokenKind.INT_CAST,
'float' : PhpTokenKind.FLOAT_CAST,
'double' : PhpTokenKind.FLOAT_CAST,
'real' : PhpTokenKind.FLOAT_CAST,
'string' : PhpTokenKind.STRING_CAST,
'array' : PhpTokenKind.ARRAY_CAST,
'object' : PhpTokenKind.OBJECT_CAST,
'bool' : PhpTokenKind.BOOL_CAST,
'boolean' : PhpTokenKind.BOOL_CAST,
'unset' : PhpTokenKind.UNSET_CAST,
}
@dataclass
class PhpToken:
kind: PhpTokenKind
value: str
offset: int
def __repr__(self):
v = self.value
if len(v) > 15:
v = F'{v[:8]}..{v[-4:]}'
return F'Token({self.kind.name}, {v!r}, {self.offset})'
Classes
class PhpTokenKind (*args, **kwds)-
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3Access them by:
- attribute access:
Color.RED
- value lookup:
Color(1)
- name lookup:
Color['RED']
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
Expand source code Browse git
class PhpTokenKind(enum.Enum): INLINE_HTML = 'inline-html' # noqa OPEN_TAG = 'open-tag' # noqa OPEN_TAG_ECHO = 'open-tag-echo' # noqa CLOSE_TAG = 'close-tag' # noqa INTEGER = 'integer' # noqa FLOAT = 'float' # noqa STRING_SINGLE = 'sq-string' # noqa STRING_DOUBLE = 'dq-string' # noqa SHELL_EXEC = 'backtick-string' # noqa HEREDOC = 'heredoc' # noqa NOWDOC = 'nowdoc' # noqa VARIABLE = 'variable' # noqa IDENTIFIER = 'identifier' # noqa INCLUDE = 'include' # noqa INCLUDE_ONCE = 'include_once' # noqa REQUIRE = 'require' # noqa REQUIRE_ONCE = 'require_once' # noqa EVAL = 'eval' # noqa PRINT = 'print' # noqa ECHO = 'echo' # noqa EXIT = 'exit' # noqa LOGICAL_OR = 'or' # noqa LOGICAL_XOR = 'xor' # noqa LOGICAL_AND = 'and' # noqa INSTANCEOF = 'instanceof' # noqa NEW = 'new' # noqa CLONE = 'clone' # noqa YIELD = 'yield' # noqa IF = 'if' # noqa ELSEIF = 'elseif' # noqa ELSE = 'else' # noqa ENDIF = 'endif' # noqa DO = 'do' # noqa WHILE = 'while' # noqa ENDWHILE = 'endwhile' # noqa FOR = 'for' # noqa ENDFOR = 'endfor' # noqa FOREACH = 'foreach' # noqa ENDFOREACH = 'endforeach' # noqa SWITCH = 'switch' # noqa ENDSWITCH = 'endswitch' # noqa CASE = 'case' # noqa DEFAULT = 'default' # noqa MATCH = 'match' # noqa BREAK = 'break' # noqa CONTINUE = 'continue' # noqa GOTO = 'goto' # noqa RETURN = 'return' # noqa THROW = 'throw' # noqa TRY = 'try' # noqa CATCH = 'catch' # noqa FINALLY = 'finally' # noqa DECLARE = 'declare' # noqa ENDDECLARE = 'enddeclare' # noqa AS = 'as' # noqa FUNCTION = 'function' # noqa FN = 'fn' # noqa CONST = 'const' # noqa USE = 'use' # noqa INSTEADOF = 'insteadof' # noqa GLOBAL = 'global' # noqa STATIC = 'static' # noqa ABSTRACT = 'abstract' # noqa FINAL = 'final' # noqa PRIVATE = 'private' # noqa PROTECTED = 'protected' # noqa PUBLIC = 'public' # noqa READONLY = 'readonly' # noqa VAR = 'var' # noqa UNSET = 'unset' # noqa ISSET = 'isset' # noqa EMPTY = 'empty' # noqa HALT_COMPILER = '__halt_compiler' # noqa LIST = 'list' # noqa ARRAY = 'array' # noqa CALLABLE = 'callable' # noqa CLASS = 'class' # noqa TRAIT = 'trait' # noqa INTERFACE = 'interface' # noqa ENUM = 'enum' # noqa EXTENDS = 'extends' # noqa IMPLEMENTS = 'implements' # noqa NAMESPACE = 'namespace' # noqa LINE = '__LINE__' # noqa FILE = '__FILE__' # noqa DIR = '__DIR__' # noqa CLASS_C = '__CLASS__' # noqa TRAIT_C = '__TRAIT__' # noqa METHOD_C = '__METHOD__' # noqa FUNC_C = '__FUNCTION__' # noqa NS_C = '__NAMESPACE__' # noqa PLUS = '+' # noqa MINUS = '-' # noqa STAR = '*' # noqa SLASH = '/' # noqa PERCENT = '%' # noqa POW = '**' # noqa DOT = '.' # noqa EQUALS = '=' # noqa PLUS_EQUAL = '+=' # noqa MINUS_EQUAL = '-=' # noqa MUL_EQUAL = '*=' # noqa DIV_EQUAL = '/=' # noqa MOD_EQUAL = '%=' # noqa POW_EQUAL = '**=' # noqa CONCAT_EQUAL = '.=' # noqa AND_EQUAL = '&=' # noqa OR_EQUAL = '|=' # noqa XOR_EQUAL = '^=' # noqa SL_EQUAL = '<<=' # noqa SR_EQUAL = '>>=' # noqa COALESCE_EQUAL = '??=' # noqa BOOLEAN_OR = '||' # noqa BOOLEAN_AND = '&&' # noqa IS_EQUAL = '==' # noqa IS_NOT_EQUAL = '!=' # noqa IS_IDENTICAL = '===' # noqa IS_NOT_IDENTICAL = '!==' # noqa LT = '<' # noqa GT = '>' # noqa IS_SMALLER_OR_EQUAL = '<=' # noqa IS_GREATER_OR_EQUAL = '>=' # noqa SPACESHIP = '<=>' # noqa SL = '<<' # noqa SR = '>>' # noqa COALESCE = '??' # noqa AMP = '&' # noqa PIPE = '|' # noqa CARET = '^' # noqa TILDE = '~' # noqa BANG = '!' # noqa INC = '++' # noqa DEC = '--' # noqa AT = '@' # noqa QUESTION = '?' # noqa COLON = ':' # noqa DOUBLE_ARROW = '=>' # noqa OBJECT_OPERATOR = '->' # noqa NULLSAFE_OPERATOR = '?->' # noqa DOUBLE_COLON = '::' # noqa NS_SEPARATOR = '\\' # noqa ELLIPSIS = '...' # noqa ATTRIBUTE = '\x23[' # noqa INT_CAST = '(int)' # noqa FLOAT_CAST = '(float)' # noqa STRING_CAST = '(string)' # noqa ARRAY_CAST = '(array)' # noqa OBJECT_CAST = '(object)' # noqa BOOL_CAST = '(bool)' # noqa UNSET_CAST = '(unset)' # noqa LPAREN = '(' # noqa RPAREN = ')' # noqa LBRACE = '{' # noqa RBRACE = '}' # noqa LBRACKET = '[' # noqa RBRACKET = ']' # noqa SEMICOLON = ';' # noqa COMMA = ',' # noqa DOLLAR = '$' # noqa COMMENT = 'comment' # noqa DOC_COMMENT = 'doc-comment' # noqa NEWLINE = 'newline' # noqa ERROR = 'error' # noqa EOF = 'eof' # noqa @property def is_keyword(self) -> bool: return self in _KEYWORDS_SET @property def is_cast(self) -> bool: return self in _CAST_SETAncestors
- enum.Enum
Class variables
var INLINE_HTML-
The type of the None singleton.
var OPEN_TAG-
The type of the None singleton.
var OPEN_TAG_ECHO-
The type of the None singleton.
var CLOSE_TAG-
The type of the None singleton.
var INTEGER-
The type of the None singleton.
var FLOAT-
The type of the None singleton.
var STRING_SINGLE-
The type of the None singleton.
var STRING_DOUBLE-
The type of the None singleton.
var SHELL_EXEC-
The type of the None singleton.
var HEREDOC-
The type of the None singleton.
var NOWDOC-
The type of the None singleton.
var VARIABLE-
The type of the None singleton.
var IDENTIFIER-
The type of the None singleton.
var INCLUDE-
The type of the None singleton.
var INCLUDE_ONCE-
The type of the None singleton.
var REQUIRE-
The type of the None singleton.
var REQUIRE_ONCE-
The type of the None singleton.
var EVAL-
The type of the None singleton.
var PRINT-
The type of the None singleton.
var ECHO-
The type of the None singleton.
var EXIT-
The type of the None singleton.
var LOGICAL_OR-
The type of the None singleton.
var LOGICAL_XOR-
The type of the None singleton.
var LOGICAL_AND-
The type of the None singleton.
var INSTANCEOF-
The type of the None singleton.
var NEW-
The type of the None singleton.
var CLONE-
The type of the None singleton.
var YIELD-
The type of the None singleton.
var IF-
The type of the None singleton.
var ELSEIF-
The type of the None singleton.
var ELSE-
The type of the None singleton.
var ENDIF-
The type of the None singleton.
var DO-
The type of the None singleton.
var WHILE-
The type of the None singleton.
var ENDWHILE-
The type of the None singleton.
var FOR-
The type of the None singleton.
var ENDFOR-
The type of the None singleton.
var FOREACH-
The type of the None singleton.
var ENDFOREACH-
The type of the None singleton.
var SWITCH-
The type of the None singleton.
var ENDSWITCH-
The type of the None singleton.
var CASE-
The type of the None singleton.
var DEFAULT-
The type of the None singleton.
var MATCH-
The type of the None singleton.
var BREAK-
The type of the None singleton.
var CONTINUE-
The type of the None singleton.
var GOTO-
The type of the None singleton.
var RETURN-
The type of the None singleton.
var THROW-
The type of the None singleton.
var TRY-
The type of the None singleton.
var CATCH-
The type of the None singleton.
var FINALLY-
The type of the None singleton.
var DECLARE-
The type of the None singleton.
var ENDDECLARE-
The type of the None singleton.
var AS-
The type of the None singleton.
var FUNCTION-
The type of the None singleton.
var FN-
The type of the None singleton.
var CONST-
The type of the None singleton.
var USE-
The type of the None singleton.
var INSTEADOF-
The type of the None singleton.
var GLOBAL-
The type of the None singleton.
var STATIC-
The type of the None singleton.
var ABSTRACT-
The type of the None singleton.
var FINAL-
The type of the None singleton.
var PRIVATE-
The type of the None singleton.
var PROTECTED-
The type of the None singleton.
var PUBLIC-
The type of the None singleton.
var READONLY-
The type of the None singleton.
var VAR-
The type of the None singleton.
var UNSET-
The type of the None singleton.
var ISSET-
The type of the None singleton.
var EMPTY-
The type of the None singleton.
var HALT_COMPILER-
The type of the None singleton.
var LIST-
The type of the None singleton.
var ARRAY-
The type of the None singleton.
var CALLABLE-
The type of the None singleton.
var CLASS-
The type of the None singleton.
var TRAIT-
The type of the None singleton.
var INTERFACE-
The type of the None singleton.
var ENUM-
The type of the None singleton.
var EXTENDS-
The type of the None singleton.
var IMPLEMENTS-
The type of the None singleton.
var NAMESPACE-
The type of the None singleton.
var LINE-
The type of the None singleton.
var FILE-
The type of the None singleton.
var DIR-
The type of the None singleton.
var CLASS_C-
The type of the None singleton.
var TRAIT_C-
The type of the None singleton.
var METHOD_C-
The type of the None singleton.
var FUNC_C-
The type of the None singleton.
var NS_C-
The type of the None singleton.
var PLUS-
The type of the None singleton.
var MINUS-
The type of the None singleton.
var STAR-
The type of the None singleton.
var SLASH-
The type of the None singleton.
var PERCENT-
The type of the None singleton.
var POW-
The type of the None singleton.
var DOT-
The type of the None singleton.
var EQUALS-
The type of the None singleton.
var PLUS_EQUAL-
The type of the None singleton.
var MINUS_EQUAL-
The type of the None singleton.
var MUL_EQUAL-
The type of the None singleton.
var DIV_EQUAL-
The type of the None singleton.
var MOD_EQUAL-
The type of the None singleton.
var POW_EQUAL-
The type of the None singleton.
var CONCAT_EQUAL-
The type of the None singleton.
var AND_EQUAL-
The type of the None singleton.
var OR_EQUAL-
The type of the None singleton.
var XOR_EQUAL-
The type of the None singleton.
var SL_EQUAL-
The type of the None singleton.
var SR_EQUAL-
The type of the None singleton.
var COALESCE_EQUAL-
The type of the None singleton.
var BOOLEAN_OR-
The type of the None singleton.
var BOOLEAN_AND-
The type of the None singleton.
var IS_EQUAL-
The type of the None singleton.
var IS_NOT_EQUAL-
The type of the None singleton.
var IS_IDENTICAL-
The type of the None singleton.
var IS_NOT_IDENTICAL-
The type of the None singleton.
var LT-
The type of the None singleton.
var GT-
The type of the None singleton.
var IS_SMALLER_OR_EQUAL-
The type of the None singleton.
var IS_GREATER_OR_EQUAL-
The type of the None singleton.
var SPACESHIP-
The type of the None singleton.
var SL-
The type of the None singleton.
var SR-
The type of the None singleton.
var COALESCE-
The type of the None singleton.
var AMP-
The type of the None singleton.
var PIPE-
The type of the None singleton.
var CARET-
The type of the None singleton.
var TILDE-
The type of the None singleton.
var BANG-
The type of the None singleton.
var INC-
The type of the None singleton.
var DEC-
The type of the None singleton.
var AT-
The type of the None singleton.
var QUESTION-
The type of the None singleton.
var COLON-
The type of the None singleton.
var DOUBLE_ARROW-
The type of the None singleton.
var OBJECT_OPERATOR-
The type of the None singleton.
var NULLSAFE_OPERATOR-
The type of the None singleton.
var DOUBLE_COLON-
The type of the None singleton.
var NS_SEPARATOR-
The type of the None singleton.
var ELLIPSIS-
The type of the None singleton.
var ATTRIBUTE-
The type of the None singleton.
var INT_CAST-
The type of the None singleton.
var FLOAT_CAST-
The type of the None singleton.
var STRING_CAST-
The type of the None singleton.
var ARRAY_CAST-
The type of the None singleton.
var OBJECT_CAST-
The type of the None singleton.
var BOOL_CAST-
The type of the None singleton.
var UNSET_CAST-
The type of the None singleton.
var LPAREN-
The type of the None singleton.
var RPAREN-
The type of the None singleton.
var LBRACE-
The type of the None singleton.
var RBRACE-
The type of the None singleton.
var LBRACKET-
The type of the None singleton.
var RBRACKET-
The type of the None singleton.
var SEMICOLON-
The type of the None singleton.
var COMMA-
The type of the None singleton.
var DOLLAR-
The type of the None singleton.
var COMMENT-
The type of the None singleton.
var DOC_COMMENT-
The type of the None singleton.
var NEWLINE-
The type of the None singleton.
var ERROR-
The type of the None singleton.
var EOF-
The type of the None singleton.
Instance variables
var is_keyword-
Expand source code Browse git
@property def is_keyword(self) -> bool: return self in _KEYWORDS_SET var is_cast-
Expand source code Browse git
@property def is_cast(self) -> bool: return self in _CAST_SET
class PhpToken (kind, value, offset)-
PhpToken(kind: 'PhpTokenKind', value: 'str', offset: 'int')
Expand source code Browse git
@dataclass class PhpToken: kind: PhpTokenKind value: str offset: int def __repr__(self): v = self.value if len(v) > 15: v = F'{v[:8]}..{v[-4:]}' return F'Token({self.kind.name}, {v!r}, {self.offset})'Instance variables
var kind-
The type of the None singleton.
var value-
The type of the None singleton.
var offset-
The type of the None singleton.