klorenz / atom-regex-railroad-diagrams

display regex as railroad diagram, if cursor moves to it
MIT License
250 stars 31 forks source link

Doesn't support / in a coffeescript heregex #26

Closed kmdavis closed 9 years ago

kmdavis commented 9 years ago

If you have a heregex (a coffeescript feature that combines a heredoc with a regex) like ///asdf/1234///g it will choke on the embedded /

screen shot 2015-01-21 at 4 29 28 pm

lordjavac commented 9 years ago

This is also true in other languages where you can use different surrounding delimiters for your regexes, e.g. Ruby's %r{} syntax (or perl).

Looking into it a little deeper. Ruby, at least, defines punctuation.section.regexp.begin (and corresponding end). If these scopes are in the string.regex scope, they should be removed and treat the rest as the content of the reggae, allowing slashes if the punctuation was not slashes.

klorenz commented 9 years ago

@lordjavac ty for the syntax scope hint, I will make use of this.

klorenz commented 9 years ago

done.