Package com.orbit.prog
Record Class LookbehindPos
java.lang.Object
java.lang.Record
com.orbit.prog.LookbehindPos
- All Implemented Interfaces:
Instr
public record LookbehindPos(Prog body, int minLen, int maxLen, int next)
extends Record
implements Instr
Positive lookbehind assertion supporting bounded variable-length patterns.
At the current position pos, scans all start positions s in the range
[max(lbFrom, pos - maxLen), pos - minLen] and executes body forward from
each s. If any sub-match spans exactly [s, pos], execution continues at
next; otherwise the current thread is killed. No input is consumed.
Both fixed-length (minLen == maxLen) and bounded variable-length lookbehind
bodies are supported. Unbounded lookbehind (maxLen == Integer.MAX_VALUE) must be
rejected by the parser before a LookbehindPos instruction is created.
Instances are immutable and safe for use by multiple concurrent threads.
-
Constructor Summary
ConstructorsConstructorDescriptionLookbehindPos(Prog body, int minLen, int maxLen, int next) Creates a newLookbehindPos, validating thatminLenandmaxLenare non-negative and thatmaxLen >= minLen. -
Method Summary
Modifier and TypeMethodDescriptionbody()Returns the value of thebodyrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intmaxLen()Returns the value of themaxLenrecord component.intminLen()Returns the value of theminLenrecord component.intnext()Returns the value of thenextrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
LookbehindPos
Creates a newLookbehindPos, validating thatminLenandmaxLenare non-negative and thatmaxLen >= minLen.- Throws:
IllegalArgumentException- ifminLen < 0ormaxLen < minLen
-
-
Method Details
-
next
public int next()Returns the value of thenextrecord component. -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
body
Returns the value of thebodyrecord component.- Returns:
- the value of the
bodyrecord component
-
minLen
public int minLen()Returns the value of theminLenrecord component.- Returns:
- the value of the
minLenrecord component
-
maxLen
public int maxLen()Returns the value of themaxLenrecord component.- Returns:
- the value of the
maxLenrecord component
-