class Kleene::MatchTracker

Defined in:

multi_match_dfa.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def add_empty_match(nfa_with_dead_end, token_index) #

[View source]
def 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


[View source]
def add_match(nfa : NFA, match : MatchRef) #

[View source]
def add_start_of_candidate_match(nfa_with_dead_end, token_index) #

[View source]
def 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


[View source]
def 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


[View source]
def empty_match_positions(nfa) #

[View source]
def empty_matches : Hash(NFA, Array(Int32)) #

[View source]
def empty_matches=(empty_matches : Hash(NFA, Array(Int32))) #

[View source]
def end_positions(nfa) #

[View source]
def invert_candidate_match_start_positions : Hash(Int32, Array(NFA)) #

[View source]
def 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.


[View source]
def 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.


[View source]
def 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 ^^^.


[View source]
def 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 ^^^.


[View source]
def matches_for(nfa) #

[View source]
def start_positions(nfa) #

[View source]