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

Update lists of operators/keywords in Julia and expand/refine highlighting #1715

Merged
merged 25 commits into from Mar 5, 2021

Conversation

jmert
Copy link
Contributor

@jmert jmert commented Feb 14, 2021

It appears the Julia highlighting rules have not recently been updated. To me it appears the current syntax definitions probably predate Julia v0.7, and much has changed since then. I was motivated in particular to fix parsing of the "broadcast expression" helper macro @. which currently isn't recognized, but once I got going, I made many other changes to try to bring the definition up to date.

I'd like to recognize @fredrikekre in particular for inspiring me to make changes here based on some of what he did for highlight.js (blog post and code branch).

Some of the more notable changes are:

  • Updated keywords/builtins list from Julia v1.6 (currently at rc1) and greatly expanded set of operators/symbols which are recognized.
  • Operator macros are recognized. In particular, the broadcast expression macro @. is now recognized as valid.
    • Unicode suffixes are handled in most contexts (such as infix or custom transpose 'ᵀ).
  • Symbol literals are identified in simple contexts.
  • Added command triple-quote expressions and special-cased raw"" strings which do not interpolate.
    • Non-standard string literals such as mystring"contents"suffix now identify their prefix/suffix as affixes.
  • Type names in unambiguous contexts are highlighted as types. This necessarily can't catch everything (and hence there's still an explicit list of built-in types), but there are many places like type assertions/annotations and where expression where names can be highlighted with little chance of being wrong.
  • The julia-repl highlighting alias is added to match Julia's own convention for use in Markdown documentation files.
  • Tests for everything which was changed

Hopefully fixes pypy3 CI failure
@Anteru Anteru added this to the 2.9 milestone Mar 5, 2021
@Anteru Anteru added the changelog-update Items which need to get mentioned in the changelog label Mar 5, 2021
@Anteru Anteru merged commit ffac8bd into pygments:master Mar 5, 2021
@Anteru
Copy link
Collaborator

Anteru commented Mar 5, 2021

Merged, thanks a lot for this huge update!

@Anteru Anteru removed the changelog-update Items which need to get mentioned in the changelog label Mar 5, 2021
@jmert jmert deleted the julia branch March 5, 2021 15:16
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