Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement quietly { ... }.
  • Loading branch information
jnthn committed Jun 6, 2015
1 parent 8363bbd commit 57ab27a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
10 changes: 9 additions & 1 deletion src/Perl6/Actions.nqp
Expand Up @@ -1508,7 +1508,6 @@ Compilation unit '$file' contained the following violations:
}

method statement_prefix:sym<once>($/) {

# create state variable to remember whether we ran the block
my $pad := $*W.cur_lexpad();
my $sym := $pad.unique('once_');
Expand Down Expand Up @@ -1601,6 +1600,15 @@ Compilation unit '$file' contained the following violations:
make $past;
}

method statement_prefix:sym<quietly>($/) {
make QAST::Op.new(
:op('handle'),
QAST::Op.new( :op('call'), $<blorst>.ast ),
'WARN',
QAST::Op.new( :op('resume'), QAST::Op.new( :op('exception') ) )
);
}

method blorst($/) {
my $block;
if $<block> {
Expand Down
19 changes: 10 additions & 9 deletions src/Perl6/Grammar.nqp
Expand Up @@ -1534,18 +1534,19 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
token statement_prefix:sym<PRE> { <sym><.kok> <blorst> }
token statement_prefix:sym<POST> { <sym><.kok> <blorst> }

token statement_prefix:sym<eager> { <sym><.kok> <blorst> }
token statement_prefix:sym<lazy> { <sym><.kok> <blorst> }
token statement_prefix:sym<sink> { <sym><.kok> <blorst> }
token statement_prefix:sym<try> {
token statement_prefix:sym<eager> { <sym><.kok> <blorst> }
token statement_prefix:sym<lazy> { <sym><.kok> <blorst> }
token statement_prefix:sym<sink> { <sym><.kok> <blorst> }
token statement_prefix:sym<try> {
:my %*PRAGMAS := self.shallow_copy(nqp::getlexdyn('%*PRAGMAS'));
<sym><.kok> { %*PRAGMAS<fatal> := 1; } <blorst>
}
token statement_prefix:sym<gather>{ <sym><.kok> <blorst> }
token statement_prefix:sym<once> { <sym><.kok> <blorst> }
token statement_prefix:sym<start> { <sym><.kok> <blorst> }
token statement_prefix:sym<do> { <sym><.kok> <blorst> }
token statement_prefix:sym<DOC> {
token statement_prefix:sym<quietly> { <sym><.kok> <blorst> }
token statement_prefix:sym<gather> { <sym><.kok> <blorst> }
token statement_prefix:sym<once> { <sym><.kok> <blorst> }
token statement_prefix:sym<start> { <sym><.kok> <blorst> }
token statement_prefix:sym<do> { <sym><.kok> <blorst> }
token statement_prefix:sym<DOC> {
<sym><.kok> $<phase>=['BEGIN' || 'CHECK' || 'INIT']<.end_keyword><.ws>
<blorst>
}
Expand Down

0 comments on commit 57ab27a

Please sign in to comment.