@@ -21,9 +21,15 @@ function lookup_best_match_id!(
2121 return match_epsilon! (cls, clause, pos, st)
2222 elseif cls isa Many{Int,T}
2323 return match_epsilon! (cls, clause, pos, st)
24- else
25- # This is reached rarely in corner cases
24+ elseif cls isa Seq{Int,T}
25+ return match_epsilon! (cls, clause, pos, st)
26+ elseif cls isa First{Int,T}
27+ return match_epsilon! (cls, clause, pos, st)
28+ elseif cls isa Tie{Int,T}
2629 return match_epsilon! (cls, clause, pos, st)
30+ else
31+ # This should not be reached.
32+ return match_epsilon! (cls, clause, pos, st) # COV_EXCL_LINE
2733 end
2834 end
2935
@@ -48,6 +54,7 @@ function new_match!(match::Match, st::ParserState)
4854 end
4955
5056 for seed in st. grammar. seed_clauses[match. clause]
57+ # TODO : can we remove the extra epsilon condition in the next line?
5158 if updated || st. grammar. can_match_epsilon[seed]
5259 push! (st. q, seed)
5360 end
@@ -189,8 +196,10 @@ function parse(
189196 elseif cls isa Tie{Int,T}
190197 match_clause! (cls, clause, i, st)
191198 else
192- # Fallback (execution shouldn't reach here)
193- match_clause! (cls, clause, i, st)
199+ # Fallback (execution shouldn't reach here). You might want to
200+ # add a warning statement here if you added new clauses and
201+ # hunt for performance issues.
202+ match_clause! (cls, clause, i, st) # COV_EXCL_LINE
194203 end
195204 # Shame ends here.
196205 end
0 commit comments