java.lang.Object
org.apache.xerces.utils.regex.RegexParser
- Direct Known Subclasses:
- ParserForXMLSchema
- class RegexParser
- extends java.lang.Object
A Regular Expression Parser.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
T_CHAR
static final int T_CHAR
- See Also:
- Constant Field Values
T_EOF
static final int T_EOF
- See Also:
- Constant Field Values
T_OR
static final int T_OR
- See Also:
- Constant Field Values
T_STAR
static final int T_STAR
- See Also:
- Constant Field Values
T_PLUS
static final int T_PLUS
- See Also:
- Constant Field Values
T_QUESTION
static final int T_QUESTION
- See Also:
- Constant Field Values
T_LPAREN
static final int T_LPAREN
- See Also:
- Constant Field Values
T_RPAREN
static final int T_RPAREN
- See Also:
- Constant Field Values
T_DOT
static final int T_DOT
- See Also:
- Constant Field Values
T_LBRACKET
static final int T_LBRACKET
- See Also:
- Constant Field Values
T_BACKSOLIDUS
static final int T_BACKSOLIDUS
- See Also:
- Constant Field Values
T_CARET
static final int T_CARET
- See Also:
- Constant Field Values
T_DOLLAR
static final int T_DOLLAR
- See Also:
- Constant Field Values
T_LPAREN2
static final int T_LPAREN2
- See Also:
- Constant Field Values
T_LOOKAHEAD
static final int T_LOOKAHEAD
- See Also:
- Constant Field Values
T_NEGATIVELOOKAHEAD
static final int T_NEGATIVELOOKAHEAD
- See Also:
- Constant Field Values
T_LOOKBEHIND
static final int T_LOOKBEHIND
- See Also:
- Constant Field Values
T_NEGATIVELOOKBEHIND
static final int T_NEGATIVELOOKBEHIND
- See Also:
- Constant Field Values
T_INDEPENDENT
static final int T_INDEPENDENT
- See Also:
- Constant Field Values
T_SET_OPERATIONS
static final int T_SET_OPERATIONS
- See Also:
- Constant Field Values
T_POSIX_CHARCLASS_START
static final int T_POSIX_CHARCLASS_START
- See Also:
- Constant Field Values
T_COMMENT
static final int T_COMMENT
- See Also:
- Constant Field Values
T_MODIFIERS
static final int T_MODIFIERS
- See Also:
- Constant Field Values
T_CONDITION
static final int T_CONDITION
- See Also:
- Constant Field Values
T_XMLSCHEMA_CC_SUBTRACTION
static final int T_XMLSCHEMA_CC_SUBTRACTION
- See Also:
- Constant Field Values
offset
int offset
regex
java.lang.String regex
regexlen
int regexlen
options
int options
resources
java.util.ResourceBundle resources
chardata
int chardata
nexttoken
int nexttoken
S_NORMAL
protected static final int S_NORMAL
- See Also:
- Constant Field Values
S_INBRACKETS
protected static final int S_INBRACKETS
- See Also:
- Constant Field Values
S_INXBRACKETS
protected static final int S_INXBRACKETS
- See Also:
- Constant Field Values
context
int context
parennumber
int parennumber
hasBackReferences
boolean hasBackReferences
references
java.util.Vector references
RegexParser
public RegexParser()
RegexParser
public RegexParser(java.util.Locale locale)
setLocale
public void setLocale(java.util.Locale locale)
ex
final ParseException ex(java.lang.String key,
int loc)
isSet
private final boolean isSet(int flag)
parse
Token parse(java.lang.String regex,
int options)
throws ParseException
setContext
protected final void setContext(int con)
read
final int read()
next
final void next()
parseRegex
Token parseRegex()
throws ParseException
- regex ::= term (`|` term)*
term ::= factor+
factor ::= ('^' | '$' | '\A' | '\Z' | '\z' | '\b' | '\B' | '\<' | '\>'
| atom (('*' | '+' | '?' | minmax ) '?'? )?)
| '(?=' regex ')' | '(?!' regex ')' | '(?<=' regex ')' | '(?<!' regex ')'
atom ::= char | '.' | range | '(' regex ')' | '(?:' regex ')' | '\' [0-9]
| '\w' | '\W' | '\d' | '\D' | '\s' | '\S' | category-block
parseTerm
Token parseTerm()
throws ParseException
- term ::= factor+
processCaret
Token processCaret()
throws ParseException
processDollar
Token processDollar()
throws ParseException
processLookahead
Token processLookahead()
throws ParseException
processNegativelookahead
Token processNegativelookahead()
throws ParseException
processLookbehind
Token processLookbehind()
throws ParseException
processNegativelookbehind
Token processNegativelookbehind()
throws ParseException
processBacksolidus_A
Token processBacksolidus_A()
throws ParseException
processBacksolidus_Z
Token processBacksolidus_Z()
throws ParseException
processBacksolidus_z
Token processBacksolidus_z()
throws ParseException
processBacksolidus_b
Token processBacksolidus_b()
throws ParseException
processBacksolidus_B
Token processBacksolidus_B()
throws ParseException
processBacksolidus_lt
Token processBacksolidus_lt()
throws ParseException
processBacksolidus_gt
Token processBacksolidus_gt()
throws ParseException
processStar
Token processStar(Token tok)
throws ParseException
processPlus
Token processPlus(Token tok)
throws ParseException
processQuestion
Token processQuestion(Token tok)
throws ParseException
checkQuestion
boolean checkQuestion(int off)
processParen
Token processParen()
throws ParseException
processParen2
Token processParen2()
throws ParseException
processCondition
Token processCondition()
throws ParseException
processModifiers
Token processModifiers()
throws ParseException
processIndependent
Token processIndependent()
throws ParseException
processBacksolidus_c
Token processBacksolidus_c()
throws ParseException
processBacksolidus_C
Token processBacksolidus_C()
throws ParseException
processBacksolidus_i
Token processBacksolidus_i()
throws ParseException
processBacksolidus_I
Token processBacksolidus_I()
throws ParseException
processBacksolidus_g
Token processBacksolidus_g()
throws ParseException
processBacksolidus_X
Token processBacksolidus_X()
throws ParseException
processBackreference
Token processBackreference()
throws ParseException
parseFactor
Token parseFactor()
throws ParseException
- factor ::= ('^' | '$' | '\A' | '\Z' | '\z' | '\b' | '\B' | '\<' | '\>'
| atom (('*' | '+' | '?' | minmax ) '?'? )?)
| '(?=' regex ')' | '(?!' regex ')' | '(?<=' regex ')' | '(?<!' regex ')'
| '(?#' [^)]* ')'
minmax ::= '{' min (',' max?)? '}'
min ::= [0-9]+
max ::= [0-9]+
parseAtom
Token parseAtom()
throws ParseException
- atom ::= char | '.' | char-class | '(' regex ')' | '(?:' regex ')' | '\' [0-9]
| '\w' | '\W' | '\d' | '\D' | '\s' | '\S' | category-block
| '(?>' regex ')'
char ::= '\\' | '\' [efnrt] | bmp-code | character-1
processBacksolidus_pP
protected RangeToken processBacksolidus_pP(int c)
throws ParseException
processCIinCharacterClass
int processCIinCharacterClass(RangeToken tok,
int c)
parseCharacterClass
protected RangeToken parseCharacterClass(boolean useNrange)
throws ParseException
- char-class ::= '[' ( '^'? range ','?)+ ']'
range ::= '\d' | '\w' | '\s' | category-block | range-char
| range-char '-' range-char
range-char ::= '\[' | '\]' | '\\' | '\' [,-efnrtv] | bmp-code | character-2
bmp-code ::= '\' 'u' [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]
parseCharacterClass_old
private RangeToken parseCharacterClass_old(boolean useNrange)
throws ParseException
parseSetOperations
protected RangeToken parseSetOperations()
throws ParseException
- '(?[' ... ']' (('-' | '+' | '&') '[' ... ']')? ')'
getTokenForShorthand
Token getTokenForShorthand(int ch)
decodeEscaped
int decodeEscaped()
throws ParseException
hexChar
private static final int hexChar(int ch)