robot.parsing.parser package

Submodules

robot.parsing.parser.blockparsers module

class robot.parsing.parser.blockparsers.Parser(model)[source]

Bases: object

Base class for parsers.

handles(statement)[source]
parse(statement)[source]
class robot.parsing.parser.blockparsers.BlockParser(model)[source]

Bases: robot.parsing.parser.blockparsers.Parser

unhandled_tokens = frozenset({'TESTCASE HEADER', 'KEYWORD HEADER', 'SETTING HEADER', 'TESTCASE NAME', 'COMMENT HEADER', 'VARIABLE HEADER', 'KEYWORD NAME'})
handles(statement)[source]
parse(statement)[source]
class robot.parsing.parser.blockparsers.TestCaseParser(header)[source]

Bases: robot.parsing.parser.blockparsers.BlockParser

handles(statement)
parse(statement)
unhandled_tokens = frozenset({'TESTCASE HEADER', 'KEYWORD HEADER', 'SETTING HEADER', 'TESTCASE NAME', 'COMMENT HEADER', 'VARIABLE HEADER', 'KEYWORD NAME'})
class robot.parsing.parser.blockparsers.KeywordParser(header)[source]

Bases: robot.parsing.parser.blockparsers.BlockParser

handles(statement)
parse(statement)
unhandled_tokens = frozenset({'TESTCASE HEADER', 'KEYWORD HEADER', 'SETTING HEADER', 'TESTCASE NAME', 'COMMENT HEADER', 'VARIABLE HEADER', 'KEYWORD NAME'})
class robot.parsing.parser.blockparsers.NestedBlockParser(model)[source]

Bases: robot.parsing.parser.blockparsers.BlockParser

handles(statement)[source]
parse(statement)[source]
unhandled_tokens = frozenset({'TESTCASE HEADER', 'KEYWORD HEADER', 'SETTING HEADER', 'TESTCASE NAME', 'COMMENT HEADER', 'VARIABLE HEADER', 'KEYWORD NAME'})
class robot.parsing.parser.blockparsers.ForParser(header)[source]

Bases: robot.parsing.parser.blockparsers.NestedBlockParser

handles(statement)
parse(statement)
unhandled_tokens = frozenset({'TESTCASE HEADER', 'KEYWORD HEADER', 'SETTING HEADER', 'TESTCASE NAME', 'COMMENT HEADER', 'VARIABLE HEADER', 'KEYWORD NAME'})
class robot.parsing.parser.blockparsers.IfParser(header, handle_end=True)[source]

Bases: robot.parsing.parser.blockparsers.NestedBlockParser

parse(statement)[source]
handles(statement)[source]
unhandled_tokens = frozenset({'TESTCASE HEADER', 'KEYWORD HEADER', 'SETTING HEADER', 'TESTCASE NAME', 'COMMENT HEADER', 'VARIABLE HEADER', 'KEYWORD NAME'})
class robot.parsing.parser.blockparsers.TryParser(header, handle_end=True)[source]

Bases: robot.parsing.parser.blockparsers.NestedBlockParser

parse(statement)[source]
handles(statement)[source]
unhandled_tokens = frozenset({'TESTCASE HEADER', 'KEYWORD HEADER', 'SETTING HEADER', 'TESTCASE NAME', 'COMMENT HEADER', 'VARIABLE HEADER', 'KEYWORD NAME'})
class robot.parsing.parser.blockparsers.WhileParser(header)[source]

Bases: robot.parsing.parser.blockparsers.NestedBlockParser

handles(statement)
parse(statement)
unhandled_tokens = frozenset({'TESTCASE HEADER', 'KEYWORD HEADER', 'SETTING HEADER', 'TESTCASE NAME', 'COMMENT HEADER', 'VARIABLE HEADER', 'KEYWORD NAME'})

robot.parsing.parser.fileparser module

class robot.parsing.parser.fileparser.FileParser(source=None)[source]

Bases: robot.parsing.parser.blockparsers.Parser

handles(statement)[source]
parse(statement)[source]
class robot.parsing.parser.fileparser.SectionParser(header)[source]

Bases: robot.parsing.parser.blockparsers.Parser

model_class = None
handles(statement)[source]
parse(statement)[source]
class robot.parsing.parser.fileparser.SettingSectionParser(header)[source]

Bases: robot.parsing.parser.fileparser.SectionParser

model_class

alias of robot.parsing.model.blocks.SettingSection

handles(statement)
parse(statement)
class robot.parsing.parser.fileparser.VariableSectionParser(header)[source]

Bases: robot.parsing.parser.fileparser.SectionParser

model_class

alias of robot.parsing.model.blocks.VariableSection

handles(statement)
parse(statement)
class robot.parsing.parser.fileparser.CommentSectionParser(header)[source]

Bases: robot.parsing.parser.fileparser.SectionParser

model_class

alias of robot.parsing.model.blocks.CommentSection

handles(statement)
parse(statement)
class robot.parsing.parser.fileparser.ImplicitCommentSectionParser(header)[source]

Bases: robot.parsing.parser.fileparser.SectionParser

model_class(statement)[source]
handles(statement)
parse(statement)
class robot.parsing.parser.fileparser.TestCaseSectionParser(header)[source]

Bases: robot.parsing.parser.fileparser.SectionParser

model_class

alias of robot.parsing.model.blocks.TestCaseSection

parse(statement)[source]
handles(statement)
class robot.parsing.parser.fileparser.KeywordSectionParser(header)[source]

Bases: robot.parsing.parser.fileparser.SectionParser

model_class

alias of robot.parsing.model.blocks.KeywordSection

parse(statement)[source]
handles(statement)

robot.parsing.parser.parser module

robot.parsing.parser.parser.get_model(source, data_only=False, curdir=None)[source]

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 robot.parsing module.

Parameters:
  • 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.
  • 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.
  • 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.

Use get_resource_model() or get_init_model() when parsing resource or suite initialization files, respectively.

robot.parsing.parser.parser.get_resource_model(source, data_only=False, curdir=None)[source]

Parses the given source to a resource file model.

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

robot.parsing.parser.parser.get_init_model(source, data_only=False, curdir=None)[source]

Parses the given source to a init file model.

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