Author: kjs
Date: Thu Jan 29 10:47:17 2009
New Revision: 36153

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

Log:
[pod] some work on languages/pod. Small bits.

Modified: trunk/languages/pod/src/parser/actions.pm
==============================================================================
--- trunk/languages/pod/src/parser/actions.pm   (original)
+++ trunk/languages/pod/src/parser/actions.pm   Thu Jan 29 10:47:17 2009
@@ -18,10 +18,13 @@
 class Pod::Grammar::Actions;
 
 method TOP($/) {
-    make $( $/ );
-    # for $<pod_section> {
-    #     $( $_  );
-    # }
+    my $rootblock;
+
+    for $<pod_section> {
+        $rootblock.push( $( $_  ) );
+    }
+
+    make $rootblock;
 }
 
 method skipped($/) {
@@ -33,6 +36,7 @@
         ## XXX store it where? A block?
         $( $_ );
     }
+    make $( $<pod_sequence>[0] );
 }
 
 method pod_sequence($/, $key) {
@@ -47,17 +51,22 @@
 
 }
 
-## XXX refactor the block_title stuff for heading and begin_directive.
+
+
+sub title($/, $block) {
+    if $<block_title> {
+        my $title := $( $<block_title>[0] );
+        $block.title( $title.name() );
+    }
+}
 
 method heading($/) {
     my $heading := Pod::DocTree::Heading.new();
     ## set the level of the heading
     $heading.level($<digit>);
 
-    if $<block_title> {
-        my $title := $( $<block_title>[0] );
-        $heading.title( $title.name() );
-    }
+    title($/, $heading);
+
     make $heading;
 }
 
@@ -67,13 +76,12 @@
     my $name  := $( $<block_name> );
     $block.name( $name.name() );
 
-    if $<block_title> {
-        my $title := $( $<block_title>[0] );
-        $heading.title( $title.name() );
-    }
+    title($/, $block);
+
     make $block;
 }
 
+
 method end_directive($/) {
 
 }

Modified: trunk/languages/pod/src/parser/grammar.pg
==============================================================================
--- trunk/languages/pod/src/parser/grammar.pg   (original)
+++ trunk/languages/pod/src/parser/grammar.pg   Thu Jan 29 10:47:17 2009
@@ -29,16 +29,16 @@
 }
 
 regex pod_sequence {
-    | <heading>              #= heading
-    | <begin_directive>      #= begin_directive
-    | <end_directive>        #= end_directive
-    | <for_directive>        #= for_directive
-    | <back_directive>       #= back_directive
-    | <item_directive>       #= item_directive
-    | <over_directive>       #= over_directive
-    | <encoding_directive>   #= encoding_directive
-    | <literal_paragraph>    #= literal_paragraph
-    | <paragraph>            #= paragraph
+    | <heading>              {*} #= heading
+    | <begin_directive>      {*} #= begin_directive
+    | <end_directive>        {*} #= end_directive
+    | <for_directive>        {*} #= for_directive
+    | <back_directive>       {*} #= back_directive
+    | <item_directive>       {*} #= item_directive
+    | <over_directive>       {*} #= over_directive
+    | <encoding_directive>   {*} #= encoding_directive
+    | <literal_paragraph>    {*} #= literal_paragraph
+    | <paragraph>            {*} #= paragraph
 }
 
 token pod_directive {

Reply via email to