rouge-ruby / rouge

A pure Ruby code highlighter that is compatible with Pygments
https://rouge.jneen.net/
Other
3.3k stars 732 forks source link

Swift 5.8 and 5.9 updates #1948

Closed johnfairh closed 1 year ago

johnfairh commented 1 year ago

Swift lexer updates for Swift 5.8 (and probably 5.7). First commit:

Second commit is about regular expression literals which have some quirks due to being retrofitted to the language including:

There are some corners I haven't captured including turning off extended syntax inside multi-line REs.

Final commit re-alphabetizes some keyword lists without trying to think too much about why the separate lists exist.

johnfairh commented 1 year ago

I guess I will just keep going here for Swift 5.9:

Screenshot 2023-06-23 at 11 35 40

Simple things:

Swift 5.9 macros mean that users can define their own expression/function-type keywords that begin with ‘#’. So I’ve taken out the special cases of built-in #things as we’ve done in the past for @things. This looks good, highlights any arguments properly and improves the existing #available to match @available: Screenshot 2023-06-23 at 11 35 11 Screenshot 2023-06-23 at 11 35 22

The special case for start-of-line is preserved to keep the 'preprocessor-like' parts different. Screenshot 2023-06-23 at 11 34 33

tancnle commented 1 year ago

Great stuff. Thank you for the work here @johnfairh 🙇🏼 LGTM 🚀