|
MXVM 1.8.1
Virtual Machine, Compiler, and Pascal Frontend
|
AST node for a case statement. More...
#include <ast.hpp>

Classes | |
| struct | CaseBranch |
| A single case branch (one or more values mapping to a statement). More... | |
Public Member Functions | |
| CaseStmtNode (std::unique_ptr< ASTNode > expr, std::vector< std::unique_ptr< CaseBranch > > branches, std::unique_ptr< ASTNode > elseStmt=nullptr) | |
| void | accept (ASTVisitor &visitor) override |
| Accept an ASTVisitor (double-dispatch). | |
| std::string | toString () const override |
| Return a human-readable description of this node. | |
| Public Member Functions inherited from pascal::ASTNode | |
| virtual | ~ASTNode ()=default |
| virtual void | print (std::ostream &out, int indent=0) const |
| Pretty-print this node to a stream with indentation. | |
| void | setLineNumber (int line) |
| Set the originating source line number. | |
| int | getLineNumber () const |
| Get the originating source line number. | |
Public Attributes | |
| std::unique_ptr< ASTNode > | expression |
| selector expression | |
| std::vector< std::unique_ptr< CaseBranch > > | branches |
| case branches | |
| std::unique_ptr< ASTNode > | elseStatement |
| optional else/otherwise branch | |
|
inline |
Definition at line 415 of file ast.hpp.
References branches, elseStatement, and expression.
|
overridevirtual |
Accept an ASTVisitor (double-dispatch).
Implements pascal::ASTNode.
Definition at line 293 of file ast.cpp.
References pascal::ASTVisitor::visit().
|
overridevirtual |
Return a human-readable description of this node.
Implements pascal::ASTNode.
Definition at line 297 of file ast.cpp.
References branches.
| std::vector<std::unique_ptr<CaseBranch> > pascal::CaseStmtNode::branches |
case branches
Definition at line 412 of file ast.hpp.
Referenced by CaseStmtNode(), toString(), and pascal::CodeGenVisitor::visit().
| std::unique_ptr<ASTNode> pascal::CaseStmtNode::elseStatement |
optional else/otherwise branch
Definition at line 413 of file ast.hpp.
Referenced by CaseStmtNode(), and pascal::CodeGenVisitor::visit().
| std::unique_ptr<ASTNode> pascal::CaseStmtNode::expression |
selector expression
Definition at line 411 of file ast.hpp.
Referenced by CaseStmtNode(), and pascal::CodeGenVisitor::visit().