Class RegexParser

java.lang.Object
org.eu.autogex.regex.parser.RegexParser

public class RegexParser extends Object
A Recursive Descent Parser that converts a Regular Expression string into an Abstract Syntax Tree (AST). * Grammar implemented: Regex -> Term ( '|' Term )* Term -> Factor ( Factor )* (Implicit concatenation) Factor -> Base ( '*' )* Base -> char | '(' Regex ')'
  • Method Details

    • parse

      public static RegexNode parse(String regex)
      Parses a regular expression string into an AST.
      Parameters:
      regex - The regular expression string to parse.
      Returns:
      The root node of the generated AST.
      Throws:
      IllegalArgumentException - If the regex syntax is invalid.