Interface RegexNode

All Known Implementing Classes:
RegexNode.CharClassNode, RegexNode.ConcatNode, RegexNode.LiteralNode, RegexNode.OptionalNode, RegexNode.PlusNode, RegexNode.StarNode, RegexNode.UnionNode, RegexNode.WildcardNode

public interface RegexNode
Base interface for all nodes in the Regular Expression Abstract Syntax Tree (AST). Utilizes Java Records to define immutable node implementations concisely.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    Represents a Character Class, allowing any character from a defined set (e.g., "[a-z]", "\d").
    static final record 
    Represents the concatenation of two regular expressions (e.g., "ab").
    static final record 
    Represents a single literal character in the regex (e.g., 'a', 'b').
    static final record 
    Represents the Optional operator, allowing zero or one occurrence (e.g., "a?").
    static final record 
    Represents the Plus operator, allowing one or more repetitions (e.g., "a+").
    static final record 
    Represents the Kleene Star operator, allowing zero or more repetitions (e.g., "a*").
    static final record 
    Represents the union (OR) of two regular expressions (e.g., "a|b").
    static interface 
    The Visitor interface for the AST nodes.
    static final record 
    Represents the Wildcard operator, matching any character in the known alphabet (e.g., ".").
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    Accepts a visitor to apply an operation on this node.
  • Method Details

    • accept

      <T> T accept(RegexNode.Visitor<T> visitor)
      Accepts a visitor to apply an operation on this node.
      Type Parameters:
      T - The return type of the visitor.
      Parameters:
      visitor - The visitor applying the operation.
      Returns:
      The result of the visitor's operation.