robot.parsing.parser package
Submodules
robot.parsing.parser.blockparsers module
- class robot.parsing.parser.blockparsers.BlockParser(model: Block)[source]
Bases:
Parser,ABC- unhandled_tokens = frozenset({'COMMENT HEADER', 'INVALID HEADER', 'KEYWORD HEADER', 'KEYWORD NAME', 'SETTING HEADER', 'TASK HEADER', 'TESTCASE HEADER', 'TESTCASE NAME', 'VARIABLE HEADER'})
- parse(statement: Statement) BlockParser | None[source]
- class robot.parsing.parser.blockparsers.TestCaseParser(model: Block)[source]
Bases:
BlockParser
- class robot.parsing.parser.blockparsers.KeywordParser(model: Block)[source]
Bases:
BlockParser
- class robot.parsing.parser.blockparsers.NestedBlockParser(model: NestedBlock, handle_end: bool = True)[source]
Bases:
BlockParser,ABC- model: NestedBlock
- parse(statement: Statement) BlockParser | None[source]
- class robot.parsing.parser.blockparsers.ForParser(model: NestedBlock, handle_end: bool = True)[source]
Bases:
NestedBlockParser
- class robot.parsing.parser.blockparsers.WhileParser(model: NestedBlock, handle_end: bool = True)[source]
Bases:
NestedBlockParser
- class robot.parsing.parser.blockparsers.IfParser(model: NestedBlock, handle_end: bool = True)[source]
Bases:
NestedBlockParser- parse(statement: Statement) BlockParser | None[source]
- class robot.parsing.parser.blockparsers.TryParser(model: NestedBlock, handle_end: bool = True)[source]
Bases:
NestedBlockParser- parse(statement) BlockParser | None[source]
robot.parsing.parser.fileparser module
- class robot.parsing.parser.fileparser.FileParser(source: Path | str | TextIO | None = None)[source]
Bases:
Parser- parse(statement: Statement) SectionParser[source]
- class robot.parsing.parser.fileparser.SettingSectionParser(model: Container)[source]
Bases:
SectionParser- model: SettingSection
- class robot.parsing.parser.fileparser.VariableSectionParser(model: Container)[source]
Bases:
SectionParser- model: VariableSection
- class robot.parsing.parser.fileparser.CommentSectionParser(model: Container)[source]
Bases:
SectionParser- model: CommentSection
- class robot.parsing.parser.fileparser.ImplicitCommentSectionParser(model: Container)[source]
Bases:
SectionParser- model: ImplicitCommentSection
- class robot.parsing.parser.fileparser.InvalidSectionParser(model: Container)[source]
Bases:
SectionParser- model: InvalidSection
- class robot.parsing.parser.fileparser.TestCaseSectionParser(model: Container)[source]
Bases:
SectionParser- model: TestCaseSection
- class robot.parsing.parser.fileparser.KeywordSectionParser(model: Container)[source]
Bases:
SectionParser- model: KeywordSection
robot.parsing.parser.parser module
- robot.parsing.parser.parser.get_model(source: Path | str | TextIO, data_only: bool = False, curdir: str | None = None, lang: Languages | Language | str | Path | Iterable[Language | str | Path] | None = None) File[source]
Parses the given source into a model represented as an AST.
How to use the model is explained more thoroughly in the general documentation of the
robot.parsingmodule.- Parameters:
source – The source where to read the data. Can be a path to a source file as a string or as
pathlib.Pathobject, 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 toTrue, 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 afterward. If the model is saved back to disk, resolving${CURDIR}is typically not a good idea.lang – Additional languages to be supported during parsing. Can be a string matching any of the supported language codes or names, an initialized
Languagesubclass, a list containing such strings or instances, or aLanguagesinstance.
Use
get_resource_model()orget_init_model()when parsing resource or suite initialization files, respectively.
- robot.parsing.parser.parser.get_resource_model(source: Path | str | TextIO, data_only: bool = False, curdir: str | None = None, lang: Languages | Language | str | Path | Iterable[Language | str | Path] | None = None) File[source]
Parses the given source into a resource file model.
Same as
get_model()otherwise, 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: Path | str | TextIO, data_only: bool = False, curdir: str | None = None, lang: Languages | Language | str | Path | Iterable[Language | str | Path] | None = None) File[source]
Parses the given source into an init file model.
Same as
get_model()otherwise, but the source is considered to be a suite initialization file. This affects, for example, what settings are valid.