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

Add YANG lexer #1458

Merged
merged 12 commits into from
Apr 3, 2020
Merged

Add YANG lexer #1458

merged 12 commits into from
Apr 3, 2020

Conversation

gribok
Copy link
Contributor

@gribok gribok commented Mar 8, 2020

Based on #1457, I created the lexer in ruby.

Features

  • Keywords based on RFC7950
  • Seperating keywords in groups, based on BNF definition of RFC7950 for maintenance
  • Highlighting of constants, like true, false or deprecated with special token
  • Highlighting of namespace-prefix, like type namespace-prefix:counter64;. namespace-prefix will have special token.
    For example namespace urn:ieee:std:802.1AX:yang:ieee802-dot1ax; will have no special token
  • Prefix-highlighting should be the complex regex pattern of all pattern. Due to that, I created test cases to validate prefix-highlighting
  • Add some test cases for testing of another complex scenarios, like revision-date
  • Create example yang file for testing

This will close #1457.

@pyrmont pyrmont self-assigned this Mar 8, 2020
@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Mar 8, 2020
Copy link
Contributor

@pyrmont pyrmont 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 submission and I'm sorry it took a while to get to it. I've left some comments in my review. Please let me know if anything is unclear.

One additional point: could you reduce the length of the visual sample? It should be a relatively minimal example of the syntax. As it's currently written, it seems to contain large sections that are duplicative of syntax. You don't need to make sure every line is testing one and only one rule in the lexer but for maintainability reasons, it would be helpful if it contained fewer overlapping sections of code.

lib/rouge/lexers/yang.rb Show resolved Hide resolved
lib/rouge/lexers/yang.rb Show resolved Hide resolved
lib/rouge/lexers/yang.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/yang.rb Show resolved Hide resolved
lib/rouge/demos/yang Outdated Show resolved Hide resolved
@pyrmont pyrmont added author-action The PR has been reviewed but action by the author is needed and removed needs-review The PR needs to be reviewed labels Mar 31, 2020
@gribok
Copy link
Contributor Author

gribok commented Apr 1, 2020

Please check my comments.
Appreciate your support. :-)

@pyrmont pyrmont added needs-review The PR needs to be reviewed author-action The PR has been reviewed but action by the author is needed and removed author-action The PR has been reviewed but action by the author is needed needs-review The PR needs to be reviewed labels Apr 2, 2020
@gribok gribok requested a review from pyrmont April 2, 2020 20:15
Copy link
Contributor

@pyrmont pyrmont left a comment

Choose a reason for hiding this comment

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

Sorry, I should have said something about this earlier but I removed a lot of the duplication from the visual sample. Let me know if you think it all looks good to you.

@pyrmont pyrmont added needs-review The PR needs to be reviewed author-action The PR has been reviewed but action by the author is needed and removed author-action The PR has been reviewed but action by the author is needed needs-review The PR needs to be reviewed labels Apr 3, 2020
@gribok
Copy link
Contributor Author

gribok commented Apr 3, 2020

Sorry, I should have said something about this earlier but I removed a lot of the duplication from the visual sample. Let me know if you think it all looks good to you.

Thanks! I have adjust the visual sample to an simpler example and additionally removed the long descriptions.

From my point of view, everything looks good now.

@pyrmont pyrmont merged commit 7895dc4 into rouge-ruby:master Apr 3, 2020
@pyrmont
Copy link
Contributor

pyrmont commented Apr 3, 2020

@gribok Thanks for all your work to get this done—it's finally finished! This will be part of the next release of Rouge. That's scheduled to come out on Tuesday 14 April 🎉

@pyrmont pyrmont removed the author-action The PR has been reviewed but action by the author is needed label Apr 3, 2020
mattt pushed a commit to NSHipster/rouge that referenced this pull request May 21, 2020
This commit adds a lexer for the YANG 1.1 modeling language.
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.

Add lexer for YANG
2 participants