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 for Swift 4.2 #1035

Merged
merged 9 commits into from
Jun 19, 2019
Merged

Update for Swift 4.2 #1035

merged 9 commits into from
Jun 19, 2019

Conversation

mattt
Copy link
Contributor

@mattt mattt commented Nov 17, 2018

This PR improves support for Swift 4.2 with the following changes:

  • Add support for keywords beginning with # (e.g. #available)
  • Fix syntax for octal integer literals (e.g. 0o744)
  • Add support for multi-line string literals, which are delimited by three quotation marks (""")

@mattt mattt changed the title Update Highlighter for Swift 4.2 Update for Swift 4.2 Nov 17, 2018
@mwaterfall
Copy link

mwaterfall commented Feb 2, 2019

Would love this to be merged! 🙏🏻 @dblessing @jneen

@pyrmont pyrmont added the needs-review The PR needs to be reviewed label May 28, 2019
@pyrmont
Copy link
Contributor

pyrmont commented May 28, 2019

@mattt Sorry it's taken so long to get around to this one :( Would you be able to add some of these to the visual sample? Don't need to list all the keywords, just a couple of additions to show this working properly.

@pyrmont pyrmont added author-action The PR has been reviewed but action by the author is needed and removed needs-review The PR needs to be reviewed labels May 28, 2019
@mattt
Copy link
Contributor Author

mattt commented May 28, 2019

@pyrmont Sure thing! See 08b9917

@pyrmont
Copy link
Contributor

pyrmont commented May 28, 2019

This generally looks fine but I noticed that the p in the hexadecimal floating point isn't being picked up as a number. Shouldn't it be?

@mattt
Copy link
Contributor Author

mattt commented May 29, 2019

@pyrmont That wasn't in the original scope of this patch, but I just implemented it in
bbec13e.

Tangentially: What's your process for checking / verifying the result of the visual sample?

lib/rouge/lexers/swift.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/swift.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/swift.rb Outdated Show resolved Hide resolved
@pyrmont
Copy link
Contributor

pyrmont commented May 29, 2019

@mattt wrote:

Tangentially: What's your process for checking / verifying the result of the visual sample?

There probably should be a more mechanical (and, hence, reliable) process but honestly, at the moment, I just look at it with the naked eye and try to find mistakes. That's basically how I identified the problems with the floating point/hex regular expressions.

@mattt
Copy link
Contributor Author

mattt commented May 29, 2019

There probably should be a more mechanical (and, hence, reliable) process but honestly, at the moment, I just look at it with the naked eye and try to find mistakes. That's basically how I identified the problems with the floating point/hex regular expressions.

Oh, wow. I was expecting there to be some command that you could run to quickly generate an HTML preview of the current rules applied to the visual sample. Does that not exist? And if not, is this something you'd consider in a PR?

@pyrmont
Copy link
Contributor

pyrmont commented May 29, 2019

@mattt Oh, wait. I may have misunderstood your original question. You realise if you run rackup from the project root, it'll spin up a quick server at http://localhost:8000/ that will display the visual samples as webpages, right?

@pyrmont
Copy link
Contributor

pyrmont commented Jun 19, 2019

@mattt I hope you don't mind but I took the liberty of pushing a commit to your branch with the necessary fix. Hopefully that means we can get this merged :)

I also realised that the link I gave you before was wrong. I manually set my port to be 8000 but by default running bundle exec rackup will launch the server at http://localhost:9292/.

Hope that helps for any future PRs!

@pyrmont pyrmont merged commit c451a82 into rouge-ruby:master Jun 19, 2019
@pyrmont pyrmont removed the author-action The PR has been reviewed but action by the author is needed label Jun 19, 2019
@pyrmont
Copy link
Contributor

pyrmont commented Jun 19, 2019

@mattt This has been successful merged. Thanks for making Rouge a better library :)

@mattt
Copy link
Contributor Author

mattt commented Jun 19, 2019

@pyrmont Thanks for your help and guidance through the process. Looking forward to sending more PRs in the future.

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