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 ClassesModifier and TypeInterfaceDescriptionstatic final recordRepresents a Character Class, allowing any character from a defined set (e.g., "[a-z]", "\d").static final recordRepresents the concatenation of two regular expressions (e.g., "ab").static final recordRepresents a single literal character in the regex (e.g., 'a', 'b').static final recordRepresents the Optional operator, allowing zero or one occurrence (e.g., "a?").static final recordRepresents the Plus operator, allowing one or more repetitions (e.g., "a+").static final recordRepresents the Kleene Star operator, allowing zero or more repetitions (e.g., "a*").static final recordRepresents the union (OR) of two regular expressions (e.g., "a|b").static interfaceThe Visitor interface for the AST nodes.static final recordRepresents the Wildcard operator, matching any character in the known alphabet (e.g., "."). -
Method Summary
Modifier and TypeMethodDescription<T> Taccept(RegexNode.Visitor<T> visitor) Accepts a visitor to apply an operation on this node.
-
Method Details
-
accept
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.
-