Package org.basex.query.util.regex.parse
Class RegExParser
java.lang.Object
org.basex.query.util.regex.parse.RegExParser
- All Implemented Interfaces:
RegExParserConstants
A parser for XSD regular expressions.
- Author:
- BaseX Team 2005-21, BSD License, Leo Woerteler
-
Field Summary
FieldsModifier and TypeFieldDescriptionNext token.Current token.User defined Token Manager.Fields inherited from interface org.basex.query.util.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
ConstructorsConstructorDescriptionRegExParser(byte[] regex, boolean strip, boolean all, boolean multi) Constructor.Constructor with user supplied Token Manager. -
Method Summary
Modifier and TypeMethodDescriptionfinal RegExpatom()Parses the "atom" rule.final BackRefParses the "backReference" rule.final RegExpbranch()Parses the "branch" rule.final LiteralChar()Parses the "Char" rule.final RegExpParses the "charClass" rule.final RegExpParses the "charClassEsc" rule.final CharClassParses the "charClassExpr" rule.final intParses the "charOrEsc" rule.final RegExpParses the "charRange" rule.final voidDisable tracing.final voidEnable tracing.Generate ParseException.final TokenGet the next Token.final TokengetToken(int index) Get the specific Token.final intgroups()Returns the number of parsed groups.final RegExpparse()Root production.final CharGroupParses the "posCharGroup" rule.final QuantifierParses the "quantifier" rule.final int[]quantity()Parses the "quantity" rule.final RegExpregExp()Parses the "regExp" rule.voidReInit(TokenManager tm) Reinitialise.final intXmlChar()Parses the "XmlChar" rule.
-
Field Details
-
token_source
User defined Token Manager. -
token
Current token. -
jj_nt
Next token.
-
-
Constructor Details
-
RegExParser
public RegExParser(byte[] regex, boolean strip, boolean all, boolean multi) Constructor.- Parameters:
regex- regular expression to parsestrip- strip whitespace while lexingall- dot matches allmulti- multi line search
-
RegExParser
Constructor with user supplied Token Manager.
-
-
Method Details
-
groups
public final int groups()Returns the number of parsed groups.- Returns:
- number of groups
-
parse
Root production.- Returns:
- expression
- Throws:
ParseException- parsing exception
-
regExp
Parses the "regExp" rule.- Returns:
- expression
- Throws:
ParseException- parsing exception
-
branch
Parses the "branch" rule. Parses the "piece" rule.- Returns:
- expression
- Throws:
ParseException- parsing exception
-
quantifier
Parses the "quantifier" rule.- Returns:
- expression
- Throws:
ParseException- parsing exception
-
quantity
Parses the "quantity" rule. Parses the "quantRange" rule. Parses the "quantMin" rule. Parses the "quantExact" rule.- Returns:
- quantity
- Throws:
ParseException- parsing exception
-
atom
Parses the "atom" rule.- Returns:
- expression
- Throws:
ParseException- parsing exception
-
Char
Parses the "Char" rule.- Returns:
- expression
- Throws:
ParseException- parsing exception
-
backReference
Parses the "backReference" rule.- Returns:
- expression
- Throws:
ParseException- parsing exception
-
charClass
Parses the "charClass" rule.- Returns:
- expression
- Throws:
ParseException- parsing exception
-
charClassEsc
Parses the "charClassEsc" rule.- Returns:
- expression
- Throws:
ParseException- parsing exception
-
charClassExpr
Parses the "charClassExpr" rule. Parses the "charClassSub" rule.- Returns:
- character class
- Throws:
ParseException- parsing exception
-
posCharGroup
Parses the "posCharGroup" rule.- Returns:
- character group
- Throws:
ParseException- parsing exception
-
charRange
Parses the "charRange" rule.- Returns:
- expression
- Throws:
ParseException- parsing exception
-
charOrEsc
Parses the "charOrEsc" rule.- Returns:
- character
- Throws:
ParseException- parsing exception
-
XmlChar
Parses the "XmlChar" rule.- Returns:
- character
- Throws:
ParseException- parsing exception
-
ReInit
Reinitialise. -
getNextToken
Get the next Token. -
getToken
Get the specific Token. -
generateParseException
Generate ParseException. -
enable_tracing
public final void enable_tracing()Enable tracing. -
disable_tracing
public final void disable_tracing()Disable tracing.
-