Skip to content

Conversation

@f0rki
Copy link
Contributor

@f0rki f0rki commented Dec 3, 2022

I noticed that the lexer for Solidity would not pick up boolean operators. Odd that nobody noticed this. To fix it I switched to the same regex for operators in the solidity lexer as in the CFamilyLexer. I updated the testcase with a function that covers all the operators I am aware of.

include('constants'),
(r'[a-zA-Z_]\w*', Text),
(r'[!<=>+*/-]', Operator),
(r'[~!%^&*+=|?:<>/-]', Operator),
Copy link
Member

Choose a reason for hiding this comment

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

: is now recognized as both Operator and Punctuation - which makes more sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch. it is somewhat ambiguous. : can be used in the shorthand if operator a ? b : c or also in structs like {x : y}. I would stick with Operator.

@birkenfeld birkenfeld added the changelog-update Items which need to get mentioned in the changelog label Dec 3, 2022
@birkenfeld
Copy link
Member

Thanks! Tests are happy too, so let's go.

@birkenfeld birkenfeld merged commit e9703b7 into pygments:master Dec 3, 2022
@Anteru Anteru added this to the 2.14.0 milestone Dec 30, 2022
@Anteru Anteru removed the changelog-update Items which need to get mentioned in the changelog label Dec 30, 2022
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.

3 participants