Skip to content

Commit

Permalink
Start parsing version information in use statements.
Browse files Browse the repository at this point in the history
  • Loading branch information
tene committed May 15, 2009
1 parent b41e13b commit 271bbd0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/parser/actions.pm
Expand Up @@ -400,6 +400,14 @@ method use_statement($/) {
$tags.pasttype('call');
}

## Handle versioning
my $ver;
if $<colonpair> {
$ver := PAST::Op.new( :pasttype('call'), :name('hash') );
for $<colonpair> {
$ver.push( $_.ast );
}
}
## Create a loadinit node so the use module is loaded
## when this module is loaded...
our @?BLOCK;
Expand All @@ -413,6 +421,10 @@ method use_statement($/) {
$tags.named('tags');
$use_call.push($tags);
}
if $ver {
$ver.named('ver');
$use_call.push($ver);
}
@?BLOCK[0].loadinit().push($use_call);

## ...and load it immediately to get its BEGIN semantics and
Expand Down
2 changes: 1 addition & 1 deletion src/parser/grammar.pg
Expand Up @@ -342,7 +342,7 @@ rule for_statement {
}

rule use_statement {
$<sym>=[use] <name>
$<sym>=[use] <name><colonpair>*
<EXPR>?
{*}
}
Expand Down

0 comments on commit 271bbd0

Please sign in to comment.