org.apache.regexp
public class RECompiler extends Object
Version: $Id: RECompiler.java 518156 2007-03-14 14:31:26Z vgritsenko $
See Also: RE
Nested Class Summary | |
---|---|
class | RECompiler.RERange
Local, nested class for maintaining character ranges for character classes. |
Field Summary | |
---|---|
int | bracketMin |
int | bracketOpt |
static int | bracketUnbounded |
static int | ESC_BACKREF |
static int | ESC_CLASS |
static int | ESC_COMPLEX |
static int | ESC_MASK |
static Hashtable | hashPOSIX |
int | idx |
char[] | instruction |
int | len |
int | lenInstruction |
static int | NODE_NORMAL |
static int | NODE_NULLABLE |
static int | NODE_TOPLEVEL |
int | parens |
String | pattern |
Constructor Summary | |
---|---|
RECompiler()
Constructor. |
Method Summary | |
---|---|
int | atom()
Absorb an atomic character string. |
void | bracket()
Match bracket {m,n} expression put results in bracket member variables |
int | branch(int[] flags)
Compile body of one branch of an or operator (implements concatenation)
|
int | characterClass()
Compile a character class |
int | closure(int[] flags)
Compile a possibly closured terminal |
REProgram | compile(String pattern)
Compiles a regular expression pattern into a program runnable by the pattern
matcher class 'RE'. |
void | emit(char c)
Emit a single character into the program stream. |
void | ensure(int n)
Ensures that n more characters can fit in the program buffer.
|
int | escape()
Match an escape sequence. |
int | expr(int[] flags)
Compile an expression with possible parens around it. |
void | internalError()
Throws a new internal error exception |
int | node(char opcode, int opdata)
Adds a new node |
void | nodeInsert(char opcode, int opdata, int insertAt)
Inserts a node with a given opcode and opdata at insertAt. |
void | setNextOfEnd(int node, int pointTo)
Appends a node to the end of a node chain |
void | syntaxError(String s)
Throws a new syntax error exception |
int | terminal(int[] flags)
Match a terminal node. |
Returns: Index of new atom node
Throws: RESyntaxException Thrown if the regular expression has invalid syntax.
Throws: RESyntaxException Thrown if the regular expression has invalid syntax.
Parameters: flags Flags passed by reference
Returns: Pointer to first node in the branch
Throws: RESyntaxException Thrown if the regular expression has invalid syntax.
Returns: Index of class node
Throws: RESyntaxException Thrown if the regular expression has invalid syntax.
Parameters: flags Flags passed by reference
Returns: Index of closured node
Throws: RESyntaxException Thrown if the regular expression has invalid syntax.
Parameters: pattern Regular expression pattern to compile (see RECompiler class for details).
Returns: A compiled regular expression program.
Throws: RESyntaxException Thrown if the regular expression has invalid syntax.
See Also: RECompiler RE
Parameters: c Character to add
Parameters: n Number of additional characters to ensure will fit.
Returns: ESC_* code or character if simple escape
Throws: RESyntaxException Thrown if the regular expression has invalid syntax.
Parameters: flags Flag value passed by reference
Returns: Node index of expression in instruction array
Throws: RESyntaxException Thrown if the regular expression has invalid syntax.
Throws: Error Thrown in the event of an internal error.
Parameters: opcode Opcode for node opdata Opdata for node (only the low 16 bits are currently used)
Returns: Index of new node in program
Parameters: opcode Opcode for new node opdata Opdata for new node (only the low 16 bits are currently used) insertAt Index at which to insert the new node in the program
Parameters: node Start of node chain to traverse pointTo Node to have the tail of the chain point to
Throws: RESyntaxException Thrown if the regular expression has invalid syntax.
Parameters: flags Flags
Returns: Index of terminal node (closeable)
Throws: RESyntaxException Thrown if the regular expression has invalid syntax.