[svn:parrot] r39913 - branches/ops_pct/compilers/opsc/compiler

bacek at svn.parrot.org bacek at svn.parrot.org
Tue Jul 7 09:56:01 UTC 2009


Author: bacek
Date: Tue Jul  7 09:56:01 2009
New Revision: 39913
URL: https://trac.parrot.org/parrot/changeset/39913

Log:
Fix op_body parsing. Actually treat op_body literally.

Modified:
   branches/ops_pct/compilers/opsc/compiler/grammar.pg

Modified: branches/ops_pct/compilers/opsc/compiler/grammar.pg
==============================================================================
--- branches/ops_pct/compilers/opsc/compiler/grammar.pg	Tue Jul  7 09:55:24 2009	(r39912)
+++ branches/ops_pct/compilers/opsc/compiler/grammar.pg	Tue Jul  7 09:56:01 2009	(r39913)
@@ -15,8 +15,9 @@
 }
 
 rule op {
-    <op_type> 'op' <op_name=identifier> '(' <op_params>? ')' <op_flag>*
-    <op_body>
+    <op_type> 'op' <op_name=identifier> '(' <op_params>? ')' <op_flag>* 
+    ::
+    [ <op_body> || <panic: "Fail to parse op body"> ]
 }
 
 token op_type {
@@ -44,9 +45,13 @@
 }
 
 # OpBody starts with '{' and ends with single '}' on line.
-# Parse as nested set of {} enclosed things
-rule op_body {
-    '{' ~ '}' <-[{}]>*
+token op_body {
+    '{' <op_body_chunk>* '}'
+}
+
+token op_body_chunk {
+    | <-[{}]>
+    | <op_body>
 }
 
 token identifier {


More information about the parrot-commits mailing list