views:

68

answers:

1

I am using CSET, a library for Unicode character classes for Javascript. It loads fine in Firefox, IE8, and Opera, but fails in Google Chrome and Safari 4 with a syntax error. Strangely enough, the syntax errors are different.

From cset_production.js:

Safari

SyntaxError: Parse error
(line 255)

CSET=function(){
// ...
var g=this
return {import:function(prefix,object){object=object||g
 var i,l,e,es=           // SyntaxError: Parse error (line 255)
 [['fromChar',fC]
 ,['fromInt',fI]
 ,['universe',U]
 ,['nil',nil]
 ,['empty',empty]
 ,['singleton',one]
 ,['fromIntRange',fIR]
 ,['fromCharRange',fCR]
 ,['fromUnicodeGeneralCategory',fGC]
 ,['complement',comp]
 ,['fromList',fL]
 ,['fromString',fS]
 ,['member',member]
 ,['difference',diff]
 ,['union',union]
 ,['intersection',inter]
 ,['toRegex',reCC]
 ,['show',show]
 ]
 for(i=0,l=es.length;i<l,e=es[i];i++)
  object[(prefix||'')+e[0]]=e[1]}}
}();

What is the cause of Safari's syntax error and what can I do to correct the problem?

Google Chrome

uncaught exception SyntaxError: Invalid left-hand side in assignment

[hi,lo]=surrogatePair(c)     // Line 200

Is this error called on legal code? Or is Google Chrome's parser correct in erroring on this line?

A: 

Safari had issues with the use if import as an object property. Also, it got confused by a unicode character in the source code. Correcting these two problems lead to the problems Chrome was having.

Chrome's problem (and thus Safari's problem later) was easily fixed.

I have contacted the author of CSET and hopefully these issues will be fixed in another release.

A new version of CSET has been released which corrects these issues.

strager