Package jflex
Class RegExp
java.lang.Object
jflex.RegExp
Stores a regular expression of rules section in a JFlex-specification.
This base class has no content other than its type.
- Version:
- JFlex 1.7.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionanyChar()Returns a regexp that matches any character:[^]booleanisCharClass(Macros macros) Find out if this regexp is a char class or equivalent to one.Returns a String-representation of this regular expression with the specified indentation.final RegExpresolveTilde(Macros macros) Recursively convert tilde (upto) expressions into negation and star.final RegExpCreate a new regexp that matches the reverse text of this one.static final StringrevString.intThe approximate number of NFA states this expression will need (only works correctly after macro expansion and without negation)toString()Returns a String-representation of this regular expression
-
Field Details
-
type
int typeThe type of the regular expression. This field will be filled with values from class sym.java (generated by cup)
-
-
Constructor Details
-
RegExp
public RegExp(int type) Create a new regular expression of the specified type.- Parameters:
type- a value from the cup generated class sym.- See Also:
-
-
Method Details
-
print
Returns a String-representation of this regular expression with the specified indentation.- Parameters:
tab- a String that should contain only space characters and that is inserted in front of standard String-representation pf this object.- Returns:
- a
Stringobject.
-
toString
Returns a String-representation of this regular expression -
isCharClass
Find out if this regexp is a char class or equivalent to one.- Parameters:
macros- for macro expansion- Returns:
- true if the regexp is equivalent to a char class.
-
size
The approximate number of NFA states this expression will need (only works correctly after macro expansion and without negation)- Parameters:
macros- macro table for expansion- Returns:
- a int.
-
revString
revString. -
resolveTilde
Recursively convert tilde (upto) expressions into negation and star.- Parameters:
macros- the macro table for expansion.- Returns:
- new RegExp equivalent to the current one, but without upto expressions.
-
anyChar
Returns a regexp that matches any character:[^]- Returns:
- the regexp for
[^]
-
rev
Create a new regexp that matches the reverse text of this one.- Parameters:
macros- aMacrosobject.- Returns:
- the reverse regexp
-