mpilot.parser.parser
¶
The MPilot parser is responsible for lexing and parsing the command file source according to the
MPilot Spec. It returns the command file structure expressed as a
CommandNode
. The parser validates syntax and grammar, but does not validate for things like proper command
names, and names and types. Validation of the latter is handled by mpilot.program.Program
.
- class mpilot.parser.parser.Parser¶
- parse(source: str) ProgramNode ¶
Parses the source text into a program structure
- class mpilot.parser.parser.ProgramNode(commands, version)¶
- commands: List[CommandNode]¶
A list of command nodes, parsed from the source text.
- version: int¶
The determined EEMS version of this command file. Will be either
2
or3
. EEMS v1 files are not supported.
- class mpilot.parser.parser.CommandNode(result_name, command, arguments, lineno)¶
- result_name: str¶
The name assigned to the command result. E.g.,
<result_name> = <command>(<arguments>)
- command: str¶
The name of the command. This is used to resolve the correct command class to use by
Program
.
- arguments: List[ArgumentNode]¶
A list of parsed arguments passed to this command.
- lineno: int¶
The line number where this command begins.
- class mpilot.parser.parser.ArgumentNode(name, value, lineno)¶
- name: str¶
The name of the parameter.
- value: ExpressionNode¶
The parameter value
- lineno: int¶
The line number where this command begins.