[Webkit-unassigned] [Bug 27147] JS Syntax Highlight is incorrect for keyword followed by string or regexp

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Oct 3 21:54:28 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=27147


Joseph Pecoraro <joepeck at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joepeck at webkit.org




--- Comment #8 from Joseph Pecoraro <joepeck at webkit.org>  2009-10-03 21:54:27 PDT ---
Hmm, it looks like when checking for a String or a Number it first checks the
previous character to make sure it was empty (thus scanning a new line) or a
non-alpha character:

  ...
  else if (!prevChar || /^\W/.test(prevChar)) { 
    token = findNumber(codeFragment, code[i - 1]) || 
      findKeyword(codeFragment, code[i - 1]) || 
      findSingleLineString(codeFragment) || 
      findSingleLineRegExp(codeFragment);
  ...

This has been around since the beginning:
http://trac.webkit.org/changeset/34657/trunk/WebCore/page/inspector/SourceFrame.js

Tim, was there a reason for this check or is it just an optimization? Dropping
that check fixes this edge case, but I don't know what types of affects it
would have on the speed of the parsing.  Keishi's solution did just this, he
moved the regex and string checks out of this constraint.

As for Keishi's patch which he said improves "all-minified.js" on slashdot.
Syntax highlighting that file crashes Safari 4.0.3, WebKit r49073, and even
TextMate my editor (which uses a similar syntax highlighting procedure).

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list