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

enh(scala) remove symbol syntax and fix quoted code syntax #3324

Merged

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Sep 4, 2021

Changes

Scala 2 had only symbols using this syntax. Scala 3 introduced quoted code using the same syntax, which should not be highlighted. Removing this special case makes all use cases consistent.

Checklist

  • Added markup tests, or they don't apply here because...
  • Updated the changelog at CHANGES.md

@nicolasstucki nicolasstucki force-pushed the remove-scala-symbol-highlighting branch from 56ba885 to 394d849 Compare September 4, 2021 15:55
@nicolasstucki nicolasstucki marked this pull request as ready for review September 4, 2021 15:55
@nicolasstucki nicolasstucki force-pushed the remove-scala-symbol-highlighting branch from 394d849 to 72dcb8c Compare September 4, 2021 15:56
@joshgoebel
Copy link
Member

What exactly is the fix to quoted code syntax exactly? I don't see anything in the PR about that (other than the new test).

@joshgoebel
Copy link
Member

Nevermind, I get it now. :) Just had to read it twice. :) Quoted code is using the ' now, not just symbols...

So what exactly is quoted code... is that not a string then?

@nicolasstucki
Copy link
Contributor Author

nicolasstucki commented Sep 6, 2021

So what exactly is quoted code... is that not a string then?

These are part of the metaprogramming syntax of Scala 3. These represent quoted sections of code, in other words, the contents are also normal source code.

They follow syntactical rules similar to string interpolation. String interpolators like s"..." and f"..." can contain ${x} or $x to escape the string. In quoted code a '{...} can be escaped with ${x} or $x. As well as a splice ${..} can be escaped with '{x} or 'x. The 'x is the one we want to fix in this PR.

For more info see https://docs.scala-lang.org/scala3/guides/macros/quotes.html. This document (currently) shows some instances of 'x that should not have been highlighted.

@nicolasstucki nicolasstucki changed the title (scala) remove symbol syntax and fix quoted code syntax enh(scala) remove symbol syntax and fix quoted code syntax Sep 6, 2021
@joshgoebel joshgoebel merged commit fb08ac3 into highlightjs:main Sep 6, 2021
@joshgoebel
Copy link
Member

@nicolasstucki Thanks fo much!

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.

2 participants