Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 289806 - [parser] [validation] Validation failure with regular expression in jquery-1.3.2.js
Summary: [parser] [validation] Validation failure with regular expression in jquery-1....
Status: CLOSED DUPLICATE of bug 324416
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal with 3 votes (vote)
Target Milestone: Future   Edit
Assignee: Chris Jaun CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-17 20:18 EDT by jdance CLA
Modified: 2010-10-29 11:15 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jdance CLA 2009-09-17 20:18:57 EDT
Create a JavaScript Project.
Download jquery (uncompressed version) from 
http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3.2.js

Drag it into JavaScript project.

With "Enable JavaScript semantic validation" turned off, there are still two errors marked in the source.  

Ignore the first one, it is reported in a separate bug.

The second error on line 1659 is:
String literal is not properly closed by a double-quote

The string in question is a regular expression, so double-quotes are not needed.  
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,

I tried to reproduce this by taking object definition alone.  The error went away.  Something in the jquery code above the definition causes this error to appear here.  As an aside, this error also doesn't occur with the same string in the minimized jquery version.
Comment 1 Eugene Ostroukhov CLA 2010-04-05 19:51:23 EDT
There is some interesting parser behavior:
var Expr = Sizzle.selectors = {
    match: {
        NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,
        ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*('"]*)(.*?)\3|)\s*\]/
    }
};    

Validates flawlessly. But if you add a comma after curly bracket on line 5 (like:
var Expr = Sizzle.selectors = {
    match: {
        NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,
        ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*('"]*)(.*?)\3|)\s*\]/
    },
};) the validator will bark re: double quote.
Comment 2 Chris Jaun CLA 2010-10-29 11:15:56 EDT
Syntax errors go away after fix in 324416.

Will be in 3.2.3 and 3.3.

*** This bug has been marked as a duplicate of bug 324416 ***