[Mono-bugs] [Bug 52285][Blo] New - Parser can't handle blocks properly.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 17 Dec 2003 02:59:46 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by cesar@ciencias.unam.mx.

http://bugzilla.ximian.com/show_bug.cgi?id=52285

--- shadow/52285	2003-12-17 02:59:46.000000000 -0500
+++ shadow/52285.tmp.10657	2003-12-17 02:59:46.000000000 -0500
@@ -0,0 +1,72 @@
+Bug#: 52285
+Product: Mono/Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Blocker
+Component: JScript
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: cesar@ciencias.unam.mx               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Parser can't handle blocks properly.
+
+Description of Problem:
+
+MJS's parser can't handle blocks (see section 12.1 from Ecma-262 spec)
+properly. The problem is that there exist a construction called object
+literal (see section 11.1.5 from Ecma-262 spec), which can appear as an
+expression in global code but followed by a semi colon. The two rules have
+as prefix '{' and some other tokens, my approach was to left factor both
+rules and lookahead until finding ':' to deambiguate the rules, what I did
+not took into account was the semi colon that must follow the object literal.
+
+Steps to reproduce the problem:
+1. cd mcs/class/Microsoft.JScript
+2. make
+3. cp mcs/class/lib/Microsoft.JScript.dll /usr/local/lib
+4. cd mcs/class/Microsoft.JScript/Microsoft.JScript
+5. mcs -r Microsoft.JScript.dll -o mjs.exe driver.cs
+6. Write into file if.js: 
+
+if (true) {
+        ;
+}
+
+7. Execute: mono mjs.exe if.js
+
+NOTE: if you add a ';' after '}' you'll see that gets parsed without
+trouble. That's due to  object_literal rule.
+
+
+Actual Results
+
+Unhandled Exception: line 5:1: unexpected token: ["",<1>,line=5,col=1]
+
+
+Expected Results:
+
+Parsing phase completed succesfully. 
+
+If parsing phase ends succesfully  it might throw and
+NotImplementedException related for Resolve or Emit.
+
+How often does this happen? 
+
+Always.
+
+Additional Information:
+
+1) Take a look to file
+mcs/class/Microsoft.JScript/Microsoft.JScript/jscript-lexer-parser.g
+
+2) See rules: object_literal and block.
+
+Version:
+Using mono and mcs's cvs versions from december 17, 2003. 
+On Linux RH9.0