tamer: obj::xmlo::air: More explicit dead states

This doesn't go far enough, but it elaborates a bit---the existing was far
too much of a catch-all.  It's important to take advantage of exhaustiveness
checks to ensure each transition is properly accounted for.

This parser is going to get more work over time, including right now, so I'm
not going to go too deep into this yet, but it's be useful (as a reader) to
compare it to e.g. asg::air's parsers' explicit enumeration of states and
favoring of explicit errors over dead state transitions.

DEV-13162
main
Mike Gerwitz 2023-04-21 09:55:53 -04:00
parent dd47fc564d
commit 1f371b6ba6
1 changed files with 6 additions and 1 deletions

View File

@ -222,7 +222,12 @@ impl ParseState for XmloToAir {
Transition(Done(span)).incomplete()
}
(st, tok) => Transition(st).dead(tok),
(st @ Package(..), tok @ (PkgName(..) | Symbol(..))) => {
Transition(st).dead(tok)
}
(st @ (PackageExpected | SymDep(..) | Done(..)), tok) => {
Transition(st).dead(tok)
}
}
}