develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33845 - trunk/languages/ecmascript/src/parser

From:
tewk
Date:
December 12, 2008 22:37
Subject:
[svn:parrot] r33845 - trunk/languages/ecmascript/src/parser
Message ID:
20081213063742.11656CB9AF@x12.develooper.com
Author: tewk
Date: Fri Dec 12 22:37:40 2008
New Revision: 33845

Modified:
   trunk/languages/ecmascript/src/parser/actions.pm
   trunk/languages/ecmascript/src/parser/grammar.pg

Log:
[js] fixed object literals


Modified: trunk/languages/ecmascript/src/parser/actions.pm
==============================================================================
--- trunk/languages/ecmascript/src/parser/actions.pm	(original)
+++ trunk/languages/ecmascript/src/parser/actions.pm	Fri Dec 12 22:37:40 2008
@@ -685,7 +685,7 @@
     my $key  := $( $<property_name> );
 
     ## XXX my $key  := PAST::Val.new( $prop, :returns('String'), :node($/) );
-    my $val  := $( $<expression> );
+    my $val  := $( $<assignment_expression> );
 
     $val.named($key);
     make $val;

Modified: trunk/languages/ecmascript/src/parser/grammar.pg
==============================================================================
--- trunk/languages/ecmascript/src/parser/grammar.pg	(original)
+++ trunk/languages/ecmascript/src/parser/grammar.pg	Fri Dec 12 22:37:40 2008
@@ -190,7 +190,7 @@
 rule expression_statement {
     ##<!['{'|'function']> ## is this necessary? isn't this fixed automatically by PGE?
     #<!before \w>
-    <!['{'|'function']>
+    #<!['{'|'function']>
     <expression> ';'
     {*}
 }
@@ -304,12 +304,7 @@
 token this { 'this' {*} }
 
 rule array_literal {
-    '['
-    [
-    | <elision>
-    | <element_list> [',' <elision>]?
-    ]
-    ']'
+    '[' <elision>? <element_list>? [',' <elision>]?  ']'
     {*}
 }
 
@@ -350,12 +345,12 @@
 token null { 'null' {*} }
 
 rule object_literal {
-    '{' [<property> [',' <property>]* ]? '}'
+    '{' [ <property> [',' <property> ]* ]? '}'
     {*}
 }
 
 rule property {
-    <property_name> ':' <expression>
+    <property_name> ':' <assignment_expression>
     {*}
 }
 



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About