MysoreScript
Public Member Functions | List of all members
AST::StringLiteral Struct Reference

A string literal. More...

#include <ast.hh>

Inheritance diagram for AST::StringLiteral:
Inheritance graph
[legend]
Collaboration diagram for AST::StringLiteral:
Collaboration graph
[legend]

Public Member Functions

bool construct (const pegmatite::InputRange &r, pegmatite::ASTStack &st, const ErrorReporter &er) override
 Construct the string from the source text. More...
 
bool isConstantExpression () override
 Literals are constant expressions. More...
 
Obj evaluateExpr (Interpreter::Context &c) override
 Evaluate the. More...
 
llvm::Value * compileExpression (Compiler::Context &c) override
 Compile the string. More...
 
void collectVarUses (std::unordered_set< std::string > &decls, std::unordered_set< std::string > &uses) override
 Literals do not define or use any values. More...
 
- Public Member Functions inherited from AST::Expression
Obj evaluate (Interpreter::Context &c)
 Evaluate the expression, caching the result if it's a constant expression. More...
 
void interpret (Interpreter::Context &c) override final
 Interpret this expression as if it were a statement. More...
 
void compile (Compiler::Context &c) override final
 Compile this expression as if it were a statement. More...
 

Additional Inherited Members

- Protected Attributes inherited from AST::Expression
Interpreter::Value cache
 Cached result for constant expression. More...
 

Detailed Description

A string literal.

MysoreScript strings are instances of the String class.

Definition at line 170 of file ast.hh.

Member Function Documentation

§ collectVarUses()

void AST::StringLiteral::collectVarUses ( std::unordered_set< std::string > &  decls,
std::unordered_set< std::string > &  uses 
)
inlineoverridevirtual

Literals do not define or use any values.

Implements AST::Statement.

Definition at line 202 of file ast.hh.

§ compileExpression()

Value * AST::StringLiteral::compileExpression ( Compiler::Context c)
overridevirtual

Compile the string.

Generates a string object and returns a constant pointer value that refers to it.

Implements AST::Expression.

Definition at line 583 of file compiler.cc.

Here is the call graph for this function:

§ construct()

bool AST::StringLiteral::construct ( const pegmatite::InputRange &  r,
pegmatite::ASTStack &  st,
const ErrorReporter &  er 
)
inlineoverride

Construct the string from the source text.

Definition at line 175 of file ast.hh.

§ evaluateExpr()

Obj StringLiteral::evaluateExpr ( Interpreter::Context c)
overridevirtual

Evaluate the.

Implements AST::Expression.

Definition at line 620 of file interpreter.cc.

Here is the call graph for this function:

§ isConstantExpression()

bool AST::StringLiteral::isConstantExpression ( )
inlineoverridevirtual

Literals are constant expressions.

Reimplemented from AST::Expression.

Definition at line 189 of file ast.hh.


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