Skip to content

Commit

Permalink
Update the tutorial's example code for the 'var' declaration's action…
Browse files Browse the repository at this point in the history
… methods.
  • Loading branch information
tcurtis committed Jul 17, 2010
1 parent 2c16e27 commit 2462f25
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/tutorial_episode_5.pod
Expand Up @@ -102,9 +102,9 @@ initialization expression. If the latter is missing, the variable's value
defaults to the undefined value called "Undef". Let's see what the parse action
looks like:

method variable_declaration($/) {
method statement:sym<var>($/) {
# get the PAST for the identifier
my $past := $( $<identifier> );
my $past := $<identifier>.ast;

# this is a local (it's being defined)
$past.scope('lexical');
Expand All @@ -116,7 +116,7 @@ looks like:
if $<expression> {
# use the viviself clause to add a
# an initialization expression
$past.viviself( $( $<expression>[0] );
$past.viviself($<expression>[0].ast);
}
else { # no initialization, default to "Undef"
$past.viviself('Undef');
Expand Down

0 comments on commit 2462f25

Please sign in to comment.