|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The RegularExpression
interface is a base interface
for all specific RegularExpression
constructs. Each
regex needs to know how to build its first and last sets, and what
to do inside its follow() method. For more information about what
these methods really mean, refer to Chapter 3 in the Dragon Book.
This interface extends Cloneable
, but the semantics of
cloning go beyond what one might expect. For example, if we have
the regex '(a|b|c)+', this needs to be deconstructed into it's more
fundamental form '(a|b|c)-(a|b|c)*' where '-' means
Concatenation
. However, we cannot simply copy the
Union
object as its members (a, b, c) would have the
same id and thus indistinguishable. Therefore, the clone()
operation will end up making *new* members (a', b', c') and thus
id(a) != id(a').
Method Summary | |
Object |
clone()
See the general explanation of clone() given above. |
void |
follow()
Triggers the process of computing the follow sets. |
IntSet |
getFirstSet()
Returns the IntSet of Intervals which
are visible at the logical beginning of the the expression. |
IntSet |
getLastSet()
Returns the IntSet of Intervals which
are visible at the logical end of the the expression. |
boolean |
isNullable()
Returns true if this
RegularExpression either *is* Epsilon
or derives it. |
Method Detail |
public boolean isNullable()
true
if this
RegularExpression
either *is* Epsilon
or derives it.public IntSet getFirstSet()
IntSet
of Intervals
which
are visible at the logical beginning of the the expression.public IntSet getLastSet()
IntSet
of Intervals
which
are visible at the logical end of the the expression.public void follow()
public Object clone() throws CloneNotSupportedException
clone()
given above.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |