|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.extex.ocpware.compiler.arith.ArithExpr
public abstract class ArithExpr
This is the abstract base class for arithmetic expressions. It provides some methods for parsing and pretty-printing.
The arithmetic expression has the following syntax:
〈arith expression〉
→ 〈n〉
| \〈n〉
| \$
| \($-〈n〉)
| 〈arith expression〉 + 〈arith expression〉
| 〈arith expression〉 - 〈arith expression〉
| 〈arith expression〉 * 〈arith expression〉
| 〈arith expression〉 div: 〈arith expression〉
| 〈arith expression〉 mod: 〈arith expression〉
| 〈id〉[〈arith expression〉]
| (〈arith expression〉)
| Constructor Summary | |
|---|---|
ArithExpr()
Creates a new object. |
|
| Method Summary | |
|---|---|
boolean |
needsParen()
Return the indicator that parentheses are needed when printed in a wider arithmetic context. |
static ArithExpr |
parse(ParserStream s)
Parse an arithmetic expression. |
static java.lang.String |
toString(ArithExpr x,
java.lang.String op,
ArithExpr y)
Create a string representation for an binary operation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ArithExpr()
| Method Detail |
|---|
public static ArithExpr parse(ParserStream s)
throws java.io.IOException,
SyntaxException
s - the input stream
java.io.IOException - in case of an I/O error
SyntaxException - in case of a syntax error
public static java.lang.String toString(ArithExpr x,
java.lang.String op,
ArithExpr y)
x - the first argumentop - the operatory - the second argument
public boolean needsParen()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||