[svn:parrot] r39915 - in branches/ops_pct/compilers/opsc: compiler t

bacek at svn.parrot.org bacek at svn.parrot.org
Tue Jul 7 10:21:26 UTC 2009


Author: bacek
Date: Tue Jul  7 10:21:26 2009
New Revision: 39915
URL: https://trac.parrot.org/parrot/changeset/39915

Log:
Add handling of pod comments as ws.

Modified:
   branches/ops_pct/compilers/opsc/compiler/grammar.pg
   branches/ops_pct/compilers/opsc/t/01-parse.t

Modified: branches/ops_pct/compilers/opsc/compiler/grammar.pg
==============================================================================
--- branches/ops_pct/compilers/opsc/compiler/grammar.pg	Tue Jul  7 09:56:38 2009	(r39914)
+++ branches/ops_pct/compilers/opsc/compiler/grammar.pg	Tue Jul  7 10:21:26 2009	(r39915)
@@ -58,7 +58,14 @@
     <.ident>
 }
 
-
+# ws handles whitespace, pod and perl comments
+token ws {
+  [
+  | \s+
+  | '#' \N*
+  | ^^ '=' .*? \n '=cut'
+  ]*
+}
 
 
 

Modified: branches/ops_pct/compilers/opsc/t/01-parse.t
==============================================================================
--- branches/ops_pct/compilers/opsc/t/01-parse.t	Tue Jul  7 09:56:38 2009	(r39914)
+++ branches/ops_pct/compilers/opsc/t/01-parse.t	Tue Jul  7 10:21:26 2009	(r39915)
@@ -7,9 +7,10 @@
     .include 'test_more.pir'
     load_bytecode 'opsc.pbc'
 
-    plan(3)
+    plan(5)
 
     test_parse_basic_op()
+    test_parse_many_ops()
 .end
 
 .sub "test_parse_basic_op"
@@ -47,6 +48,52 @@
 
 .end
 
+.sub "test_parse_many_ops"
+    .local string buf
+    .local pmc res
+
+    buf = <<"END"
+
+=item noop
+
+asdfs
+
+=cut
+
+inline op noop() {
+}
+
+=item halt
+
+asdsad
+
+=cut
+
+inline op halt() {
+}
+
+=head2 
+
+ads
+
+=cut
+
+inline op rule_the_world() {
+}
+
+
+END
+    
+    res = "_parse_buffer"(buf)
+    ok(1, "Multiple ops parsed")
+
+    $I0 = res['ops';'op']
+    is($I0, 3, "...and we have 3 ops")
+
+.end
+
+
+
 # Don't forget to update plan!
 
 # Local Variables:


More information about the parrot-commits mailing list