|
sdr 0.6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.cscott.sdr.calls.ast.AstNode
public abstract class AstNode
AstNode is the abstract base class for abstract syntax
tree nodes representing parsed call definitions and components.
| Field Summary | |
|---|---|
int |
type
|
| Constructor Summary | |
|---|---|
protected |
AstNode(int type)
|
protected |
AstNode(int type,
String name)
|
| Method Summary | ||
|---|---|---|
abstract
|
accept(TransformVisitor<T> v,
T t)
Visitor pattern implementation for transformations. |
|
abstract
|
accept(ValueVisitor<RESULT,CLOSURE> v,
CLOSURE cl)
Visitor pattern implementation for computations. |
|
protected String |
argsToString()
|
|
String |
toString()
Output AST tree in lisp-like notation. |
|
static AstNode |
valueOf(String s)
Parse AST tree from string; inverse of toString(). |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public final int type
| Constructor Detail |
|---|
protected AstNode(int type)
protected AstNode(int type,
String name)
| Method Detail |
|---|
public abstract <T> AstNode accept(TransformVisitor<T> v,
T t)
AstNode accepts a TransformVisitor and a
value, and returns an instance of its own type (ie,
Seq.accept(tv, "A") returns a Seq).
The 't' parameter is a closure.
js> s = AstNode.valueOf("(Seq (Prim -1, 1, none, 1 1/2) (Prim 1, 1, none, 1 1/2))") (Seq (Prim -1, 1, none, 1 1/2) (Prim 1, 1, none, 1 1/2)) js> s.accept(new net.cscott.sdr.calls.transform.TransformVisitor({}), "A") (Seq (Prim -1, 1, none, 1 1/2) (Prim 1, 1, none, 1 1/2))
public abstract <RESULT,CLOSURE> RESULT accept(ValueVisitor<RESULT,CLOSURE> v,
CLOSURE cl)
AstNode accepts a ValueVisitor and a closure,
and returns an object of the appropriate result type.
public String toString()
toString in class Objectprotected String argsToString()
public static AstNode valueOf(String s)
throws IllegalArgumentException
toString().
IllegalArgumentException - if the given string value doesn't parsefor examples and doc tests.
|
sdr 0.6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||