1 # Copyright (C) 2008, The Perl Foundation.
6 Markdown::Grammar::Actions - ast transformations for Markdown
8 This file contains the methods that are used by the parse grammar
9 to build the PAST representation of an Markdown program.
10 Each method below corresponds to a rule in F<src/parser/grammar.pg>,
11 and is invoked at the point where C<{*}> appears in the rule,
12 with the current match object as the first argument. If the
13 line containing C<{*}> also has a C<#= key> comment, then the
14 value of the comment is passed as the second argument to the method.
20 class Markdown
::Grammar
::Actions
;
23 my $past := Markdown
::Document
.new
( :node
( $/ ) );
25 $past.push( $( $_ ) );
31 method Block
($/, $key) {
35 method AtxHeading
($/) {
36 make Markdown
::Header
.new
(
37 :level
( ~$<AtxStart
>.length() ),
38 :text
( ~$<AtxInline
> ),
43 make Markdown
::Para
.new
( :text
( ~$<Inline
> ) );
49 # cperl-indent-level: 4
52 # vim: expandtab shiftwidth=4: