Robot Framework
robot.parsing.lexer.lexer Namespace Reference

Classes

class  Lexer
 

Functions

def get_init_tokens (source, data_only=False, tokenize_variables=False, lang=None)
 Parses the given source to init file tokens. More...
 
def get_resource_tokens (source, data_only=False, tokenize_variables=False, lang=None)
 Parses the given source to resource file tokens. More...
 
def get_tokens (source, data_only=False, tokenize_variables=False, lang=None)
 Parses the given source to tokens. More...
 

Function Documentation

◆ get_init_tokens()

def robot.parsing.lexer.lexer.get_init_tokens (   source,
  data_only = False,
  tokenize_variables = False,
  lang = None 
)

Parses the given source to init file tokens.

Same as :func:`get_tokens` otherwise, but the source is considered to be
a suite initialization file. This affects, for example, what settings are
valid.

Definition at line 72 of file lexer.py.

◆ get_resource_tokens()

def robot.parsing.lexer.lexer.get_resource_tokens (   source,
  data_only = False,
  tokenize_variables = False,
  lang = None 
)

Parses the given source to resource file tokens.

Same as :func:`get_tokens` otherwise, but the source is considered to be
a resource file. This affects, for example, what settings are valid.

Definition at line 60 of file lexer.py.

◆ get_tokens()

def robot.parsing.lexer.lexer.get_tokens (   source,
  data_only = False,
  tokenize_variables = False,
  lang = None 
)

Parses the given source to tokens.

:param source: The source where to read the data. Can be a path to
    a source file as a string or as ``pathlib.Path`` object, an already
    opened file object, or Unicode text containing the date directly.
    Source files must be UTF-8 encoded.
:param data_only: When ``False`` (default), returns all tokens. When set
    to ``True``, omits separators, comments, continuation markers, and
    other non-data tokens.
:param tokenize_variables: When ``True``, possible variables in keyword
    arguments and elsewhere are tokenized. See the
    :meth:`~robot.parsing.lexer.tokens.Token.tokenize_variables`
    method for details.
:param lang: Additional languages to be supported during parsing.
    Can be a string matching any of the supported language codes or names,
    an initialized :class:`~robot.conf.languages.Language` subsclass,
    a list containing such strings or instances, or a
    :class:`~robot.conf.languages.Languages` instance.

Returns a generator that yields :class:`~robot.parsing.lexer.tokens.Token`
instances.

Definition at line 49 of file lexer.py.