Class RegExParser

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

public class RegExParser extends Object implements RegExParserConstants
A parser for XSD regular expressions.
Author:
BaseX Team 2005-21, BSD License, Leo Woerteler
  • Field Details

    • 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 Details

    • 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 Details

    • groups

      public final int groups()
      Returns the number of parsed groups.
      Returns:
      number of groups
    • 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.