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

Fix lexer to identify single-quote string that immediately occurs after a concatenation (plus sign). #181

Merged
merged 1 commit into from
Jun 19, 2021

Conversation

wenovus
Copy link
Collaborator

@wenovus wenovus commented Jun 19, 2021

This code makes the new assumption that a ' that follows + must be a string.

This change will break YANG files where there exists an unquoted string that contains a +' character substring. Given that this is unlikely, I think this is a fine tradeoff to get cases like #180 working.

Indeed, the current lexer is already assuming " cannot exist within an unquoted string (see lexIdentifier). This is already a much more restrictive assumption.

NOTE: In YANG1.1:

An unquoted string cannot contain any single or double quote
      characters.

Fixes #180.

…er a concatenation (plus sign).

This code makes the new assumption that a `'` that follows `+` must be a string.

This change will break YANG files where there exists an unquoted string that contains a `+'` character substring. Given that this is unlikely, I think this is a fine tradeoff to get cases like #180 working.

Indeed, the current lexer is already assuming `"` cannot exist within an unquoted string (see `lexIdentifier`). This is already a much more restrictive assumption.

NOTE: In YANG1.1:
```
An unquoted string cannot contain any single or double quote
      characters.
```

Fixes #180.
@wenovus wenovus requested a review from robshakir June 19, 2021 00:02
@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 76.606% when pulling e9586e9 on fix-adjacent-string-concat into 910fedf 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 for the fix Wen!

@wenovus wenovus merged commit 1580609 into master Jun 19, 2021
@wenovus wenovus deleted the fix-adjacent-string-concat branch June 19, 2021 16:40
wenovus added a commit that referenced this pull request Jul 28, 2021
@robshakir, I didn't do a merge on the older PRs before merging, leading to this breakage on HEAD. Is there a setting in goyang you can enable to make it similar ygot where you need to merge into master first before merge?
wenovus added a commit that referenced this pull request Jul 28, 2021
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.

ietf-inet-types@2020-07-06.yang parsing
3 participants