robot.parsing.parser package

Submodules

robot.parsing.parser.blockparsers module

classrobot.parsing.parser.blockparsers.Parser(model:Container)[source]

Bases:ABC

model:Container
abstractmethodhandles(statement:Statement)bool[source]
abstractmethodparse(statement:Statement)Parser|None[source]
classrobot.parsing.parser.blockparsers.BlockParser(model:Block)[source]

Bases:Parser,ABC

model:Block
unhandled_tokens={'COMMENTHEADER','INVALIDHEADER','KEYWORDHEADER','KEYWORDNAME','SETTINGHEADER','TASKHEADER','TESTCASEHEADER','TESTCASENAME','VARIABLEHEADER'}
handles(statement:Statement)bool[source]
parse(statement:Statement)BlockParser|None[source]
classrobot.parsing.parser.blockparsers.TestCaseParser(model:Block)[source]

Bases:BlockParser

model:TestCase
classrobot.parsing.parser.blockparsers.KeywordParser(model:Block)[source]

Bases:BlockParser

model:Keyword
classrobot.parsing.parser.blockparsers.NestedBlockParser(model:NestedBlock,handle_end:bool=True)[source]

Bases:BlockParser,ABC

model:NestedBlock
handles(statement:Statement)bool[source]
parse(statement:Statement)BlockParser|None[source]
classrobot.parsing.parser.blockparsers.ForParser(model:NestedBlock,handle_end:bool=True)[source]

Bases:NestedBlockParser

model:For
classrobot.parsing.parser.blockparsers.WhileParser(model:NestedBlock,handle_end:bool=True)[source]

Bases:NestedBlockParser

model:While
classrobot.parsing.parser.blockparsers.GroupParser(model:NestedBlock,handle_end:bool=True)[source]

Bases:NestedBlockParser

model:Group
classrobot.parsing.parser.blockparsers.IfParser(model:NestedBlock,handle_end:bool=True)[source]

Bases:NestedBlockParser

model:If
parse(statement:Statement)BlockParser|None[source]
classrobot.parsing.parser.blockparsers.TryParser(model:NestedBlock,handle_end:bool=True)[source]

Bases:NestedBlockParser

model:Try
parse(statement)BlockParser|None[source]

robot.parsing.parser.fileparser module

classrobot.parsing.parser.fileparser.FileParser(source:Path|str|TextIO|None=None)[source]

Bases:Parser

model:File
handles(statement:Statement)bool[source]
parse(statement:Statement)SectionParser[source]
classrobot.parsing.parser.fileparser.SectionParser(model:Container)[source]

Bases:Parser

model:Section
handles(statement:Statement)bool[source]
parse(statement:Statement)Parser|None[source]
classrobot.parsing.parser.fileparser.SettingSectionParser(model:Container)[source]

Bases:SectionParser

model:SettingSection
classrobot.parsing.parser.fileparser.VariableSectionParser(model:Container)[source]

Bases:SectionParser

model:VariableSection
classrobot.parsing.parser.fileparser.CommentSectionParser(model:Container)[source]

Bases:SectionParser

model:CommentSection
classrobot.parsing.parser.fileparser.ImplicitCommentSectionParser(model:Container)[source]

Bases:SectionParser

model:ImplicitCommentSection
classrobot.parsing.parser.fileparser.InvalidSectionParser(model:Container)[source]

Bases:SectionParser

model:InvalidSection
classrobot.parsing.parser.fileparser.TestCaseSectionParser(model:Container)[source]

Bases:SectionParser

model:TestCaseSection
parse(statement:Statement)Parser|None[source]
classrobot.parsing.parser.fileparser.KeywordSectionParser(model:Container)[source]

Bases:SectionParser

model:KeywordSection
parse(statement:Statement)Parser|None[source]

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 generaldocumentation of therobot.parsing module.

Parameters:
  • source – The source where to read the data. Can be a path toa source file as a string or aspathlib.Path object, an alreadyopened file object, or Unicode text containing the date directly.Source files must be UTF-8 encoded.

  • data_only – WhenFalse (default), returns all tokens. When settoTrue, omits separators, comments, continuation markers, andother non-data tokens. Model like this cannot be saved back tofile system.

  • curdir – Directory where the source file exists. This path is usedto set the value of the built-in${CURDIR} variable during parsing.When not given, the variable is left as-is. Should only be givenonly if the model will be executed afterward. If the model is savedback 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 initializedLanguage subclass,a list containing such strings or instances, or aLanguages instance.

Useget_resource_model() orget_init_model() when parsingresource 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 asget_model() otherwise, but the source is considered to bea 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 asget_model() otherwise, but the source is considered to bea suite initialization file. This affects, for example, what settings arevalid.

classrobot.parsing.parser.parser.ConfigParser(model:File)[source]

Bases:ModelVisitor

classmethodparse(model:File)[source]
visit_Config(node:Config)[source]