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 lexer for YANG 1.1 #1408

Merged
merged 9 commits into from
Apr 13, 2020
Merged

Add lexer for YANG 1.1 #1408

merged 9 commits into from
Apr 13, 2020

Conversation

gribok
Copy link
Contributor

@gribok gribok commented Mar 4, 2020

Based on issue #1407, I created a new lexer for YANG.

Features

  • Found and added additional keywords based on RFC7950 to lexer
  • 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
  • Create example yang file for testing
  • No breaked rules in pylint

@gribok gribok mentioned this pull request Mar 4, 2020
@gribok
Copy link
Contributor Author

gribok commented Apr 4, 2020

Simplify ruleset for YANG lexer based on PR rouge-ruby/rouge#1458, which I have created.
If you accept my PR, please squash the commits.

@Anteru
Copy link
Collaborator

Anteru commented Apr 10, 2020

Hi, sorry for not getting to this earlier. This is looking good, one question on the example file -- where is that from? Could there be a license incompatibilities with it?

@gribok
Copy link
Contributor Author

gribok commented Apr 10, 2020

Hi, sorry for not getting to this earlier. This is looking good, one question on the example file -- where is that from? Could there be a license incompatibilities with it?

Good point. I changed the example file to an own created file.

Copy link
Collaborator

@Anteru Anteru left a comment

Choose a reason for hiding this comment

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

One small remark and we're good to :)

class YangLexer(RegexLexer):
"""
Lexer for `YANG <https://tools.ietf.org/html/rfc7950/>`_, based on RFC7950
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add a .. versionadded:: 2.7 line here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks for support.

@Anteru Anteru added this to the 2.7 milestone Apr 10, 2020
@gribok gribok requested a review from Anteru April 10, 2020 20:15
@Anteru Anteru merged commit 04b4d08 into pygments:master Apr 13, 2020
@Anteru
Copy link
Collaborator

Anteru commented Apr 13, 2020

Merged, thanks for your contribution!

@Anteru Anteru added the changelog-update Items which need to get mentioned in the changelog label Apr 13, 2020
@Anteru Anteru removed the changelog-update Items which need to get mentioned in the changelog label May 22, 2020
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.

None yet

2 participants