fholm / IronJS

IronJS - A JavaScript implementation for .NET
http://ironjs.wordpress.com
Apache License 2.0
680 stars 79 forks source link

error happened while reading a single line comment #33

Closed belf closed 13 years ago

belf commented 13 years ago

in Debug.Console paste the following snippet:

// aaaa\bb\cc\dd\utils.js
function a( ) {}
a()

the error is:
IronJS.Error+CompileError: Invalid hex digit 't'
On line 2, column 19 in <unknown>
1: 
2: // aaaa\bb\cc\dd\utils.js
---------------------^

   at IronJS.Error.CompileError.Raise[a](String msg, Tuple`2 pos, String source, String path) in IronJS\Src\IronJS\Error.fs:line 93
   at IronJS.Compiler.Lexer.Input.error[a](T t, String msg) in IronJS\Src\IronJS\Compiler.Lexer.fs:line 437
   at IronJS.Compiler.Lexer.readUnicodeEscape(T s) in IronJS\Src\IronJS\Compiler.Lexer.fs:line 526
   at IronJS.Compiler.Lexer.singlelineComment(T s) in IronJS\Src\IronJS\Compiler.Lexer.fs:line 663
   at IronJS.Compiler.Lexer.lexer@954(T s, Unit unitVar0) in IronJS\Src\IronJS\Compiler.Lexer.fs:line 985
   at IronJS.Compiler.Parser.consume(State p) in IronJS\Src\IronJS\Compiler.Parser.fs:line 255
   at IronJS.Compiler.Parser.nullStmt@462-1.Invoke(State p) in IronJS\Src\IronJS\Compiler.Parser.fs:line 462
   at IronJS.Compiler.Parser.statementList(State p) in IronJS\Src\IronJS\Compiler.Parser.fs:line 381
   at IronJS.Compiler.Parser.parse(String source, Environment env) in IronJS\Src\IronJS\Compiler.Parser.fs:line 1399
   at IronJS.Hosting.FSharp.compile(String source, T t) in IronJS\Src\IronJS\Hosting.fs:line 152
   at IronJS.Hosting.CSharp.Context.Execute(String source) in IronJS\Src\IronJS\Hosting.fs:line 224
   at DebugConsole.MainWindow.<>c__DisplayClass27.<runSources>b__1f() in IronJS\Src\Tools\DebugConsole\MainWindow.xaml.cs:line 385
ChaosPandion commented 13 years ago

In string literals, regular expression literals, and identifiers, any character (code unit) may also be expressed as a Unicode escape sequence consisting of six characters, namely \u plus four hexadecimal digits. Within a comment, such an escape sequence is effectively ignored as part of the comment.

To me this implies that a Unicode escape sequence should not be parsed as we see in the source code. Any thoughts?

otac0n commented 13 years ago

That is correct. This is indeed a bug.