-
Notifications
You must be signed in to change notification settings - Fork 766
Add Gleam lexer #2662
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 Gleam lexer #2662
Conversation
|
(Pushed a commit to fix line endings, can you configure Git's core.autocrlf for the future? Thanks.) |
Thank you, I thought I'd fixed them. Sorry for the inconvenience |
pygments/lexers/gleam.py
Outdated
| (r'[a-zA-Z_/]\w*', Name), | ||
|
|
||
| # numbers | ||
| (r'(\d+((_\d+)+)?\.(?!\.)(\d+((_\d+)+)?)?|\.\d+((_\d+)+)?)([eEf][+-]?[0-9]+)?', Number.Float), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| (r'(\d+((_\d+)+)?\.(?!\.)(\d+((_\d+)+)?)?|\.\d+((_\d+)+)?)([eEf][+-]?[0-9]+)?', Number.Float), | |
| (r'(\d+(_\d+)*\.(?!\.)(\d+(_\d+)*)?|\.\d+(_\d+)*)([eEf][+-]?[0-9]+)?', Number.Float), |
(X+)? is just X*.
pygments/lexers/gleam.py
Outdated
|
|
||
| # numbers | ||
| (r'(\d+((_\d+)+)?\.(?!\.)(\d+((_\d+)+)?)?|\.\d+((_\d+)+)?)([eEf][+-]?[0-9]+)?', Number.Float), | ||
| (r'\d+((_\d+)+)?[eEf][+-]?[0-9]+', Number.Float), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| (r'\d+((_\d+)+)?[eEf][+-]?[0-9]+', Number.Float), | |
| (r'\d+(_\d+)*[eEf][+-]?[0-9]+', Number.Float), |
pygments/lexers/gleam.py
Outdated
| # numbers | ||
| (r'(\d+((_\d+)+)?\.(?!\.)(\d+((_\d+)+)?)?|\.\d+((_\d+)+)?)([eEf][+-]?[0-9]+)?', Number.Float), | ||
| (r'\d+((_\d+)+)?[eEf][+-]?[0-9]+', Number.Float), | ||
| (r'0[xX][a-fA-F0-9]+((_[a-fA-F0-9]+)+)?(\.([a-fA-F0-9]+((_[a-fA-F0-9]+)+)?)?)?p[+-]?\d+', Number.Float), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| (r'0[xX][a-fA-F0-9]+((_[a-fA-F0-9]+)+)?(\.([a-fA-F0-9]+((_[a-fA-F0-9]+)+)?)?)?p[+-]?\d+', Number.Float), | |
| (r'0[xX][a-fA-F0-9]+(_[a-fA-F0-9]+)*(\.([a-fA-F0-9]+(_[a-fA-F0-9]+)*)?)?p[+-]?\d+', Number.Float), |
pygments/lexers/gleam.py
Outdated
| (r'(\d+((_\d+)+)?\.(?!\.)(\d+((_\d+)+)?)?|\.\d+((_\d+)+)?)([eEf][+-]?[0-9]+)?', Number.Float), | ||
| (r'\d+((_\d+)+)?[eEf][+-]?[0-9]+', Number.Float), | ||
| (r'0[xX][a-fA-F0-9]+((_[a-fA-F0-9]+)+)?(\.([a-fA-F0-9]+((_[a-fA-F0-9]+)+)?)?)?p[+-]?\d+', Number.Float), | ||
| (r'0[bB][01]+((_[01]+)+)?', Number.Bin), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| (r'0[bB][01]+((_[01]+)+)?', Number.Bin), | |
| (r'0[bB][01]+(_[01]+)*', Number.Bin), |
pygments/lexers/gleam.py
Outdated
| (r'\d+((_\d+)+)?[eEf][+-]?[0-9]+', Number.Float), | ||
| (r'0[xX][a-fA-F0-9]+((_[a-fA-F0-9]+)+)?(\.([a-fA-F0-9]+((_[a-fA-F0-9]+)+)?)?)?p[+-]?\d+', Number.Float), | ||
| (r'0[bB][01]+((_[01]+)+)?', Number.Bin), | ||
| (r'0[oO][0-7]+((_[0-7]+)+)?', Number.Oct), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| (r'0[oO][0-7]+((_[0-7]+)+)?', Number.Oct), | |
| (r'0[oO][0-7]+(_[0-7]+)*', Number.Oct), |
pygments/lexers/gleam.py
Outdated
| (r'0[xX][a-fA-F0-9]+((_[a-fA-F0-9]+)+)?(\.([a-fA-F0-9]+((_[a-fA-F0-9]+)+)?)?)?p[+-]?\d+', Number.Float), | ||
| (r'0[bB][01]+((_[01]+)+)?', Number.Bin), | ||
| (r'0[oO][0-7]+((_[0-7]+)+)?', Number.Oct), | ||
| (r'0[xX][a-fA-F0-9]+((_[a-fA-F0-9]+)+)?', Number.Hex), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| (r'0[xX][a-fA-F0-9]+((_[a-fA-F0-9]+)+)?', Number.Hex), | |
| (r'0[xX][a-fA-F0-9]+(_[a-fA-F0-9]+)*', Number.Hex), |
pygments/lexers/gleam.py
Outdated
| (r'0[bB][01]+((_[01]+)+)?', Number.Bin), | ||
| (r'0[oO][0-7]+((_[0-7]+)+)?', Number.Oct), | ||
| (r'0[xX][a-fA-F0-9]+((_[a-fA-F0-9]+)+)?', Number.Hex), | ||
| (r'\d+((_\d+)+)?', Number.Integer), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| (r'\d+((_\d+)+)?', Number.Integer), | |
| (r'\d+(_\d+)*', Number.Integer), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and other suggestions have been implemented, thanks for the input
Yep, I'll pick up the requested changes in the next few days. Just been busy with other things. |
|
Merged, thanks! |
|
Just wanted to give you guys a heads up that the documentation on your website states that Gleam support was added in 2.18, but it appears here that it is planned for 2.19. Thanks a lot for all your hard work and looking forward to the next release :) |
|
That's fixed as well now, thanks! |
Hi, this PR adds a lexer for Gleam, which just released version
1.0.0.I've run tests and things look good to me. However, I'm not a Python person and haven't tried writing a lexer before, particularly not one for Pygments, so I'm happy to take feedback and suggestions for improvements.
There is some example HTML at https://red-rose.com/gleam.html that I generated with
pygmentizeand then modified to add thelightbulbstyle (slightly modified for Name colours). This is the same large example file that's included with the PR.Cheers,
Daren