Robot Framework
robot.parsing.parser.parser Namespace Reference

Classes

class  SetLanguages
 

Functions

def _get_model (token_getter, source, data_only=False, curdir=None, lang=None)
 
def _statements_to_model (statements, source=None)
 
def _tokens_to_statements (tokens, curdir=None)
 
def get_init_model (source, data_only=False, curdir=None, lang=None)
 Parses the given source to a init file model. More...
 
def get_model (source, data_only=False, curdir=None, lang=None)
 Parses the given source to a model represented as an AST. More...
 
def get_resource_model (source, data_only=False, curdir=None, lang=None)
 Parses the given source to a resource file model. More...
 

Function Documentation

◆ _get_model()

def robot.parsing.parser.parser._get_model (   token_getter,
  source,
  data_only = False,
  curdir = None,
  lang = None 
)
private

Definition at line 72 of file parser.py.

◆ _statements_to_model()

def robot.parsing.parser.parser._statements_to_model (   statements,
  source = None 
)
private

Definition at line 93 of file parser.py.

◆ _tokens_to_statements()

def robot.parsing.parser.parser._tokens_to_statements (   tokens,
  curdir = None 
)
private

Definition at line 80 of file parser.py.

◆ get_init_model()

def robot.parsing.parser.parser.get_init_model (   source,
  data_only = False,
  curdir = None,
  lang = None 
)

Parses the given source to a init file model.

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

Definition at line 68 of file parser.py.

◆ get_model()

def robot.parsing.parser.parser.get_model (   source,
  data_only = False,
  curdir = None,
  lang = None 
)

Parses the given source to a model represented as an AST.

How to use the model is explained more thoroughly in the general
documentation of the :mod:`robot.parsing` module.

: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. Model like this cannot be saved back to
    file system.
:param curdir: Directory where the source file exists. This path is used
    to set the value of the built-in ``${CURDIR}`` variable during parsing.
    When not given, the variable is left as-is. Should only be given
    only if the model will be executed afterwards. If the model is saved
    back to disk, resolving ``${CURDIR}`` is typically not a good idea.
: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.

Use :func:`get_resource_model` or :func:`get_init_model` when parsing
resource or suite initialization files, respectively.

Definition at line 49 of file parser.py.

◆ get_resource_model()

def robot.parsing.parser.parser.get_resource_model (   source,
  data_only = False,
  curdir = None,
  lang = None 
)

Parses the given source to a resource file model.

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

Definition at line 58 of file parser.py.