Package com.orbit.parse
Record Class ConditionalExpr
java.lang.Object
java.lang.Record
com.orbit.parse.ConditionalExpr
- Record Components:
condition- the condition to evaluate; must not be nullyes- the branch to take when the condition is satisfied; must not be nullnoAlt- the branch to take when the condition is not satisfied; must not be null (useEpsilonfor no-else)
- All Implemented Interfaces:
Expr
public record ConditionalExpr(ConditionalExpr.Condition condition, Expr yes, Expr noAlt)
extends Record
implements Expr
AST node representing a .NET conditional subpattern
(?(condition)yes|no).
The condition is represented as a sealed ConditionalExpr.Condition hierarchy:
ConditionalExpr.GroupIndexCondition— condition is whether a numbered group participated.ConditionalExpr.GroupNameCondition— condition is whether a named group or balance stack is non-empty.ConditionalExpr.LookaheadCondition— condition is a lookahead (positive or negative).
The noAlt branch is Epsilon when the pattern uses the single-branch
form (?(cond)yes).
Instances are immutable and safe for use by multiple concurrent threads.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceSealed base type for conditional subpattern conditions.static final recordCondition that tests whether a numbered capturing group participated in the current match.static final recordCondition that tests whether a named capturing group participated or whether a balance stack is non-empty.static final recordCondition that tests a lookahead assertion at the current position. -
Constructor Summary
ConstructorsConstructorDescriptionConditionalExpr(ConditionalExpr.Condition condition, Expr yes, Expr noAlt) Creates a newConditionalExpr. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconditionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.noAlt()Returns the value of thenoAltrecord component.final StringtoString()Returns a string representation of this record class.yes()Returns the value of theyesrecord component.
-
Constructor Details
-
ConditionalExpr
Creates a newConditionalExpr.
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
condition
Returns the value of theconditionrecord component.- Returns:
- the value of the
conditionrecord component
-
yes
Returns the value of theyesrecord component.- Returns:
- the value of the
yesrecord component
-
noAlt
Returns the value of thenoAltrecord component.- Returns:
- the value of the
noAltrecord component
-