Do not accept 0-length tokens

This commit is contained in:
Josh Holtrop 2021-06-06 15:29:30 -04:00
parent 7f54778ba8
commit 930ac56148

View File

@ -33,7 +33,9 @@ module Imbecile
end
def process_nfa_state_set(nfa_state_set)
state = @states[@nfa_state_sets[nfa_state_set]]
state_id = @nfa_state_sets[nfa_state_set]
state = @states[state_id]
if state_id > 0
nfa_state_set.each do |nfa_state|
if nfa_state.accepts
if state.accepts
@ -45,6 +47,7 @@ module Imbecile
end
end
end
end
transitions = transitions_for(nfa_state_set)
while transitions.size > 0
subrange = CodePointRange.first_subrange(transitions.map(&:code_point_range))