News for hackers. Stuff that matters.
Re:Atom now using Io.js by cordite on Tuesday February 03, 2015 @02:30PM (#8992691)
Or syntax highlighting breaking because some code you've been given has some 8K-long regex on one line in the middle.
Re:Atom now using Io.js by VieElm on Tuesday February 03, 2015 @02:43PM (#8992781)
Regular expressions are not the way to do syntax highlighting yet many of the popular editors do it this way. Create a super huge string in vim, textmate or sublime text and watch it blow up. Then try it in Xcode or Intellij and see that there is no problem. The reason for Xcode and Intellij's fast syntax highlighting is because these do not use regular expressions, they use a lexer. They're examining the text one character at a time with some amount of forward and backward looking state and building the syntax highlighting and smart completion/features that way. As long as your editor is using regular expressions for syntax highlighting this will be a problem for you.
Re:Atom now using Io.js by JohnBooty on Tuesday February 03, 2015 @03:06PM (#8992940)
I believe cordite is saying that Atom's syntax highlighting fails when your code contains a huge regular expression.

I don't believe cordite is claiming that Atom's syntax highlighting fails because it uses regular expressions internally.

(I don't know if Atom's syntax highlighting even works that way, FYI. Though I would guess that it does.)

Re:Atom now using Io.js by cordite on Tuesday February 03, 2015 @03:32PM (#8993139)
This is the correct interpretation of what I said.

I don't know if it is also related to long strings in general on one line (have not tested)

Re:Atom now using Io.js by thesz on Tuesday February 03, 2015 @02:58PM (#8992887)
Lexing IS regular expressipn matching (except for some esoteric features like Haskell's nrsted comments).

Difference is in the handling.

As a matter of fact, Visual Studio uses semantic analysis - classes show differently than other identifiers.

Re:Atom now using Io.js by cordite on Tuesday February 03, 2015 @06:09PM (#8994178)
It can be, it can also be a context free grammar, which is 'higher' than a state machine (or regular expression)
Re:Atom now using Io.js by hyperpape on Tuesday February 03, 2015 @07:19PM (#8994521)
But there are also higher complexity bounds on CFGs (since they include regular expressions, they certainly can't be lower).

In any case, I've never heard of someone using non-regular expression CFGs for lexing. Are there cases?

Re:Atom now using Io.js by thesz on Wednesday February 04, 2015 @01:14AM (#8995579)
I mentioned Haskell above. It has nested block comments which should be balanced. Thus CFG.