Skip to content

Commit

Permalink
Parse tables, import 07-tables.t
Browse files Browse the repository at this point in the history
  • Loading branch information
Tadeusz Sośnierz committed Jul 10, 2011
1 parent 076e348 commit 8787be2
Show file tree
Hide file tree
Showing 6 changed files with 481 additions and 5 deletions.
33 changes: 28 additions & 5 deletions src/Perl6/Actions.pm
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,18 @@ class Perl6::Actions is HLL::Actions {
make $<pod_block>.ast;
}

method pod_block:sym<delimited>($/) {
make Perl6::Pod::any_block($/);
}

method pod_block:sym<delimited_raw>($/) {
make Perl6::Pod::raw_block($/);
}

method pod_block:sym<delimited_table>($/) {
make Perl6::Pod::table($/);
}

method pod_block:sym<paragraph>($/) {
make Perl6::Pod::any_block($/);
}
Expand All @@ -242,6 +254,10 @@ class Perl6::Actions is HLL::Actions {
make Perl6::Pod::raw_block($/);
}

method pod_block:sym<paragraph_table>($/) {
make Perl6::Pod::table($/);
}

method pod_block:sym<abbreviated>($/) {
make Perl6::Pod::any_block($/);
}
Expand All @@ -250,15 +266,14 @@ class Perl6::Actions is HLL::Actions {
make Perl6::Pod::raw_block($/);
}

method pod_block:sym<end>($/) {
method pod_block:sym<abbreviated_table>($/) {
make Perl6::Pod::table($/);
}

method pod_block:sym<delimited>($/) {
make Perl6::Pod::any_block($/);
method pod_block:sym<end>($/) {
}

method pod_block:sym<delimited_raw>($/) {
make Perl6::Pod::raw_block($/);
method raw_block($/) {
}

method pod_text_para($/) {
Expand Down Expand Up @@ -297,6 +312,14 @@ class Perl6::Actions is HLL::Actions {
make $past<compile_time_value>;
}

method table_row($/) {
make ~$/
}

method table_row_notempty($/) {
make ~$/
}

method unitstart($/) {
# Use SET_BLOCK_OUTER_CTX (inherited from HLL::Actions)
# to set dynamic outer lexical context and namespace details
Expand Down
28 changes: 28 additions & 0 deletions src/Perl6/Grammar.pm
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,24 @@ grammar Perl6::Grammar is HLL::Grammar {
]
}

token pod_block:sym<delimited_table> {
^^ \h* '=begin' \h+ 'table' <pod_newline>+
[
<table_row>+
^^ \h* '=end' \h+ 'table' <pod_newline>
|| <.panic: '=begin without matching =end'>
]
}

# XXX a bit stupid
token table_row {
\h* <!before '=' \w> \N* \n
}

token table_row_notempty {
\h* <!before '=' \w> \N+ \n
}

token pod_block:sym<end> {
^^ \h*
[
Expand Down Expand Up @@ -252,6 +270,11 @@ grammar Perl6::Grammar is HLL::Grammar {
$<pod_content> = <pod_text_para>
}

token pod_block:sym<paragraph_table> {
^^ \h* '=for' \h+ 'table' <pod_newline>
$<table_row> = <table_row_notempty>+
}

token pod_block:sym<abbreviated> {
^^
$<spaces> = [ \h* ]
Expand All @@ -269,6 +292,11 @@ grammar Perl6::Grammar is HLL::Grammar {
$<pod_content> = <pod_text_para> *
}

token pod_block:sym<abbreviated_table> {
^^ \h* '=table' <pod_newline>
$<table_row> = <table_row_notempty>+
}

token pod_newline {
\h* \n
}
Expand Down
Loading

0 comments on commit 8787be2

Please sign in to comment.