Skip to content
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

Ignore extra error tokens. #202

Merged
merged 1 commit into from
Sep 30, 2021
Merged

Ignore extra error tokens. #202

merged 1 commit into from
Sep 30, 2021

Conversation

wenovus
Copy link
Collaborator

@wenovus wenovus commented Aug 24, 2021

An alternative that fixes #116.

This is essentially what @pborman proposed in #117 (comment).

I wasn't able to reproduce test failing as mentioned by @andaru in #117 (comment) in the current codebase, so pborman's suggestion now makes more sense.

The reason seems to be that error tokens are always skipped, so they don't seem to affect Location as Andrew mentioned:

goyang/pkg/yang/parse.go

Lines 207 to 214 in 1fb7893

// next returns the next unprocessed lexer token.
next := func() *token {
for {
if t := p.lex.NextToken(); t.Code() != tError {
return t
}
}
}

An alternative that fixes #116.

This is essentially what @pborman proposed in
#117 (comment).

I wasn't able to reproduce test failing as mentioned by @andaru in
#117 (comment) in
the current codebase, so pborman's suggestion now makes more sense.

The reason seems to be that error tokens are always skipped, so they
don't seem to affect `Location` as Andrew mentioned:
https://github.com/openconfig/goyang/blob/1fb7893798e04830b4d7fbbcd6672b95668fcf73/pkg/yang/parse.go#L207-L214
@wenovus wenovus requested review from andaru and robshakir August 24, 2021 20:02
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 81.768% when pulling a22c8a0 on ignore-too-many-errors into 1fb7893 on master.

Copy link
Contributor

@robshakir robshakir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - I'm not sure that we ever properly reproduced this issue -- but this looks to handle the invalid escapes that were being discussed.

@wenovus wenovus merged commit 91a8b82 into master Sep 30, 2021
@wenovus wenovus deleted the ignore-too-many-errors branch September 30, 2021 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error channel is not consumed
3 participants