class

Kleene::MatchTracker

Inherits Reference < Object

Constructors

Instance methods

add_empty_match(nfa_with_dead_end, token_index)
Source
add_end_of_match(nfa_with_dead_end, token_index)

the end positions are inclusive of the index of the last character matched, so empty matches are not accounted for in the match_end_positions array

Source
add_match(nfa : NFA, match : MatchRef)
Source
add_start_of_candidate_match(nfa_with_dead_end, token_index)
Source
candidate_match_start_positions

The NFA keys in the following two structures are not the original NFAs supplied to the MultiMatchDFA. They are the original NFAs that have been augmented with a dead end error state, so the keys are objects that are the internal state of a MultiMatchDFA

Source
candidate_match_start_positions=(candidate_match_start_positions : Hash(NFA, Array(Int32)))

The NFA keys in the following two structures are not the original NFAs supplied to the MultiMatchDFA. They are the original NFAs that have been augmented with a dead end error state, so the keys are objects that are the internal state of a MultiMatchDFA

Source
empty_match_positions(nfa)
Source
empty_matches
Source
empty_matches=(empty_matches : Hash(NFA, Array(Int32)))
Source
end_positions(nfa)
Source
invert_candidate_match_start_positions
Source
match_end_positions

The end positions are indices at which, after handling the character, the DFA was observed to be in a match/accept state; however, the interpretation is ambiguous, because the accepting state may be as a result of (1) transitioning to an error state that is also marked final/accepting, OR it may be as a result of transitioning to (2) a non-error final state. In the case of (1), the match may be an empty match, where after transitioning to an error state, the DFA is in a state that is equivalent to the error state and start state and final state (e.g. as in an optional or kleene star DFA), while in the case of (2), the match may be a "normal" match. The ambiguity is problematic because it isn't clear whether the index position of the match is end inclusive end of a match or the beginning of an empty match. This ambiguity is all due to the construction of the composite DFA in the MultiMatchDFA - the dead end error states are epsilon-transitioned to the composite DFA's start state.

Source
match_end_positions=(match_end_positions : Hash(NFA, Array(Int32)))

The end positions are indices at which, after handling the character, the DFA was observed to be in a match/accept state; however, the interpretation is ambiguous, because the accepting state may be as a result of (1) transitioning to an error state that is also marked final/accepting, OR it may be as a result of transitioning to (2) a non-error final state. In the case of (1), the match may be an empty match, where after transitioning to an error state, the DFA is in a state that is equivalent to the error state and start state and final state (e.g. as in an optional or kleene star DFA), while in the case of (2), the match may be a "normal" match. The ambiguity is problematic because it isn't clear whether the index position of the match is end inclusive end of a match or the beginning of an empty match. This ambiguity is all due to the construction of the composite DFA in the MultiMatchDFA - the dead end error states are epsilon-transitioned to the composite DFA's start state.

Source
matches

The NFA keys in the following structure are the original NFAs supplied to the MultiMatchDFA. This is in contrast to the augmented NFAs that are used as keys in the candidate_match_start_positions and match_end_positions structures, documented above ^^^.

Source
matches=(matches : Hash(NFA, Array(MatchRef)))

The NFA keys in the following structure are the original NFAs supplied to the MultiMatchDFA. This is in contrast to the augmented NFAs that are used as keys in the candidate_match_start_positions and match_end_positions structures, documented above ^^^.

Source
matches_for(nfa)
Source
start_positions(nfa)
Source