Author: allison
Date: Sun Jan 25 21:12:05 2009
New Revision: 36017

Modified:
   trunk/languages/pod/src/parser/grammar.pg
   trunk/languages/pod/test.pod

Log:
[pod] Add literal paragraphs, some cleanup on whitespace handling.


Modified: trunk/languages/pod/src/parser/grammar.pg
==============================================================================
--- trunk/languages/pod/src/parser/grammar.pg   (original)
+++ trunk/languages/pod/src/parser/grammar.pg   Sun Jan 25 21:12:05 2009
@@ -28,27 +28,27 @@
     {*}
 }
 
-rule pod_sequence {
-     <back_directive> {*}
-    | <item_directive> {*}
-    | <over_directive> {*}
-    | <heading>
+regex pod_sequence {
+      <heading>
     | <begin_directive>
     | <end_directive>
     | <for_directive>
+    | <back_directive>
+    | <item_directive>
+    | <over_directive>
     | <encoding_directive>
-#    | <literal_paragraph>
+    | <literal_paragraph>
     | <paragraph>
 }
 
 token pod_directive {
-    ^^ '=pod'
+    ^^ '=pod' \n
     <.blank_line>
     {*}
 }
 
 token cut_directive {
-    ^^ '=cut'
+    ^^ '=cut' \n
     <.blank_line>?
     {*}
 }
@@ -58,6 +58,7 @@
     '=head'
     <digit>
     <block_title>?
+    \n
     <.blank_line>
     {*}
 }
@@ -67,6 +68,7 @@
     '=begin'
     <block_name>
     <block_title>?
+    \n
     <.blank_line>
     {*}
 }
@@ -74,6 +76,7 @@
 token end_directive {
     ^^ '=end'
     <block_name>
+    \n
     <.blank_line>
     {*}
 }
@@ -83,7 +86,8 @@
     '=for'
     <block_name>
     <block_title>?
-    <.blank_line>
+    \n
+    <paragraph>
     {*}
 }
 
@@ -94,12 +98,13 @@
         <digit>*
         [ '.' <digit>+ ]?
     ]?
+    \n
     <.blank_line>
     {*}
 }
 
 token back_directive {
-    ^^ '=back'
+    ^^ '=back' \n
     <.blank_line>
     {*}
 }
@@ -112,6 +117,7 @@
         | <digit>* '.'?
         ]
     ]?
+    \n
     <.blank_line>
     {*}
 }
@@ -120,6 +126,7 @@
     ^^
     '=encoding'
     <block_name>
+    \n
     <.blank_line>
     {*}
 }
@@ -127,13 +134,13 @@
 regex paragraph {
     ^^
     <!before '='>           # Not a directive
-    <formatted_text>
-    [ \n <formatted_text> ]*
+    [ <formatted_text> \n ]+
     <.blank_line>
     {*}
 }
 
-token literal_paragraph {
+regex literal_paragraph {
+    ^^
     [ <.pod_ws> <formatted_text> \n ]+
     <.blank_line>
     {*}
@@ -170,11 +177,9 @@
     {*}
 }
 
-#token ws { <!ww> \s+ }
-
 token pod_ws {
     [ ' ' | \t ]+ # Literal spaces or tabs, no newlines or other whitespace
     {*}
 }
 
-token blank_line { \n <.pod_ws>? \n }
+token blank_line { ^^ <.pod_ws>? \n }

Modified: trunk/languages/pod/test.pod
==============================================================================
--- trunk/languages/pod/test.pod        (original)
+++ trunk/languages/pod/test.pod        Sun Jan 25 21:12:05 2009
@@ -58,6 +58,7 @@
 =cut
 
 =for baz
+Body of =for block.
 
 =cut
 
@@ -78,7 +79,14 @@
 
 Text containing E<formatting B<codes>>.
 
-A multi-bracket formating code containing C<<special -> characters>>.
+A multi-bracket formatting code containing C<<special -> characters>>.
+
+=cut
+
+=head4 literal paragraph
+
+  Some literal text.
+  And some more literal text.
 
 =cut
 

Reply via email to