|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.millscript.millscript.expr.Expr<CommaAction>
org.millscript.millscript.expr.CommaExpr
public final class CommaExpr
This class implements a comma expression. A comma expression simply has a left and right hand side expression, which are executed in that order. The comma sits between the left and right hand side expressions.
CommaAction| Constructor Summary | |
|---|---|
CommaExpr(Expr<?> l,
Expr<?> r)
Creates a new comma expression with the specifed left and right hand side expressions. |
|
| Method Summary | |
|---|---|
int |
arity()
Returns the arity of this expression. |
CommaAction |
compileIt()
Compiles this expression into an action. |
Expr |
getLeft()
Returns the left hand side expression, that which preceeds the comma. |
Expr |
getRight()
Returns the right hand side expression, that which follows the comma. |
static Expr<?> |
make(Expr l,
Expr r)
Returns an expression for the specified left and right hand side expressions. |
void |
resolve(CompilerState state)
Resolves any NameExpr in the tree so that they refer to the
correct ident. |
| Methods inherited from class org.millscript.millscript.expr.Expr |
|---|
compile, isIntegerExpr, resolveList, setLineNumber, setOrigin, show, show |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CommaExpr(Expr<?> l,
Expr<?> r)
l - the left hand side expressionr - the right hand side expression| Method Detail |
|---|
public static Expr<?> make(Expr l,
Expr r)
SkipExpr, the right hand side
expression is returned, and vice versa. Otherwise, if neither the left or
right hand side expressions are SkipExprs, a new comma expression
is returned.
l - the left hand side expressionr - the right hand side expression
CommaExpr if the left or right hand side are not
SkipExpr, otherwise the right or left hand side
expressionpublic int arity()
For a comma expression, the arity is the sum of each expressions arity. e.g. if either arity is unknown, the comma expressions arity is unknown, otherwise the comma expression arity is the sum of the left and right hand side arity.
arity in class Expr<CommaAction>0 if the expression returns zero results,
1 if the expression returns one result or
-1 if the expression returns an unknown number of
results.Expr.addArity(int, int)public CommaAction compileIt()
Expr
compileIt in class Expr<CommaAction>Action for this expressionExpr.compileIt()public Expr getLeft()
public Expr getRight()
public void resolve(CompilerState state)
ExprNameExpr in the tree so that they refer to the
correct ident. e.g. This method is responsible for ensuring that
references to a function argument in the body of a function actually
refer to the correct value.
resolve in class Expr<CommaAction>state - the compiler state we are resolving inExpr.resolve(org.millscript.millscript.vm.CompilerState)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||