Skip to content

Commit

Permalink
Make macro/quasi experimental.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Dec 9, 2015
1 parent c769890 commit 2f91998
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/experimental.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ package EXPORT::cached {

OUR::{'&trait_mod:<is>'} := &trait_mod:<is>;
}

package EXPORT::macros {
OUR::<EXPERIMENTAL-MACROS> := True;
}
7 changes: 7 additions & 0 deletions src/Perl6/Grammar.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,11 @@ role STD {
self.typed_panic('X::Comp::NYI', :$feature)
}

token experimental($feature) {
<?{ try $*W.find_symbol(['EXPERIMENTAL-' ~ nqp::uc($feature)]) }>
|| <.typed_panic('X::Experimental', :$feature)>
}

method EXPR_nonassoc($cur, $left, $right) {
self.typed_panic('X::Syntax::NonAssociative', :left(~$left), :right(~$right));
}
Expand Down Expand Up @@ -2608,6 +2613,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
:my $*IN_DECL := 'macro';
:my $*IMPLICIT := 0;
:my $*DOC := $*DECLARATOR_DOCS;
<.experimental('macros')>
{ $*DECLARATOR_DOCS := '' }
:my $*POD_BLOCK;
:my $*DECLARAND := $*W.stub_code_object('Macro');
Expand Down Expand Up @@ -3605,6 +3611,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
<sym> <.ws> <![(]>
:my $*IN_QUASI := 1;
:my @*UNQUOTE_ASTS := [];
<.experimental('macros')>
<block>
}

Expand Down
4 changes: 4 additions & 0 deletions src/core/Exception.pm
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,10 @@ my class X::NYI::Available is X::NYI {
"Please install { self.available-str } for $.feature support. "
}
}
my class X::Experimental does X::Comp {
has $.feature;
method message() { "Use of $.feature is experimental; please 'use experimental :$.feature'" }
}

my class X::Worry is Exception { }
my class X::Worry::P5 is X::Worry { }
Expand Down

0 comments on commit 2f91998

Please sign in to comment.