Class TRegexBacktrackingNFAExecutorLocals
java.lang.Object
com.oracle.truffle.regex.tregex.nodes.TRegexExecutorLocals
com.oracle.truffle.regex.tregex.nodes.nfa.TRegexBacktrackingNFAExecutorLocals
Contains the stack used by
TRegexBacktrackingNFAExecutorNode. One stack frame represents
a snapshot of the backtracker's state. The backtracker state consists of:
- the current index in the input string
- the current NFA state
- all current capture group boundaries (including the number of the last matched group, if tracked)
- all current quantifier loop counters
- all saved indices for zero-width checks in quantifiers
- all saved capture groups for zero-width checks in quantifiers
- all saved capture groups for recursive back-references (if tracked)
sp sp+1 sp+2 sp+2+ncg sp+2+ncg+nq sp+2+ncg+nq+nzwq sp+2+ncg+nq+nzwq+nzwqcg | | | | | | | v v v v v v v ----------------------------------------------------------------------------------------------------------------------------------- |index|nfa_state|capture_groups|quantifiers_counts|zero_width_quantifier_indices|zero_width_quantifier_CG|recursive_capture_groups| ----------------------------------------------------------------------------------------------------------------------------------- frame size: 2 + n_capture_groups*2 [+ 1 last_group] + n_quantifiers + n_zero_width_quantifiers + zero_width_quantifier_CG_length + n_recursive_capture_groups
-
Method Summary
Modifier and TypeMethodDescriptionvoidapply(PureNFATransition t, int index) booleancanPop()booleanprotected voidprotected voidprotected voidcreate(com.oracle.truffle.api.strings.TruffleString input, int fromIndex, int maxIndex, int regionFrom, int regionTo, int index, int nCaptureGroups, int nQuantifiers, int nZeroWidthQuantifiers, int[] zeroWidthTermEnclosedCGLow, int[] zeroWidthQuantifierCGOffsets, boolean allocateStackFrameBuffer, int maxNTransitions, boolean trackLastGroup, boolean dontOverwriteLastGroup, boolean recursiveBackrefs, boolean backrefMultiCharExpansion) createSubNFALocals(boolean newDontOverwriteLastGroup) createSubNFALocals(PureNFATransition t, boolean newDontOverwriteLastGroup) voiddupFrame()voiddupFrame(int n) intgetCaptureGroupBoundary(int boundary) intgetCaptureGroupEnd(int groupNumber) intgetCaptureGroupStart(int groupNumber) intintintgetPc()intgetQuantifierCount(int quantifierIndex) intgetRecursiveCaptureGroupStart(int groupNumber) int[]long[]intgetZeroWidthQuantifierGuardIndex(int quantifierZeroWidthIndex) voidincQuantifierCount(int quantifierIndex) booleanisResultUnmodifiedByZeroWidthQuantifier(int quantifierZeroWidthIndex) voidoverwriteCaptureGroups(int[] captureGroups) intpop()int[]voidprintStack(int curPc) voidpush()voidpushFrame(int[] frame) voidMarks that a result was pushed at the current stack frame.voidpushResult(PureNFATransition t, int index) voidreadFrame(int[] to) voidresetQuantifierCount(int quantifierIndex) voidvoidvoidsaveIndex(int index) voidsaveRecursiveBackrefGroupStart(int groupNumber) voidsetCaptureGroupBoundary(int boundary, int index) voidsetLastGroup(int newLastGroup) voidsetLastInitialStateIndex(int i) voidsetLastInnerLiteralIndex(int i) intsetPc(int pc) voidsetQuantifierCount(int quantifierIndex, int count) voidCopies the current capture group boundaries to the result array.voidsetZeroWidthQuantifierGuardIndex(int quantifierZeroWidthIndex) voidsetZeroWidthQuantifierResults(int quantifierZeroWidthIndex) voidwriteFrame(int[] from) Methods inherited from class com.oracle.truffle.regex.tregex.nodes.TRegexExecutorLocals
getFromIndex, getIndex, getInput, getMaxIndex, getNextIndex, getRegionFrom, getRegionTo, incLoopCount, setIndex, setNextIndex
-
Method Details
-
create
public static TRegexBacktrackingNFAExecutorLocals create(com.oracle.truffle.api.strings.TruffleString input, int fromIndex, int maxIndex, int regionFrom, int regionTo, int index, int nCaptureGroups, int nQuantifiers, int nZeroWidthQuantifiers, int[] zeroWidthTermEnclosedCGLow, int[] zeroWidthQuantifierCGOffsets, boolean allocateStackFrameBuffer, int maxNTransitions, boolean trackLastGroup, boolean dontOverwriteLastGroup, boolean recursiveBackrefs, boolean backrefMultiCharExpansion) -
createSubNFALocals
-
createSubNFALocals
public TRegexBacktrackingNFAExecutorLocals createSubNFALocals(PureNFATransition t, boolean newDontOverwriteLastGroup) -
apply
-
resetToInitialState
public void resetToInitialState() -
clearCaptureGroups
protected void clearCaptureGroups() -
clearRecursiveCaptureGroups
protected void clearRecursiveCaptureGroups() -
clearQuantifierCounts
protected void clearQuantifierCounts() -
push
public void push() -
pushFrame
public void pushFrame(int[] frame) -
readFrame
public void readFrame(int[] to) -
writeFrame
public void writeFrame(int[] from) -
dupFrame
public void dupFrame() -
dupFrame
public void dupFrame(int n) -
pushResult
-
pushResult
public void pushResult()Marks that a result was pushed at the current stack frame. -
setResult
public void setResult()Copies the current capture group boundaries to the result array. -
canPopResult
public boolean canPopResult() -
popResult
public int[] popResult() -
canPop
public boolean canPop() -
pop
public int pop() -
saveIndex
public void saveIndex(int index) -
restoreIndex
public void restoreIndex() -
getPc
public int getPc() -
setPc
public int setPc(int pc) -
getCaptureGroupBoundary
public int getCaptureGroupBoundary(int boundary) -
setCaptureGroupBoundary
public void setCaptureGroupBoundary(int boundary, int index) -
getCaptureGroupStart
public int getCaptureGroupStart(int groupNumber) -
getCaptureGroupEnd
public int getCaptureGroupEnd(int groupNumber) -
getRecursiveCaptureGroupStart
public int getRecursiveCaptureGroupStart(int groupNumber) -
saveRecursiveBackrefGroupStart
public void saveRecursiveBackrefGroupStart(int groupNumber) -
overwriteCaptureGroups
public void overwriteCaptureGroups(int[] captureGroups) -
setLastGroup
public void setLastGroup(int newLastGroup) -
getQuantifierCount
public int getQuantifierCount(int quantifierIndex) -
setQuantifierCount
public void setQuantifierCount(int quantifierIndex, int count) -
resetQuantifierCount
public void resetQuantifierCount(int quantifierIndex) -
incQuantifierCount
public void incQuantifierCount(int quantifierIndex) -
getZeroWidthQuantifierGuardIndex
public int getZeroWidthQuantifierGuardIndex(int quantifierZeroWidthIndex) -
setZeroWidthQuantifierGuardIndex
public void setZeroWidthQuantifierGuardIndex(int quantifierZeroWidthIndex) -
isResultUnmodifiedByZeroWidthQuantifier
public boolean isResultUnmodifiedByZeroWidthQuantifier(int quantifierZeroWidthIndex) -
setZeroWidthQuantifierResults
public void setZeroWidthQuantifierResults(int quantifierZeroWidthIndex) -
getTransitionBitSet
public long[] getTransitionBitSet() -
getLastInnerLiteralIndex
public int getLastInnerLiteralIndex() -
setLastInnerLiteralIndex
public void setLastInnerLiteralIndex(int i) -
getLastInitialStateIndex
public int getLastInitialStateIndex() -
setLastInitialStateIndex
public void setLastInitialStateIndex(int i) -
getStackFrameBuffer
public int[] getStackFrameBuffer() -
getBackrefMultiCharExpansionBufferA
-
getBackrefMultiCharExpansionBufferB
-
printStack
public void printStack(int curPc)
-