|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.quasiliteral.term.Term
Untamed:
Field Summary | |
private ConstList |
myArgs
A term is a functor (the above three instance variables) as parameterized by a list of argument Terms. |
private int |
myHeight
Just used to decide how to pretty print. |
private Object |
myOptData
|
private SourceSpan |
myOptSpan
|
private AstroTag |
myTag
|
private static StaticMaker |
OptTermMaker
Initialized lazily to avoid a circularity. |
(package private) static long |
serialVersionUID
|
Fields inherited from interface org.erights.e.elib.serial.Persistent |
HONORARY, HONORED_NAMES |
Fields inherited from interface org.erights.e.elib.serial.DeepPassByCopy |
HONORARY, HONORED_NAMES |
Constructor Summary | |
(package private) |
Term(AstroTag tag,
Object optData,
SourceSpan optSpan,
ConstList args)
Makes a Term that represents a node in an abstract syntax tree, ie, a Term tree. |
Method Summary | |
void |
__printOn(TextWriter out)
Enabled: |
String |
asText()
Enabled: |
Astro |
build(AstroBuilder builder)
Enabled: |
double |
compareTo(Term other)
Enabled: Lexicographic comparison of, in order: the tags the data the args |
ConstList |
getArgs()
Enabled: A term is a functor (the above three instance variables) as parameterized by a list of argument Terms. |
int |
getHeight()
Enabled: What's the longest distance to the bottom? |
Object |
getOptArgData()
Enabled: |
Object |
getOptArgData(short tagCode)
Enabled: |
String |
getOptArgString(short tagCode)
Enabled: |
Object |
getOptData()
Enabled: Either literal data or null. |
SourceSpan |
getOptSpan()
Enabled: What source text was originally lexed or parsed to produce this token? |
String |
getOptString()
Enabled: |
short |
getOptTagCode()
Enabled: |
Object[] |
getSpreadUncall()
Enabled: Uses 'TermMaker(myTag, myOptData, myOptSpan, myArgs)' |
AstroTag |
getTag()
Enabled: Represents the token-type of the functor of this term. |
void |
prettyPrintOn(TextWriter out,
boolean quasiFlag,
boolean bagFlag)
Enabled: |
String |
toString()
Suppressed: |
Astro |
withArgs(ConstList args)
Enabled: |
Astro |
withoutArgs()
Enabled: |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
static final long serialVersionUID
private static StaticMaker OptTermMaker
private final AstroTag myTag
private final Object myOptData
private final SourceSpan myOptSpan
private final ConstList myArgs
private transient int myHeight
Initialized lazily. 0 if uninitialized, so does not need to be recalculated on revival.
Constructor Detail |
Term(AstroTag tag, Object optData, SourceSpan optSpan, ConstList args)
The invariants of a Term are not checked here, but rather are enforced by the callers in this class and in TermBuilder.
tag
- Identifies a token type in a particular grammar or set
of related grammars, used as the functor (or "label") of
this TermoptData
- Either Character
,
BigInteger
, Double
,
or Twine
or null. If not null, then the tag
must represent the canonical literal type for this
kind of data in this schema.optSpan
- Where was the source text this token was extracted from?args
- This Term's argument list -- a list of TermsMethod Detail |
public Object[] getSpreadUncall()
getSpreadUncall
in interface Selfless
public Astro build(AstroBuilder builder)
build
in interface Astro
public AstroTag getTag()
getTag
in interface Astro
public short getOptTagCode()
getOptTagCode
in interface Astro
public Object getOptData()
getOptData
in interface Astro
public String getOptString()
getOptString
in interface Astro
public Object getOptArgData()
getOptArgData
in interface Astro
public Object getOptArgData(short tagCode)
getOptArgData
in interface Astro
public String getOptArgString(short tagCode)
getOptArgString
in interface Astro
public SourceSpan getOptSpan()
getOptSpan
in interface AstroArg
public ConstList getArgs()
getArgs
in interface Astro
public Astro withoutArgs()
withoutArgs
in interface Astro
public Astro withArgs(ConstList args)
withArgs
in interface Astro
public double compareTo(Term other)
public int getHeight()
A leaf node is height 1. All other nodes are one more than the height of their highest child. This is used for pretty printing.
public void __printOn(TextWriter out) throws IOException
IOException
public String toString()
toString
in class Object
public String asText()
public void prettyPrintOn(TextWriter out, boolean quasiFlag, boolean bagFlag) throws IOException
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |