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

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 23 Jun 2004 22:01:00 -0400 (EDT)


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 miguel@ximian.com.

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

--- shadow/52285	2004-06-23 22:01:00.000000000 -0400
+++ shadow/52285.tmp.20204	2004-06-23 22:01:00.000000000 -0400
@@ -0,0 +1,72 @@
+Bug#: 52285
+Product: Mono: Compilers
+Version: unspecified
+OS: unknown
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+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