Skip to content

Commit

Permalink
Merge branch 'nom' into moar-support
Browse files Browse the repository at this point in the history
Conflicts:
	tools/build/Makefile-JVM.in
  • Loading branch information
jnthn committed Oct 25, 2013
2 parents 0738b78 + f127a17 commit e86d7b2
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 117 deletions.
4 changes: 2 additions & 2 deletions Configure.pl
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
for my $b (split /,\s*/, $options{backends}) {
$b = lc $b;
unless ($known_backends{$b}) {
die "Uknown backend '$b'; Supported backends are: ",
join(", ", sort keys %backends),
die "Unknown backend '$b'; Supported backends are: " .
join(", ", sort keys %known_backends) .
"\n";
}
$backends{$b} = 1;
Expand Down
17 changes: 0 additions & 17 deletions LHF.markdown

This file was deleted.

1 change: 0 additions & 1 deletion docs/ROADMAP
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Operators
Regexes
2 ** ~~ inside regexes
2 * Null pattern detection (at parse time)
2 * :sigspace ignores leading whitespace
3 ** <*foo>
3 ** <~~0>, <~~foo>
3 *** explicit backtracking control (::, :::)
Expand Down
1 change: 1 addition & 0 deletions gen/jvm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
1 change: 1 addition & 0 deletions gen/parrot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
10 changes: 5 additions & 5 deletions src/Perl6/Actions.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -2953,7 +2953,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
QAST::SVal.new( :value($name) ));
$coderef := regex_coderef($/, $*DECLARAND, $proto_body, $*SCOPE, $name, %sig_info, $*CURPAD, $<trait>, :proto(1));
} else {
$coderef := regex_coderef($/, $*DECLARAND, $<nibble>.ast, $*SCOPE, $name, %sig_info, $*CURPAD, $<trait>);
$coderef := regex_coderef($/, $*DECLARAND, $<nibble>.ast, $*SCOPE, $name, %sig_info, $*CURPAD, $<trait>) if $<nibble>.ast;
}

# Install &?ROUTINE.
Expand Down Expand Up @@ -5381,7 +5381,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
my %sig_info := hash(parameters => []);
my $block := QAST::Block.new(QAST::Stmts.new, QAST::Stmts.new, :node($/));
my $coderef := regex_coderef($/, $*W.stub_code_object('Regex'),
$<nibble>.ast, 'anon', '', %sig_info, $block, :use_outer_match(1));
$<nibble>.ast, 'anon', '', %sig_info, $block, :use_outer_match(1)) if $<nibble>.ast;
# Return closure if not in sink context.
my $closure := block_closure($coderef);
$closure<sink_past> := QAST::Op.new( :op<callmethod>, :name<Bool>, $closure);
Expand All @@ -5393,7 +5393,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
self.handle_and_check_adverbs($/, %SHARED_ALLOWED_ADVERBS, 'rx', $block);
my %sig_info := hash(parameters => []);
my $coderef := regex_coderef($/, $*W.stub_code_object('Regex'),
$<quibble>.ast, 'anon', '', %sig_info, $block, :use_outer_match(1));
$<quibble>.ast, 'anon', '', %sig_info, $block, :use_outer_match(1)) if $<quibble>.ast;
my $past := block_closure($coderef);
$past<sink_past> := QAST::Op.new(:op<callmethod>, :name<Bool>, $past);
make $past;
Expand All @@ -5402,7 +5402,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
my $block := QAST::Block.new(QAST::Stmts.new, QAST::Stmts.new, :node($/));
my %sig_info := hash(parameters => []);
my $coderef := regex_coderef($/, $*W.stub_code_object('Regex'),
$<quibble>.ast, 'anon', '', %sig_info, $block, :use_outer_match(1));
$<quibble>.ast, 'anon', '', %sig_info, $block, :use_outer_match(1)) if $<quibble>.ast;

my $past := QAST::Op.new(
:node($/),
Expand Down Expand Up @@ -5461,7 +5461,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
my $rx_block := QAST::Block.new(QAST::Stmts.new, QAST::Stmts.new, :node($/));
my %sig_info := hash(parameters => []);
my $rx_coderef := regex_coderef($/, $*W.stub_code_object('Regex'),
$<sibble><left>.ast, 'anon', '', %sig_info, $rx_block, :use_outer_match(1));
$<sibble><left>.ast, 'anon', '', %sig_info, $rx_block, :use_outer_match(1)) if $<sibble><left>.ast;

# Quote needs to be closure-i-fied.
my $closure := block_closure(make_thunk_ref($<sibble><right>.ast, $<sibble><right>));
Expand Down
133 changes: 69 additions & 64 deletions src/Perl6/Grammar.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,15 +1000,15 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
}
}

token statementlist {
rule statementlist {
:my %*LANG := self.shallow_copy(nqp::getlexdyn('%*LANG'));
:my %*HOW := self.shallow_copy(nqp::getlexdyn('%*HOW'));
:dba('statement list')
:s
''
[
| $
| <?before <[\)\]\}]>>
| [<statement><.eat_terminator> ]*
| [ <statement> <.eat_terminator> ]*
]
}

Expand Down Expand Up @@ -1152,10 +1152,10 @@ grammar Perl6::Grammar is HLL::Grammar does STD {

## Statement control

proto token statement_control { <...> }
proto rule statement_control { <...> }

token statement_control:sym<if> {
<sym> <.end_keyword> :s
rule statement_control:sym<if> {
<sym><.end_keyword> {}
<xblock>
[
[
Expand All @@ -1167,19 +1167,19 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
[ 'else'\s <else=.pblock> ]**0..1
}

token statement_control:sym<unless> {
<sym> <.end_keyword> :s
rule statement_control:sym<unless> {
<sym><.end_keyword> {}
<xblock>
[ <!before 'else'> || <.typed_panic: 'X::Syntax::UnlessElse'> ]
}

token statement_control:sym<while> {
$<sym>=[while|until] <.end_keyword> :s
rule statement_control:sym<while> {
$<sym>=[while|until]<.end_keyword> {}
<xblock>
}

token statement_control:sym<repeat> {
<sym> <.end_keyword> :s
rule statement_control:sym<repeat> {
<sym><.end_keyword> {}
[
| $<wu>=[while|until]\s <xblock>
| <pblock>
Expand All @@ -1188,23 +1188,23 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
]
}

token statement_control:sym<for> {
<sym> <.end_keyword> :s
rule statement_control:sym<for> {
<sym><.end_keyword> {}
[ <?before 'my'? '$'\w+ '(' >
<.typed_panic: 'X::Syntax::P5'> ]?
[ <?before '(' <.EXPR>? ';' <.EXPR>? ';' <.EXPR>? ')' >
<.obs('C-style "for (;;)" loop', '"loop (;;)"')> ]?
<xblock(1)>
}

token statement_control:sym<foreach> {
<sym> <.end_keyword> <.obs("'foreach'", "'for'")>
rule statement_control:sym<foreach> {
<sym><.end_keyword> <.obs("'foreach'", "'for'")>
}

token statement_control:sym<loop> {
<sym> <.end_keyword>
<sym><.end_keyword>
[ <?[({]> <.sorry: "Whitespace required after 'loop'"> ]?
:s
:s''
[ '('
<e1=.EXPR>**0..1 ';'
<e2=.EXPR>**0..1 ';'
Expand All @@ -1213,12 +1213,12 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
<block>
}

token statement_control:sym<need> {
<sym> <.ws>
rule statement_control:sym<need> {
<sym>
[
| <version>
| <module_name>
]+ % ','
] +% ','
{
for $<module_name> {
my $lnd := $*W.dissect_longname($_<longname>);
Expand Down Expand Up @@ -1366,8 +1366,8 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
}
}

token statement_control:sym<require> {
<sym> <.ws> :s
rule statement_control:sym<require> {
<sym>
[
| <module_name>
| <file=.variable>
Expand All @@ -1376,14 +1376,14 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
[ <EXPR> ]**0..1
}

token statement_control:sym<given> {
<sym> <.end_keyword> :s <xblock(1)>
rule statement_control:sym<given> {
<sym><.end_keyword> <xblock(1)>
}
token statement_control:sym<when> {
<sym> <.end_keyword> :s <xblock>
rule statement_control:sym<when> {
<sym><.end_keyword> <xblock>
}
token statement_control:sym<default> {
<sym> <.end_keyword> :s <block>
rule statement_control:sym<default> {
<sym><.end_keyword> <block>
}

rule statement_control:sym<CATCH> {<sym> <block(1)> }
Expand Down Expand Up @@ -1423,20 +1423,20 @@ grammar Perl6::Grammar is HLL::Grammar does STD {

## Statement modifiers

proto token statement_mod_cond { <...> }
proto rule statement_mod_cond { <...> }

rule modifier_expr { <EXPR> }
token modifier_expr { <EXPR> }

token statement_mod_cond:sym<if> { <sym> <modifier_expr> }
token statement_mod_cond:sym<unless> { <sym> <modifier_expr> }
token statement_mod_cond:sym<when> { <sym> <modifier_expr> }
rule statement_mod_cond:sym<if> { <sym> <modifier_expr> }
rule statement_mod_cond:sym<unless> { <sym> <modifier_expr> }
rule statement_mod_cond:sym<when> { <sym> <modifier_expr> }

proto token statement_mod_loop { <...> }
proto rule statement_mod_loop { <...> }

token statement_mod_loop:sym<while> { <sym> :s <smexpr=.EXPR> }
token statement_mod_loop:sym<until> { <sym> :s <smexpr=.EXPR> }
token statement_mod_loop:sym<for> { <sym> :s <smexpr=.EXPR> }
token statement_mod_loop:sym<given> { <sym> :s <smexpr=.EXPR> }
rule statement_mod_loop:sym<while> { <sym> <smexpr=.EXPR> }
rule statement_mod_loop:sym<until> { <sym> <smexpr=.EXPR> }
rule statement_mod_loop:sym<for> { <sym> <smexpr=.EXPR> }
rule statement_mod_loop:sym<given> { <sym> <smexpr=.EXPR> }

## Terms

Expand Down Expand Up @@ -1874,8 +1874,8 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
token package_declarator:sym<trusts> {
<sym> <.ws> <typename>
}
token package_declarator:sym<also> {
<sym>:s
rule package_declarator:sym<also> {
<sym>
[ <trait>+ || <.panic: "No valid trait found after also"> ]
}

Expand Down Expand Up @@ -2336,7 +2336,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
}

# XXX Not really implemented yet.
rule multisig {
token multisig {
:my $*SCOPE := 'my';
<signature>
}
Expand Down Expand Up @@ -2387,6 +2387,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
:suggestions($*W.suggest_typename($name.name)));
}
]
<.ws>
<trait>*
<post_constraint>*
<default_value>**0..1
Expand Down Expand Up @@ -2503,22 +2504,26 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
<regex_def>
}

rule regex_def {<.end_keyword> [
rule regex_def {
<.end_keyword>
:my $*CURPAD;
:my $*HAS_SELF := 'complete';
:my $*DECLARAND := $*W.stub_code_object('Regex');
[
<deflongname>**0..1
{ if $<deflongname> { %*RX<name> := ~$<deflongname>[0].ast } }
{ $*IN_DECL := '' }
<.newpad>
[ [ ':'?'(' <signature> ')'] | <trait> ]*
'{'[
| ['*'|'<...>'|'<*>'] <?{ $*MULTINESS eq 'proto' }> $<onlystar>={1}
|<nibble(self.quote_lang(%*RX<P5> ?? %*LANG<P5Regex> !! %*LANG<Regex>, '{', '}'))>]'}'<?ENDSTMT>
<.newpad>
[ [ ':'?'(' <signature> ')' ] | <trait> ]*
'{'
[
| ['*'|'<...>'|'<*>'] <?{ $*MULTINESS eq 'proto' }> $<onlystar>={1}
| <nibble(self.quote_lang(%*RX<P5> ?? %*LANG<P5Regex> !! %*LANG<Regex>, '{', '}'))>
]
'}'<?ENDSTMT>
{ $*CURPAD := $*W.pop_lexpad() }
] || <.malformed('regex')>
] }
}

proto token type_declarator { <...> }

Expand Down Expand Up @@ -2546,10 +2551,8 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
<?[<(«]> <term> <.ws>
}

token type_declarator:sym<subset> {
<sym> :my $*IN_DECL := 'subset';
<.end_keyword>
:s
rule type_declarator:sym<subset> {
<sym><.end_keyword> :my $*IN_DECL := 'subset';
[
[
[
Expand Down Expand Up @@ -2623,15 +2626,15 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
]
}

proto token trait_mod { <...> }
token trait_mod:sym<is> { <sym>:s <longname><circumfix>**0..1 }
token trait_mod:sym<hides> { <sym>:s <typename> }
token trait_mod:sym<does> { <sym>:s <typename> }
token trait_mod:sym<will> { <sym>:s <identifier> <pblock> }
token trait_mod:sym<of> { <sym>:s <typename> }
token trait_mod:sym<as> { <sym>:s <typename> }
token trait_mod:sym<returns> { <sym>:s <typename> }
token trait_mod:sym<handles> { <sym>:s <term> }
proto rule trait_mod { <...> }
rule trait_mod:sym<is> { <sym> <longname><circumfix>**0..1 }
rule trait_mod:sym<hides> { <sym> <typename> }
rule trait_mod:sym<does> { <sym> <typename> }
rule trait_mod:sym<will> { <sym> <identifier> <pblock> }
rule trait_mod:sym<of> { <sym> <typename> }
rule trait_mod:sym<as> { <sym> <typename> }
rule trait_mod:sym<returns> { <sym> <typename> }
rule trait_mod:sym<handles> { <sym> <term> }


## Terms
Expand Down Expand Up @@ -4159,16 +4162,18 @@ grammar Perl6::RegexGrammar is QRegex::P6Regex::Grammar does STD {
|| { self.check_variable($<var>) }
[ <?before '.'? <[ \[ \{ \< ]>> <.worry: "Apparent subscript will be treated as regex"> ]?
]
<.SIGOK>
}

token metachar:sym<qw> {
<?before '<' \s > # (note required whitespace)
'<' <nibble(self.quote_lang(%*LANG<Q>, "<", ">", ['q', 'w']))> '>'
<.SIGOK>
}

token metachar:sym<'> { <?[']> <quote=.LANG('MAIN','quote')> }
token metachar:sym<'> { <?[']> <quote=.LANG('MAIN','quote')> <.SIGOK> }

token metachar:sym<"> { <?["]> <quote=.LANG('MAIN','quote')> }
token metachar:sym<"> { <?["]> <quote=.LANG('MAIN','quote')> <.SIGOK> }

token assertion:sym<{ }> {
<?[{]> <codeblock>
Expand Down
2 changes: 2 additions & 0 deletions src/core/traits.pm
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ multi trait_mod:<is>(Attribute:D $attr, |c ) {
}
multi trait_mod:<is>(Attribute:D $attr, :$rw!) {
$attr.set_rw();
warn "useless use of 'is rw' on $attr.name()" unless $attr.has_accessor;
}
multi trait_mod:<is>(Attribute:D $attr, :$readonly!) {
$attr.set_readonly();
warn "useless use of 'is readonly' on $attr.name()" unless $attr.has_accessor;
}
multi trait_mod:<is>(Attribute:D $attr, :$box_target!) {
$attr.set_box_target();
Expand Down
Loading

0 comments on commit e86d7b2

Please sign in to comment.