robot.parsing.model package

Submodules

robot.parsing.model.blocks module

class robot.parsing.model.blocks.Block[source]

Bases: _ast.AST

lineno
col_offset
end_lineno
end_col_offset
class robot.parsing.model.blocks.File(sections=None, source=None)[source]

Bases: robot.parsing.model.blocks.Block

save(output=None)[source]

Save model to the given output or to the original source file.

The output can be a path to a file or an already opened file object. If output is not given, the original source file will be overwritten.

col_offset
end_col_offset
end_lineno
lineno
class robot.parsing.model.blocks.Section(header=None, body=None)[source]

Bases: robot.parsing.model.blocks.Block

col_offset
end_col_offset
end_lineno
lineno
class robot.parsing.model.blocks.SettingSection(header=None, body=None)[source]

Bases: robot.parsing.model.blocks.Section

col_offset
end_col_offset
end_lineno
lineno
class robot.parsing.model.blocks.VariableSection(header=None, body=None)[source]

Bases: robot.parsing.model.blocks.Section

col_offset
end_col_offset
end_lineno
lineno
class robot.parsing.model.blocks.TestCaseSection(header=None, body=None)[source]

Bases: robot.parsing.model.blocks.Section

tasks
col_offset
end_col_offset
end_lineno
lineno
class robot.parsing.model.blocks.KeywordSection(header=None, body=None)[source]

Bases: robot.parsing.model.blocks.Section

col_offset
end_col_offset
end_lineno
lineno
class robot.parsing.model.blocks.CommentSection(header=None, body=None)[source]

Bases: robot.parsing.model.blocks.Section

col_offset
end_col_offset
end_lineno
lineno
class robot.parsing.model.blocks.TestCase(header, body=None)[source]

Bases: robot.parsing.model.blocks.Block

name
col_offset
end_col_offset
end_lineno
lineno
class robot.parsing.model.blocks.Keyword(header, body=None)[source]

Bases: robot.parsing.model.blocks.Block

name
col_offset
end_col_offset
end_lineno
lineno
class robot.parsing.model.blocks.ForLoop(header, body=None, end=None)[source]

Bases: robot.parsing.model.blocks.Block

variables
values
flavor
col_offset
end_col_offset
end_lineno
lineno
class robot.parsing.model.blocks.ModelWriter(output)[source]

Bases: robot.parsing.model.visitor.ModelVisitor

write(model)[source]
visit_Statement(statement)[source]
generic_visit(node)

Called if no explicit visitor function exists for a node.

visit(node)

Visit a node.

class robot.parsing.model.blocks.FirstStatementFinder[source]

Bases: robot.parsing.model.visitor.ModelVisitor

classmethod find_from(model)[source]
visit_Statement(statement)[source]
generic_visit(node)[source]

Called if no explicit visitor function exists for a node.

visit(node)

Visit a node.

class robot.parsing.model.blocks.LastStatementFinder[source]

Bases: robot.parsing.model.visitor.ModelVisitor

classmethod find_from(model)[source]
generic_visit(node)

Called if no explicit visitor function exists for a node.

visit(node)

Visit a node.

visit_Statement(statement)[source]

robot.parsing.model.statements module

class robot.parsing.model.statements.Statement(tokens)[source]

Bases: _ast.AST

type = None
lineno
col_offset
end_lineno
end_col_offset
classmethod register(subcls)[source]
classmethod from_tokens(tokens)[source]
data_tokens
get_token(type)[source]

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)[source]

Return tokens having any of the given types.

get_value(type, default=None)[source]

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)[source]

Return values of tokens having any of the given types.

lines
error
class robot.parsing.model.statements.DocumentationOrMetadata(tokens)[source]

Bases: robot.parsing.model.statements.Statement

col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
type = None
class robot.parsing.model.statements.SingleValue(tokens)[source]

Bases: robot.parsing.model.statements.Statement

value
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
type = None
class robot.parsing.model.statements.MultiValue(tokens)[source]

Bases: robot.parsing.model.statements.Statement

values
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
type = None
class robot.parsing.model.statements.Fixture(tokens)[source]

Bases: robot.parsing.model.statements.Statement

name
args
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
type = None
class robot.parsing.model.statements.SectionHeader(tokens)[source]

Bases: robot.parsing.model.statements.Statement

name
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
type = None
class robot.parsing.model.statements.SettingSectionHeader(tokens)[source]

Bases: robot.parsing.model.statements.SectionHeader

type = 'SETTING_HEADER'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
name
classmethod register(subcls)
class robot.parsing.model.statements.VariableSectionHeader(tokens)[source]

Bases: robot.parsing.model.statements.SectionHeader

type = 'VARIABLE_HEADER'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
name
classmethod register(subcls)
class robot.parsing.model.statements.TestCaseSectionHeader(tokens)[source]

Bases: robot.parsing.model.statements.SectionHeader

type = 'TESTCASE_HEADER'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
name
classmethod register(subcls)
class robot.parsing.model.statements.KeywordSectionHeader(tokens)[source]

Bases: robot.parsing.model.statements.SectionHeader

type = 'KEYWORD_HEADER'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
name
classmethod register(subcls)
class robot.parsing.model.statements.CommentSectionHeader(tokens)[source]

Bases: robot.parsing.model.statements.SectionHeader

type = 'COMMENT_HEADER'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
name
classmethod register(subcls)
class robot.parsing.model.statements.LibraryImport(tokens)[source]

Bases: robot.parsing.model.statements.Statement

type = 'LIBRARY'
name
args
alias
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.ResourceImport(tokens)[source]

Bases: robot.parsing.model.statements.Statement

type = 'RESOURCE'
name
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.VariablesImport(tokens)[source]

Bases: robot.parsing.model.statements.Statement

type = 'VARIABLES'
name
args
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.Documentation(tokens)[source]

Bases: robot.parsing.model.statements.DocumentationOrMetadata

type = 'DOCUMENTATION'
value
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.Metadata(tokens)[source]

Bases: robot.parsing.model.statements.DocumentationOrMetadata

type = 'METADATA'
name
value
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.ForceTags(tokens)[source]

Bases: robot.parsing.model.statements.MultiValue

type = 'FORCE_TAGS'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
values
class robot.parsing.model.statements.DefaultTags(tokens)[source]

Bases: robot.parsing.model.statements.MultiValue

type = 'DEFAULT_TAGS'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
values
class robot.parsing.model.statements.SuiteSetup(tokens)[source]

Bases: robot.parsing.model.statements.Fixture

type = 'SUITE_SETUP'
args
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
name
classmethod register(subcls)
class robot.parsing.model.statements.SuiteTeardown(tokens)[source]

Bases: robot.parsing.model.statements.Fixture

type = 'SUITE_TEARDOWN'
args
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
name
classmethod register(subcls)
class robot.parsing.model.statements.TestSetup(tokens)[source]

Bases: robot.parsing.model.statements.Fixture

type = 'TEST_SETUP'
args
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
name
classmethod register(subcls)
class robot.parsing.model.statements.TestTeardown(tokens)[source]

Bases: robot.parsing.model.statements.Fixture

type = 'TEST_TEARDOWN'
args
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
name
classmethod register(subcls)
class robot.parsing.model.statements.TestTemplate(tokens)[source]

Bases: robot.parsing.model.statements.SingleValue

type = 'TEST_TEMPLATE'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
value
class robot.parsing.model.statements.TestTimeout(tokens)[source]

Bases: robot.parsing.model.statements.SingleValue

type = 'TEST_TIMEOUT'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
value
class robot.parsing.model.statements.Variable(tokens)[source]

Bases: robot.parsing.model.statements.Statement

type = 'VARIABLE'
name
value
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.TestCaseName(tokens)[source]

Bases: robot.parsing.model.statements.Statement

type = 'TESTCASE_NAME'
name
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.KeywordName(tokens)[source]

Bases: robot.parsing.model.statements.Statement

type = 'KEYWORD_NAME'
name
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.Setup(tokens)[source]

Bases: robot.parsing.model.statements.Fixture

type = 'SETUP'
args
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
name
classmethod register(subcls)
class robot.parsing.model.statements.Teardown(tokens)[source]

Bases: robot.parsing.model.statements.Fixture

type = 'TEARDOWN'
args
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
name
classmethod register(subcls)
class robot.parsing.model.statements.Tags(tokens)[source]

Bases: robot.parsing.model.statements.MultiValue

type = 'TAGS'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
values
class robot.parsing.model.statements.Template(tokens)[source]

Bases: robot.parsing.model.statements.SingleValue

type = 'TEMPLATE'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
value
class robot.parsing.model.statements.Timeout(tokens)[source]

Bases: robot.parsing.model.statements.SingleValue

type = 'TIMEOUT'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
value
class robot.parsing.model.statements.Arguments(tokens)[source]

Bases: robot.parsing.model.statements.MultiValue

type = 'ARGUMENTS'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
values
class robot.parsing.model.statements.Return(tokens)[source]

Bases: robot.parsing.model.statements.MultiValue

type = 'RETURN'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
values
class robot.parsing.model.statements.KeywordCall(tokens)[source]

Bases: robot.parsing.model.statements.Statement

type = 'KEYWORD'
keyword
args
assign
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.TemplateArguments(tokens)[source]

Bases: robot.parsing.model.statements.Statement

type = 'ARGUMENT'
args
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.ForLoopHeader(tokens)[source]

Bases: robot.parsing.model.statements.Statement

type = 'FOR'
variables
values
flavor
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.End(tokens)[source]

Bases: robot.parsing.model.statements.Statement

type = 'END'
value
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.Comment(tokens)[source]

Bases: robot.parsing.model.statements.Statement

type = 'COMMENT'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.Error(tokens)[source]

Bases: robot.parsing.model.statements.Statement

type = 'ERROR'
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.EmptyLine(tokens)[source]

Bases: robot.parsing.model.statements.Statement

type = 'EOL'
classmethod from_value(value)[source]
col_offset
data_tokens
end_col_offset
end_lineno
error
classmethod from_tokens(tokens)
get_token(type)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)

robot.parsing.model.visitor module

class robot.parsing.model.visitor.VisitorFinder[source]

Bases: object

class robot.parsing.model.visitor.ModelVisitor[source]

Bases: ast.NodeVisitor, robot.parsing.model.visitor.VisitorFinder

NodeVisitor that supports matching nodes based on their base classes.

Otherwise identical to the standard ast.NodeVisitor, but allows creating visit_ClassName methods so that the ClassName is one of the base classes of the node. For example, this visitor method matches all section headers:

def visit_SectionHeader(self, node):
    # ...

If all visitor methods match node classes directly, it is better to use the standard ast.NodeVisitor instead.

visit(node)[source]

Visit a node.

generic_visit(node)

Called if no explicit visitor function exists for a node.

class robot.parsing.model.visitor.ModelTransformer[source]

Bases: ast.NodeTransformer, robot.parsing.model.visitor.VisitorFinder

NodeTransformer that supports matching nodes based on their base classes.

See ModelVisitor for explanation how this is different compared to the standard ast.NodeTransformer.

visit(node)[source]

Visit a node.

generic_visit(node)

Called if no explicit visitor function exists for a node.