-
Notifications
You must be signed in to change notification settings - Fork 113
Ruby scanner sees Symbol instead of Operator #89
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
Comments
Funny :) Pygments is having the same issue. |
Indeed. I surprised Ruby can parse code like that :-P |
Easy to parse, hard to scan… |
This reminds me that YARD uses its own syntax highlighter based on Ripper. I'll have to see how it fairs. Sadly, Ripper is MRI 1.9-only for now, it's not yet supported by JRuby. |
require 'ripper'
require 'pp'
pp Ripper.lex("n=->k{k==0?'':n[k-1]+'{'+n[k-1]+'}'}"); nil
...
[[1, 13], :on_op, ":"],
[[1, 14], :on_ident, "n"],
... |
Ripper is awesome, but I have no idea how to combine it with CodeRay. They do different things, so how to keep them in sync? Also, performance? I'd much rather have an even better heuristic here, eg. colon after single quote must be an operator. |
I haven't measured Ripper's performance, but it mostly written in C, so I'm guessing it's pretty good. The main issue is that it severely limits the supported platforms (MRI 1.9.x+ only), so it may be better as an external experiment for now. 👍 Better heuristic's in CodeRay would always be appreciated, esp. for Ruby. |
Ripper may be fast, but the syncing is definitely not. |
I think this would be a cool feature, but it should not delay 1.1, so I'll set it to "later". |
From Redmine: http://odd-eyed-code.org/issues/266
The text was updated successfully, but these errors were encountered: