sjm.parse
Class Empty
java.lang.Object
|
+--sjm.parse.Parser
|
+--sjm.parse.Empty
- public class Empty
- extends Parser
An Empty parser matches any assembly once,
and applies its assembler that one time.
Language elements often contain empty parts. For example,
a language may at some point allow a list of parameters
in parentheses, and may allow an empty list. An empty
parser makes it easy to match, within the
parenthesis, either a list of parameters or "empty".
|
Constructor Summary |
Empty()
|
|
Method Summary |
void |
accept(ParserVisitor pv,
java.util.Vector visited)
Accept a "visitor" and a collection of previously visited
parsers. |
java.util.Vector |
match(java.util.Vector in)
Given a set of assemblies, this method returns the set as
a successful match. |
protected java.util.Vector |
randomExpansion(int maxDepth,
int depth)
|
protected java.lang.String |
unvisitedString(java.util.Vector visited)
|
| Methods inherited from class sjm.parse.Parser |
accept,
add,
best,
bestMatch,
completeMatch,
elementClone,
getName,
matchAndAssemble,
randomInput,
setAssembler,
toString,
toString |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Empty
public Empty()
accept
public void accept(ParserVisitor pv,
java.util.Vector visited)
- Accept a "visitor" and a collection of previously visited
parsers.
- Overrides:
- accept in class Parser
- Parameters:
ParserVisitor - the visitor to acceptVector - a collection of previously visited parsers
match
public java.util.Vector match(java.util.Vector in)
- Given a set of assemblies, this method returns the set as
a successful match.
- Overrides:
- match in class Parser
- Parameters:
Vector - a vector of assemblies to match against- Returns:
- the input set of states
randomExpansion
protected java.util.Vector randomExpansion(int maxDepth,
int depth)
- Overrides:
- randomExpansion in class Parser
unvisitedString
protected java.lang.String unvisitedString(java.util.Vector visited)
- Overrides:
- unvisitedString in class Parser