Identifier expression.
More...
#include <syntax.hpp>
|
|
| IdExpr (GCMain &gc, const TokenPos &pos, const std::string &id) |
| |
|
const std::string & | getName () const noexcept |
| |
| virtual std::string | toString () const noexcept override |
| |
| virtual Expr * | eval (GCMain &gc, Environment &env) noexcept override |
| | Evaluates expression one time. More...
|
| |
| virtual Expr * | replace (GCMain &gc, const std::string &name, Expr *expr) const noexcept override |
| | Replace all identifiers equal to name with expr. More...
|
| |
| virtual bool | equals (const Expr *expr, bool exact=false) const noexcept override |
| | Checks if this expression and expr have the same structure, Every expression has the same structure as '_' (it's called ANY after all). More...
|
| |
| virtual std::vector< std::string > | getIdentifiers () const noexcept override |
| |
|
| Expr (GCMain &gc, ExprType type, const TokenPos &pos) |
| |
|
std::size_t | getDepth () const noexcept |
| |
| bool | hasLastEval () const noexcept |
| |
| const TokenPos & | getTokenPos () const noexcept |
| |
| ExprType | getExpressionType () const noexcept |
| |
| Expr * | evalWithLookup (GCMain &gc, Environment &env) noexcept |
| |
|
virtual void | mark (GCMain &gc) noexcept override |
| | If not marked mark itself and children.
|
| |
| virtual Expr * | optimize (GCMain &gc) noexcept |
| |
|
| GCObj (GCMain &main) noexcept |
| | Initialize as not marked.
|
| |
| virtual bool | isMarked (GCMain &main) const noexcept |
| |
|
|
virtual void | markSelf (GCMain &main) |
| | Marks itself.
|
| |
|
std::size_t | depth |
| |
|
Expr * | lastEval = nullptr |
| |
◆ equals()
| virtual bool IdExpr::equals |
( |
const Expr * |
expr, |
|
|
bool |
exact = false |
|
) |
| const |
|
overridevirtualnoexcept |
Checks if this expression and expr have the same structure, Every expression has the same structure as '_' (it's called ANY after all).
- Parameters
-
| expr | The expression to compare to this. |
| exact | If true any must equal any and nothing else. Otherwise any is equal to anyting else. |
Reimplemented from Expr.
◆ eval()
Evaluates expression one time.
- Parameters
-
- Returns
- Returns itself if nothing evaluated, otherwise a new expression.
Reimplemented from Expr.
◆ getIdentifiers()
| virtual std::vector<std::string> IdExpr::getIdentifiers |
( |
| ) |
const |
|
inlineoverridevirtualnoexcept |
- Returns
- Returns all identifiers used in expression.
Reimplemented from Expr.
◆ replace()
| virtual Expr* IdExpr::replace |
( |
GCMain & |
gc, |
|
|
const std::string & |
name, |
|
|
Expr * |
expr |
|
) |
| const |
|
overridevirtualnoexcept |
Replace all identifiers equal to name with expr.
- Parameters
-
| gc | |
| name | Identifer name to replace. If name is empty, every identifier will be replaced by AnyExpr(expr_any). |
| expr | The expression to replaces identifiers. |
- Returns
- Returns new expression, where matching identifiers are replaced. Returns itself if not possible (expression can't contain any identifiers) or if expression is a lambda function, where the <id> is equal to name.
Reimplemented from Expr.
◆ toString()
| virtual std::string IdExpr::toString |
( |
| ) |
const |
|
inlineoverridevirtualnoexcept |
- Returns
- Returns expression in functional-lang (the programming language to parse).
Reimplemented from Expr.
The documentation for this class was generated from the following file: