-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HR271 is not determistic #173
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The HR271 standard contains one
NM1
loop (Loop 2120) nested within another (Loop 2100). When the parser encounters anNM1
segment, it cannot decide whether to instantiate a new Loop 2120, or a whole new Loop 2100. The X279 and X279A1 implementations eliminate this ambiguity by using separate qualifiers, so the parser can figure out which loop is intended from the value inNM101
.Looking into this further, it seems X12 intends that the
LS
(loop start) andLE
(loop end) segments alone would resolve the ambiguity. If the parser has read anNM1
segment after anLS
but before anLE
, then it must belong to Loop 2120. Otherwise, anyNM1
encountered outside theLS
andLE
section would belong to Loop 2100.Currently the parser doesn't have special support of
LS
andLE
segments. I don't think that is required here. Instead, the grammar could be changed soLE
is required, and the parser would be changed to either not include the uncle loops in#successors
, or to resolve the ambiguity by not choosing an uncle segment when a sibling is available. Recognizing the correct circumstances for this is important, and shouldn't be specific toLS
andLE
segments.In the meantime, I will be disabling the
HB271
standard, since there are automatically generated specs that will fail otherwise, and the grammar isn't usable in the real world anyway. TheX279
implementation ofHB271
won't be affected.The text was updated successfully, but these errors were encountered: