Token representing piece of Robot Framework data. More...
Public Member Functions | |
| def | __eq__ (self, other) |
| def | __init__ (self, type=None, value=None, lineno=-1, col_offset=-1, error=None) |
| def | __repr__ (self) |
| def | __str__ (self) |
| def | set_error (self, error, fatal=False) |
| def | tokenize_variables (self) |
| Tokenizes possible variables in token value. More... | |
Public Attributes | |
| col_offset | |
| error | |
| lineno | |
| type | |
| value | |
Static Public Attributes | |
| ALLOW_VARIABLES | |
| string | ARGUMENT = 'ARGUMENT' |
| string | ARGUMENTS = 'ARGUMENTS' |
| string | AS = 'AS' |
| string | ASSIGN = 'ASSIGN' |
| string | BREAK = 'BREAK' |
| string | COMMENT = 'COMMENT' |
| string | COMMENT_HEADER = 'COMMENT HEADER' |
| string | CONFIG = 'CONFIG' |
| string | CONTINUATION = 'CONTINUATION' |
| string | CONTINUE = 'CONTINUE' |
| string | DEFAULT_TAGS = 'DEFAULT TAGS' |
| string | DOCUMENTATION = 'DOCUMENTATION' |
| string | ELSE = 'ELSE' |
| string | ELSE_IF = 'ELSE IF' |
| string | END = 'END' |
| string | EOL = 'EOL' |
| string | EOS = 'EOS' |
| string | ERROR = 'ERROR' |
| string | EXCEPT = 'EXCEPT' |
| string | FATAL_ERROR = 'FATAL ERROR' |
| string | FINALLY = 'FINALLY' |
| string | FOR = 'FOR' |
| string | FOR_SEPARATOR = 'FOR SEPARATOR' |
| string | FORCE_TAGS = 'FORCE TAGS' |
| HEADER_TOKENS | |
| string | IF = 'IF' |
| string | INLINE_IF = 'INLINE IF' |
| string | KEYWORD = 'KEYWORD' |
| string | KEYWORD_HEADER = 'KEYWORD HEADER' |
| string | KEYWORD_NAME = 'KEYWORD NAME' |
| string | KEYWORD_TAGS = 'KEYWORD TAGS' |
| string | LIBRARY = 'LIBRARY' |
| string | METADATA = 'METADATA' |
| string | NAME = 'NAME' |
| NON_DATA_TOKENS | |
| string | OPTION = 'OPTION' |
| string | RESOURCE = 'RESOURCE' |
| string | RETURN = 'RETURN' |
| string | RETURN_SETTING = RETURN |
| string | RETURN_STATEMENT = 'RETURN STATEMENT' |
| string | SEPARATOR = 'SEPARATOR' |
| string | SETTING_HEADER = 'SETTING HEADER' |
| SETTING_TOKENS | |
| string | SETUP = 'SETUP' |
| string | SUITE_SETUP = 'SUITE SETUP' |
| string | SUITE_TEARDOWN = 'SUITE TEARDOWN' |
| string | TAGS = 'TAGS' |
| string | TASK_HEADER = 'TASK HEADER' |
| string | TEARDOWN = 'TEARDOWN' |
| string | TEMPLATE = 'TEMPLATE' |
| string | TEST_SETUP = 'TEST SETUP' |
| string | TEST_TEARDOWN = 'TEST TEARDOWN' |
| string | TEST_TEMPLATE = 'TEST TEMPLATE' |
| string | TEST_TIMEOUT = 'TEST TIMEOUT' |
| string | TESTCASE_HEADER = 'TESTCASE HEADER' |
| string | TESTCASE_NAME = 'TESTCASE NAME' |
| string | TIMEOUT = 'TIMEOUT' |
| string | TRY = 'TRY' |
| string | VARIABLE = 'VARIABLE' |
| string | VARIABLE_HEADER = 'VARIABLE HEADER' |
| string | VARIABLES = 'VARIABLES' |
| string | WHILE = 'WHILE' |
| string | WITH_NAME = 'WITH NAME' |
Properties | |
| end_col_offset = property | |
Private Member Functions | |
| def | _tokenize_no_variables (self) |
| def | _tokenize_variables (self, variables) |
| def | end_col_offset (self) |
Private Attributes | |
| _add_eos_after | |
| _add_eos_before | |
Static Private Attributes | |
| list | __slots__ |
Token representing piece of Robot Framework data.
Each token has type, value, line number, column offset and end column
offset in :attr:`type`, :attr:`value`, :attr:`lineno`, :attr:`col_offset`
and :attr:`end_col_offset` attributes, respectively. Tokens representing
error also have their error message in :attr:`error` attribute.
Token types are declared as class attributes such as :attr:`SETTING_HEADER`
and :attr:`EOL`. Values of these constants have changed slightly in Robot
Framework 4.0 and they may change again in the future. It is thus safer
to use the constants, not their values, when types are needed. For example,
use ``Token(Token.EOL)`` instead of ``Token('EOL')`` and
``token.type == Token.EOL`` instead of ``token.type == 'EOL'``.
If :attr:`value` is not given when :class:`Token` is initialized and
:attr:`type` is :attr:`IF`, :attr:`ELSE_IF`, :attr:`ELSE`, :attr:`FOR`,
:attr:`END`, :attr:`WITH_NAME` or :attr:`CONTINUATION`, the value is
automatically set to the correct marker value like ``'IF'`` or ``'ELSE IF'``.
If :attr:`type` is :attr:`EOL` in this case, the value is set to ``'\\n'``.
| def robot.parsing.lexer.tokens.Token.__init__ | ( | self, | |
type = None, |
|||
value = None, |
|||
lineno = -1, |
|||
col_offset = -1, |
|||
error = None |
|||
| ) |
| def robot.parsing.lexer.tokens.Token.__eq__ | ( | self, | |
| other | |||
| ) |
|
private |
|
private |
|
private |
| def robot.parsing.lexer.tokens.Token.set_error | ( | self, | |
| error, | |||
fatal = False |
|||
| ) |
| def robot.parsing.lexer.tokens.Token.tokenize_variables | ( | self | ) |
Tokenizes possible variables in token value.
Yields the token itself if the token does not allow variables (see
:attr:`Token.ALLOW_VARIABLES`) or its value does not contain
variables. Otherwise yields variable tokens as well as tokens
before, after, or between variables so that they have the same
type as the original token.
|
staticprivate |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |