MXVM 1.8.1
Virtual Machine, Compiler, and Pascal Frontend
Loading...
Searching...
No Matches
pascal::NumberNode Class Reference

AST node for an integer or real numeric literal. More...

#include <ast.hpp>

Inheritance diagram for pascal::NumberNode:

Public Member Functions

 NumberNode (const std::string &val, bool integer=true, bool real=false)
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::string value
 textual representation of the number
bool isInteger
 true if integer literal
bool isReal
 true if real (floating-point) literal

Detailed Description

AST node for an integer or real numeric literal.

Definition at line 524 of file ast.hpp.

Constructor & Destructor Documentation

◆ NumberNode()

pascal::NumberNode::NumberNode ( const std::string & val,
bool integer = true,
bool real = false )
inline

Definition at line 530 of file ast.hpp.

References isInteger, isReal, and value.

Member Function Documentation

◆ accept()

void pascal::NumberNode::accept ( ASTVisitor & visitor)
overridevirtual

Accept an ASTVisitor (double-dispatch).

Implements pascal::ASTNode.

Definition at line 247 of file ast.cpp.

References pascal::ASTVisitor::visit().

◆ toString()

std::string pascal::NumberNode::toString ( ) const
overridevirtual

Return a human-readable description of this node.

Implements pascal::ASTNode.

Definition at line 251 of file ast.cpp.

References isInteger, and value.

Member Data Documentation

◆ isInteger

bool pascal::NumberNode::isInteger

true if integer literal

Definition at line 527 of file ast.hpp.

Referenced by NumberNode(), and toString().

◆ isReal

bool pascal::NumberNode::isReal

true if real (floating-point) literal

Definition at line 528 of file ast.hpp.

Referenced by NumberNode(), pascal::CodeGenVisitor::getExpressionType(), and pascal::CodeGenVisitor::visit().

◆ value

std::string pascal::NumberNode::value

textual representation of the number

Definition at line 526 of file ast.hpp.

Referenced by NumberNode(), toString(), and pascal::CodeGenVisitor::visit().


The documentation for this class was generated from the following files: