org.enhydra.apache.xerces.utils.regex
Class ParserForXMLSchema

java.lang.Object
  |
  +--org.enhydra.apache.xerces.utils.regex.RegexParser
        |
        +--org.enhydra.apache.xerces.utils.regex.ParserForXMLSchema

class ParserForXMLSchema
extends RegexParser

A regular expression parser for the XML Shema.

Author:
TAMURA Kent <kent@trl.ibm.co.jp>

Nested Class Summary
(package private) static class RegexParser.ReferencePosition
           
 
Field Summary
(package private)  int chardata
           
(package private)  int context
           
(package private)  boolean hasBackReferences
           
(package private)  int nexttoken
           
(package private)  int offset
           
(package private)  int options
           
(package private)  int parennumber
           
protected static Hashtable ranges
           
protected static Hashtable ranges2
           
(package private)  Vector references
           
(package private)  String regex
           
(package private)  int regexlen
           
(package private)  ResourceBundle resources
           
protected static int S_INBRACKETS
           
protected static int S_INXBRACKETS
           
protected static int S_NORMAL
           
(package private) static int T_BACKSOLIDUS
           
(package private) static int T_CARET
           
(package private) static int T_CHAR
           
(package private) static int T_COMMENT
           
(package private) static int T_CONDITION
           
(package private) static int T_DOLLAR
           
(package private) static int T_DOT
           
(package private) static int T_EOF
           
(package private) static int T_INDEPENDENT
           
(package private) static int T_LBRACKET
           
(package private) static int T_LOOKAHEAD
           
(package private) static int T_LOOKBEHIND
           
(package private) static int T_LPAREN
           
(package private) static int T_LPAREN2
           
(package private) static int T_MODIFIERS
           
(package private) static int T_NEGATIVELOOKAHEAD
           
(package private) static int T_NEGATIVELOOKBEHIND
           
(package private) static int T_OR
           
(package private) static int T_PLUS
           
(package private) static int T_POSIX_CHARCLASS_START
           
(package private) static int T_QUESTION
           
(package private) static int T_RPAREN
           
(package private) static int T_SET_OPERATIONS
           
(package private) static int T_STAR
           
(package private) static int T_XMLSCHEMA_CC_SUBTRACTION
           
 
Constructor Summary
ParserForXMLSchema()
           
ParserForXMLSchema(Locale locale)
           
 
Method Summary
(package private)  boolean checkQuestion(int off)
           
(package private)  int decodeEscaped()
           
(package private)  ParseException ex(String key, int loc)
           
protected static RangeToken getRange(String name, boolean positive)
           
(package private)  Token getTokenForShorthand(int ch)
           
(package private)  void next()
           
(package private)  Token parse(String regex, int options)
           
(package private)  Token parseAtom()
          atom ::= char | '.' | char-class | '(' regex ')' | '(?
protected  RangeToken parseCharacterClass(boolean useNrange)
          Parses a character-class-expression, not a character-class-escape.
(package private)  Token parseFactor()
          factor ::= ('^' | '$' | '\A' | '\Z' | '\z' | '\b' | '\B' | '\<' | '\>' | atom (('*' | '+' | '?'
(package private)  Token parseRegex()
          regex ::= term (`|` term)* term ::= factor+ factor ::= ('^' | '$' | '\A' | '\Z' | '\z' | '\b' | '\B' | '\<' | '\>' | atom (('*' | '+' | '?'
protected  RangeToken parseSetOperations()
          '(?
(package private)  Token parseTerm()
          term ::= factor+
(package private)  Token processBackreference()
           
(package private)  Token processBacksolidus_A()
           
(package private)  Token processBacksolidus_b()
           
(package private)  Token processBacksolidus_B()
           
(package private)  Token processBacksolidus_c()
           
(package private)  Token processBacksolidus_C()
           
(package private)  Token processBacksolidus_g()
           
(package private)  Token processBacksolidus_gt()
           
(package private)  Token processBacksolidus_i()
           
(package private)  Token processBacksolidus_I()
           
(package private)  Token processBacksolidus_lt()
           
protected  RangeToken processBacksolidus_pP(int c)
           
(package private)  Token processBacksolidus_X()
           
(package private)  Token processBacksolidus_z()
           
(package private)  Token processBacksolidus_Z()
           
(package private)  Token processCaret()
           
(package private)  int processCIinCharacterClass(RangeToken tok, int c)
           
(package private)  Token processCondition()
           
(package private)  Token processDollar()
           
(package private)  Token processIndependent()
           
(package private)  Token processLookahead()
           
(package private)  Token processLookbehind()
           
(package private)  Token processModifiers()
           
(package private)  Token processNegativelookahead()
           
(package private)  Token processNegativelookbehind()
           
(package private)  Token processParen()
           
(package private)  Token processParen2()
           
(package private)  Token processPlus(Token tok)
           
(package private)  Token processQuestion(Token tok)
           
(package private)  Token processStar(Token tok)
           
(package private)  int read()
           
protected  void setContext(int con)
           
 void setLocale(Locale locale)
           
(package private) static void setupRange(Token range, String src)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ranges

protected static Hashtable ranges

ranges2

protected static Hashtable ranges2

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

String regex

regexlen

int regexlen

options

int options

resources

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

Vector references
Constructor Detail

ParserForXMLSchema

public ParserForXMLSchema()

ParserForXMLSchema

public ParserForXMLSchema(Locale locale)
Method Detail

processCaret

Token processCaret()
             throws ParseException
Overrides:
processCaret in class RegexParser
ParseException

processDollar

Token processDollar()
              throws ParseException
Overrides:
processDollar in class RegexParser
ParseException

processLookahead

Token processLookahead()
                 throws ParseException
Overrides:
processLookahead in class RegexParser
ParseException

processNegativelookahead

Token processNegativelookahead()
                         throws ParseException
Overrides:
processNegativelookahead in class RegexParser
ParseException

processLookbehind

Token processLookbehind()
                  throws ParseException
Overrides:
processLookbehind in class RegexParser
ParseException

processNegativelookbehind

Token processNegativelookbehind()
                          throws ParseException
Overrides:
processNegativelookbehind in class RegexParser
ParseException

processBacksolidus_A

Token processBacksolidus_A()
                     throws ParseException
Overrides:
processBacksolidus_A in class RegexParser
ParseException

processBacksolidus_Z

Token processBacksolidus_Z()
                     throws ParseException
Overrides:
processBacksolidus_Z in class RegexParser
ParseException

processBacksolidus_z

Token processBacksolidus_z()
                     throws ParseException
Overrides:
processBacksolidus_z in class RegexParser
ParseException

processBacksolidus_b

Token processBacksolidus_b()
                     throws ParseException
Overrides:
processBacksolidus_b in class RegexParser
ParseException

processBacksolidus_B

Token processBacksolidus_B()
                     throws ParseException
Overrides:
processBacksolidus_B in class RegexParser
ParseException

processBacksolidus_lt

Token processBacksolidus_lt()
                      throws ParseException
Overrides:
processBacksolidus_lt in class RegexParser
ParseException

processBacksolidus_gt

Token processBacksolidus_gt()
                      throws ParseException
Overrides:
processBacksolidus_gt in class RegexParser
ParseException

processStar

Token processStar(Token tok)
            throws ParseException
Overrides:
processStar in class RegexParser
ParseException

processPlus

Token processPlus(Token tok)
            throws ParseException
Overrides:
processPlus in class RegexParser
ParseException

processQuestion

Token processQuestion(Token tok)
                throws ParseException
Overrides:
processQuestion in class RegexParser
ParseException

checkQuestion

boolean checkQuestion(int off)
Overrides:
checkQuestion in class RegexParser

processParen

Token processParen()
             throws ParseException
Overrides:
processParen in class RegexParser
ParseException

processParen2

Token processParen2()
              throws ParseException
Overrides:
processParen2 in class RegexParser
ParseException

processCondition

Token processCondition()
                 throws ParseException
Overrides:
processCondition in class RegexParser
ParseException

processModifiers

Token processModifiers()
                 throws ParseException
Overrides:
processModifiers in class RegexParser
ParseException

processIndependent

Token processIndependent()
                   throws ParseException
Overrides:
processIndependent in class RegexParser
ParseException

processBacksolidus_c

Token processBacksolidus_c()
                     throws ParseException
Overrides:
processBacksolidus_c in class RegexParser
ParseException

processBacksolidus_C

Token processBacksolidus_C()
                     throws ParseException
Overrides:
processBacksolidus_C in class RegexParser
ParseException

processBacksolidus_i

Token processBacksolidus_i()
                     throws ParseException
Overrides:
processBacksolidus_i in class RegexParser
ParseException

processBacksolidus_I

Token processBacksolidus_I()
                     throws ParseException
Overrides:
processBacksolidus_I in class RegexParser
ParseException

processBacksolidus_g

Token processBacksolidus_g()
                     throws ParseException
Overrides:
processBacksolidus_g in class RegexParser
ParseException

processBacksolidus_X

Token processBacksolidus_X()
                     throws ParseException
Overrides:
processBacksolidus_X in class RegexParser
ParseException

processBackreference

Token processBackreference()
                     throws ParseException
Overrides:
processBackreference in class RegexParser
ParseException

processCIinCharacterClass

int processCIinCharacterClass(RangeToken tok,
                              int c)
Overrides:
processCIinCharacterClass in class RegexParser

parseCharacterClass

protected RangeToken parseCharacterClass(boolean useNrange)
                                  throws ParseException
Parses a character-class-expression, not a character-class-escape. c-c-expression ::= '[' c-group ']' c-group ::= positive-c-group | negative-c-group | c-c-subtraction positive-c-group ::= (c-range | c-c-escape)+ negative-c-group ::= '^' positive-c-group c-c-subtraction ::= (positive-c-group | negative-c-group) subtraction subtraction ::= '-' c-c-expression c-range ::= single-range | from-to-range single-range ::= multi-c-escape | category-c-escape | block-c-escape | cc-normal-c ::= from-to-range ::= cc-normal-c '-' cc-normal-c

Overrides:
parseCharacterClass in class RegexParser
Returns:
This returns no NrageToken.
ParseException

parseSetOperations

protected RangeToken parseSetOperations()
                                 throws ParseException
Description copied from class: RegexParser
'(?[' ... ']' (('-' | '+' | '&') '[' ... ']')? ')'

Overrides:
parseSetOperations in class RegexParser
ParseException

getTokenForShorthand

Token getTokenForShorthand(int ch)
Overrides:
getTokenForShorthand in class RegexParser

decodeEscaped

int decodeEscaped()
            throws ParseException
Overrides:
decodeEscaped in class RegexParser
ParseException

getRange

protected static RangeToken getRange(String name,
                                     boolean positive)

setupRange

static void setupRange(Token range,
                       String src)

setLocale

public void setLocale(Locale locale)

ex

final ParseException ex(String key,
                        int loc)

parse

Token parse(String regex,
            int options)
      throws ParseException
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

ParseException

parseTerm

Token parseTerm()
          throws ParseException
term ::= factor+

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]+

ParseException

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

ParseException

processBacksolidus_pP

protected RangeToken processBacksolidus_pP(int c)
                                    throws ParseException
ParseException


Copyright © 1999 The Apache Software Foundation. All Rights reserved.