Repository navigation
Refuse an identifier the parser cannot complete - #16
Merged
Merged
Conversation
Several of the inner switches carry no default arm, so when the digit one of
them is about to read is missing, or names something the parser does not know,
nothing matches and nothing parses. elementToReturn was then left the empty
string it started as and pushed onto the answer, so parseBarcode("]C1430")
came back as a successful parse whose one element was "".
It happened for 26 three digit prefixes. Some are a real family with the last
digit missing, 430x among them; others name nothing the standard defines, 230x
among them, where 235 is the only identifier there is.
The guard sits at the end of the identifier switch rather than in each arm, so
an identifier added later without a default cannot bring the fault back.
Also moves the isoDate entry in the changelog out of 1.1.0 and into a fresh
unreleased section. 1.1.0 was published before that change merged, so the entry
was describing something the release does not contain.
MaximBelov
force-pushed
the
fix/incomplete-ai
branch
from
August 13, 2026 09:15
ddc20d4 to
dd9ff3b
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
parseBarcode("]C1430")returned a successful parse whose one element was"":Several inner switches carry no default arm, so when the digit they are about to read is missing — or names something the parser does not know — nothing matches, nothing parses, and the element being built is left the empty string it started as. It then gets pushed onto the answer.
26 three digit prefixes did this:
230-234,236-239,430-433,701,702,704,720-722,724-729,803. Some are a real family with the last digit missing (430x); others name nothing the standard defines (230x, where235is the only one there is).Now refused with
unrecognised AI. The guard sits at the end of the identifier switch rather than in each arm, so an identifier added later without a default cannot bring it back.403 specs, 0 failures in UTC, Dublin and New York. Coverage still 100%.
One correction to the changelog
The
isoDateentry from #15 was sitting under## 1.1.0, but 1.1.0 was published before #15 merged — the released package does not contain it. Moved to a fresh unreleased section, along with this fix.