-
Notifications
You must be signed in to change notification settings - Fork 315
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
Positive lookahead doesn't look beyond the current line? #11
Comments
Oniguruma has variable syntax/behavior function. if /(/)(?=[^\/]/[ix])/ =~ "/\n/ix" ==> MATCH You should go to ruby community if you ask about behavior of ruby regexp. |
Thank you very much for the reply! 😇 I'm trying to fix some bug of the Ruby language package of Atom, which I believe is using oniguruma as their regex engine. Actually, the bug is the package can't recognize a multi-line regex. The problem lies somewhere in
which is basically a more verbose version of the previous example. It's really tricky to differentiate the division operator |
I even tried Now that I think about it, maybe I've looked into the wrong spot. |
I have never used Atom. I don't know about it. |
Pretty much, it's written in CoffeeScript, to be exact, and running on Node.js. The UI is basically parsed HTML and CSS, I guess you can call it a desktop editor created with Web technologies 😄
It has, in the core: https://github.com/atom/atom/blob/9ea68024acccd7dc7494f50d03496c16b193c0c4/package.json#L46 |
I have installed Atom 1.8.0 in Windows. file: .atom/.apm/character-count/lib/character-count.coffee activate: (state) -> |
👍 @kkos. I also tried To minimize the possibilities why this doesn't work, I wrote a grammar file from scratch, this is the only rule in the grammar: When the slashes are in the same line, it matches (see the scopes at cursor): But if put newlines in between, it doesn't (see the scopes at cursor and the change of color): It looks like a pattern in the grammar file doesn't search across lines—if it can't find a match in a line, it just starts fresh in the next line. |
Found the answer in TextMate's manual which Atom's grammars are based on:
Thanks for your time, really really appreciate it 😉 |
I thank for your investigation. |
I want to make sure a character is followed by something that not necessarily on the current line. When that something is on next line, using
(?=)
doesn't work, as in/(\/)(?=[^\/]*\/[ix]*)/
If
/ix
doesn't appear in the same line with the previous/
, the regexp doesn't match.If that's really the case, is there a way to make lookahead work across multiple lines?
The text was updated successfully, but these errors were encountered: