|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.quasiliteral.text.Substituter
Safe: The default -- and simplest -- of the quasi parsers
Field Summary | |
private int |
myMatchSize
|
private Object[] |
myTemplate
A template is "compiled" into an array of three kinds of elements: |
Constructor Summary | |
(package private) |
Substituter(Twine template)
|
Method Summary | |
private static boolean |
isDigit(char c)
|
ConstList |
matchBind(ConstList args,
Object specimen)
Enabled: As a quasi-pattern, "first" replace all ${i}s with args[i]s, then see if the speciman matches the pattern. |
boolean |
matchBind(ConstList args,
Object specimen,
FlexList bindings)
Enabled: |
int |
numArgs()
Enabled: The number of arguments that must be provided to substitute() or matchBind() |
int |
numPatterns()
Enabled: The number of bindings that will be returned by matchBind() |
private Twine |
optSegments(int[] iPtr,
ConstList args)
If the iPtr[0]'th segment is a pattern, then return null and leave iPtr alone. |
private ConstList |
optSequence(int[] iPtr,
ConstList args)
If the iPtr[0]'th segment is a pattern, then return null and leave iPtr alone. |
Object |
substitute(ConstList args)
Enabled: Evaluate as a quasi-literal by replacing ${i} with args[i], for all i |
String |
toString()
Suppressed: Prints using the template string |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private Object[] myTemplate
A Twine represents a literal string segment.
A positive Integer represents a position into which to substitute an arg.
A negative Integer represents a pattern position (XXX needs a real explanation).
XXX this representation is a kludge
private int myMatchSize
Constructor Detail |
Substituter(Twine template)
Method Detail |
private static boolean isDigit(char c)
public ConstList matchBind(ConstList args, Object specimen)
matchBind
in interface MatchMaker
public boolean matchBind(ConstList args, Object specimen, FlexList bindings)
matchBind
in interface MatchMaker
private ConstList optSequence(int[] iPtr, ConstList args)
private Twine optSegments(int[] iPtr, ConstList args)
public Object substitute(ConstList args)
substitute
in interface ValueMaker
public int numArgs()
public int numPatterns()
public String toString()
toString
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |