org.basex.query.regex.parse
Class RegExParser

java.lang.Object
  extended by org.basex.query.regex.parse.RegExParser
All Implemented Interfaces:
RegExParserConstants

public class RegExParser
extends java.lang.Object
implements RegExParserConstants

A parser for XSD regular expressions.

Author:
BaseX Team 2005-12, BSD License, Leo Woerteler

Field Summary
 Token jj_nt
          Next token.
 Token token
          Current token.
 TokenManager token_source
          User defined Token Manager.
 
Fields inherited from interface org.basex.query.regex.parse.RegExParserConstants
BACK_REF, BR_CLOSE, BR_OPEN, CAT_ESC, CHAR, COMMA, DIGIT, EOF, LINE_END, LINE_START, MULTI_ESC, NEG, NPAR_OPEN, NUMBER, OR, PAR_CLOSE, PAR_OPEN, PLUS, Q_MARK, QUANT_CLOSE, QUANT_OPEN, SINGLE_ESC, STAR, TO, tokenImage, WILDCARD
 
Constructor Summary
RegExParser(byte[] regex, boolean strip, boolean all, boolean multi)
          Constructor.
RegExParser(TokenManager tm)
          Constructor with user supplied Token Manager.
 
Method Summary
 RegExp atom()
          Parses the "atom" rule.
 BackRef backReference()
          Parses the "backReference" rule.
 RegExp branch()
          Parses the "branch" rule.
 Literal Char()
          Parses the "Char" rule.
 RegExp charClass()
          Parses the "charClass" rule.
 RegExp charClassEsc()
          Parses the "charClassEsc" rule.
 CharClass charClassExpr()
          Parses the "charClassExpr" rule.
 int charOrEsc()
          Parses the "charOrEsc" rule.
 RegExp charRange()
          Parses the "charRange" rule.
 void disable_tracing()
          Disable tracing.
 void enable_tracing()
          Enable tracing.
 ParseException generateParseException()
          Generate ParseException.
 Token getNextToken()
          Get the next Token.
 Token getToken(int index)
          Get the specific Token.
 RegExp parse()
          Root production.
static java.util.regex.Pattern parse(byte[] regex, byte[] mod, boolean ext, InputInfo ii)
          Compiles this regular expression to a Pattern.
 CharGroup posCharGroup()
          Parses the "posCharGroup" rule.
 Quantifier quantifier()
          Parses the "quantifier" rule.
 int[] quantity()
          Parses the "quantity" rule.
 RegExp regExp()
          Parses the "regExp" rule.
 void ReInit(TokenManager tm)
          Reinitialise.
 int XmlChar()
          Parses the "XmlChar" rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token_source

public TokenManager token_source
User defined Token Manager.


token

public Token token
Current token.


jj_nt

public Token jj_nt
Next token.

Constructor Detail

RegExParser

public RegExParser(byte[] regex,
                   boolean strip,
                   boolean all,
                   boolean multi)
Constructor.

Parameters:
regex - regular expression to parse
strip - strip whitespace while lexing
all - dot matches all
multi - multi line search

RegExParser

public RegExParser(TokenManager tm)
Constructor with user supplied Token Manager.

Method Detail

parse

public static java.util.regex.Pattern parse(byte[] regex,
                                            byte[] mod,
                                            boolean ext,
                                            InputInfo ii)
                                     throws QueryException
Compiles this regular expression to a Pattern.

Parameters:
regex - regular expression to parse
mod - modifiers
ext - XQuery 3.0 syntax
ii - input info
Returns:
the pattern
Throws:
QueryException - query exception

parse

public final RegExp parse()
                   throws ParseException
Root production.

Returns:
expression
Throws:
ParseException - parsing exception

regExp

public final RegExp regExp()
                    throws ParseException
Parses the "regExp" rule.

Returns:
expression
Throws:
ParseException - parsing exception

branch

public final RegExp branch()
                    throws ParseException
Parses the "branch" rule. Parses the "piece" rule.

Returns:
expression
Throws:
ParseException - parsing exception

quantifier

public final Quantifier quantifier()
                            throws ParseException
Parses the "quantifier" rule.

Returns:
expression
Throws:
ParseException - parsing exception

quantity

public final int[] quantity()
                     throws ParseException
Parses the "quantity" rule. Parses the "quantRange" rule. Parses the "quantMin" rule. Parses the "quantExact" rule.

Returns:
quantity
Throws:
ParseException - parsing exception

atom

public final RegExp atom()
                  throws ParseException
Parses the "atom" rule.

Returns:
expression
Throws:
ParseException - parsing exception

Char

public final Literal Char()
                   throws ParseException
Parses the "Char" rule.

Returns:
expression
Throws:
ParseException - parsing exception

backReference

public final BackRef backReference()
                            throws ParseException
Parses the "backReference" rule.

Returns:
expression
Throws:
ParseException - parsing exception

charClass

public final RegExp charClass()
                       throws ParseException
Parses the "charClass" rule.

Returns:
expression
Throws:
ParseException - parsing exception

charClassEsc

public final RegExp charClassEsc()
                          throws ParseException
Parses the "charClassEsc" rule.

Returns:
expression
Throws:
ParseException - parsing exception

charClassExpr

public final CharClass charClassExpr()
                              throws ParseException
Parses the "charClassExpr" rule. Parses the "charClassSub" rule.

Returns:
character class
Throws:
ParseException - parsing exception

posCharGroup

public final CharGroup posCharGroup()
                             throws ParseException
Parses the "posCharGroup" rule.

Returns:
character group
Throws:
ParseException - parsing exception

charRange

public final RegExp charRange()
                       throws ParseException
Parses the "charRange" rule.

Returns:
expression
Throws:
ParseException - parsing exception

charOrEsc

public final int charOrEsc()
                    throws ParseException
Parses the "charOrEsc" rule.

Returns:
character
Throws:
ParseException - parsing exception

XmlChar

public final int XmlChar()
                  throws ParseException
Parses the "XmlChar" rule.

Returns:
character
Throws:
ParseException - parsing exception

ReInit

public void ReInit(TokenManager tm)
Reinitialise.


getNextToken

public final Token getNextToken()
Get the next Token.


getToken

public final Token getToken(int index)
Get the specific Token.


generateParseException

public ParseException generateParseException()
Generate ParseException.


enable_tracing

public final void enable_tracing()
Enable tracing.


disable_tracing

public final void disable_tracing()
Disable tracing.