Permalink
Browse files

Perlito6 - method hyper syntax use >>. instead of .>>

  • Loading branch information...
1 parent 6650db6 commit f490f1ac30440292c8c16388c667b2ac17f3e2d4 @fglock committed May 4, 2012
View
@@ -28,6 +28,7 @@ dev 2012-04-12
* Perlito6 (Perl 6 compiler):
+-- updated method hyper syntax to use >>. instead of .>>
9.0 2012-04-11
View
@@ -38,12 +38,10 @@ TODO list for Perlito6
- any Perl6 should be able to execute Perlito6 directly. What do we need to fix?
--- rakudo: replace .>> with >>.
+-- rakudo:
- [13:16] <fglock> r: method emit_perl6 { @.or_list.>>emit_perl6() }
- [13:16] <+p6eval> rakudo 2d2584: OUTPUT«===SORRY!===␤Unable to parse blockoid, couldn't find final '}'
- [13:17] <jnthn> r: method emit_perl6 { @.or_list>>.emit_perl6() }
- [13:17] <+p6eval> rakudo 2d2584: OUTPUT«Useless declaration of a has-scoped method in mainline␤»
+ =begin must be followed by an identifier; (did you mean "=begin pod"?)
+ at src6/lib/Perlito6/Emitter/Token.pm:331
-- rakudo: use "augment" to add new methods to classes
View
@@ -6743,7 +6743,7 @@ List_a.push((function () { var tmp = {v_decl: scalar((function () { if (v_MATCH
})()), function () { return 1; })); })));
})()); }), function () { return ((function () {
(v_MATCH.v_to = v_pos1);
- return((and(and(and((and(('.' == (v_str || "").substr(v_MATCH.to(), 1)), function () { return ((v_MATCH.v_to = add(1, v_MATCH.to()))); })), function () { return ((function () {
+ return((and(and(and(((function () {
var v_m2 = null;
(v_m2 = v_grammar.hyper_op(v_str, v_MATCH.to()));
@@ -6755,7 +6755,7 @@ List_a.push((function () { var tmp = {v_decl: scalar((function () { if (v_MATCH
else { return (function () {
return(false);
})(); };
-})()); }), function () { return ((function () {
+})()), function () { return (and(('.' == (v_str || "").substr(v_MATCH.to(), 1)), function () { return ((v_MATCH.v_to = add(1, v_MATCH.to()))); })); }), function () { return ((function () {
var v_m2 = null;
(v_m2 = Perlito6$Grammar.ident(v_str, v_MATCH.to()));
@@ -1217,7 +1217,7 @@ package GLOBAL;
}) || 1))))
})) || (do {
(($MATCH)->{to} = $pos1);
- ((((((('.' eq substr($str, $MATCH->to(), 1)) && ((($MATCH)->{to} = (1 + $MATCH->to()))))) && (do {
+ (((((do {
((my $m2) = $grammar->hyper_op($str, $MATCH->to()));
if ($m2) {
(($MATCH)->{to} = $m2->to());
@@ -1227,7 +1227,7 @@ package GLOBAL;
else {
0
}
-})) && (do {
+}) && ((('.' eq substr($str, $MATCH->to(), 1)) && ((($MATCH)->{to} = (1 + $MATCH->to())))))) && (do {
((my $m2) = Perlito6::Grammar->ident($str, $MATCH->to()));
if ($m2) {
(($MATCH)->{to} = $m2->to());
@@ -259,7 +259,7 @@ class Call {
my $arguments = '';
if @.arguments {
- $arguments = (@.arguments.>>emit_clojure).join(' ');
+ $arguments = (@.arguments>>.emit_clojure).join(' ');
}
my $invocant = $.invocant.emit_clojure;
@@ -331,7 +331,7 @@ class Apply {
my $code = $ns ~ $.code;
my $args = '';
if @.arguments {
- $args = (@.arguments.>>emit_clojure).join(' ');
+ $args = (@.arguments>>.emit_clojure).join(' ');
}
if $code eq 'self' { return 'sv-self' };
@@ -104,21 +104,21 @@ class Rul::Or {
method emit_perl6 {
'(do { ' ~
'my $pos1 = $MATCH.to; (do { ' ~
- (@.or_list.>>emit_perl6).join('}) || (do { $MATCH.to = $pos1; ') ~
+ (@.or_list>>.emit_perl6).join('}) || (do { $MATCH.to = $pos1; ') ~
'}) })';
}
method set_captures_to_array {
- @.or_list.>>set_captures_to_array;
+ @.or_list>>.set_captures_to_array;
}
}
class Rul::Concat {
has @.concat;
method emit_perl6 {
- '(' ~ (@.concat.>>emit_perl6).join(' && ') ~ ')';
+ '(' ~ (@.concat>>.emit_perl6).join(' && ') ~ ')';
}
method set_captures_to_array {
- @.concat.>>set_captures_to_array;
+ @.concat>>.set_captures_to_array;
}
}
@@ -407,7 +407,8 @@ class Perlito6::Expression {
{ make [ 'term', $$<Perlito6::Grammar.grammar> ] }
| <Perlito6::Grammar.declarator> <.Perlito6::Grammar.ws> <Perlito6::Grammar.opt_type> <.Perlito6::Grammar.opt_ws> <Perlito6::Grammar.var_ident> # my Int $variable
{ make [ 'term', Decl.new( decl => $$<Perlito6::Grammar.declarator>, type => $$<Perlito6::Grammar.opt_type>, var => $$<Perlito6::Grammar.var_ident> ) ] }
- | '.' <hyper_op> <Perlito6::Grammar.ident>
+
+ | <hyper_op> '.' <Perlito6::Grammar.ident>
[ ':' <.Perlito6::Grammar.ws>? <list_parse>
{ make [ 'postfix_or_term', 'methcall', ~$<Perlito6::Grammar.ident>, $$<list_parse>, $$<hyper_op> ] }
| '(' <paren_parse> ')'
@@ -423,6 +424,7 @@ class Perlito6::Expression {
}
| { make [ 'postfix_or_term', 'methcall_no_params', ~$<Perlito6::Grammar.ident>, $$<hyper_op> ] }
]
+
| <Perlito6::Grammar.optional_namespace_before_ident> <Perlito6::Grammar.ident>
[ <.Perlito6::Grammar.ws> <list_parse>
{ make [ 'postfix_or_term', 'funcall',
@@ -500,7 +500,7 @@ class Call {
}
else {
# ((*v_a).(function_er).f_function(Capture{}))
- return '((*' ~ $invocant ~ ').(function_er).f_function( Capture{ p : []*Any{ ' ~ (@.arguments.>>emit_go).join(', ') ~ ' } } ))';
+ return '((*' ~ $invocant ~ ').(function_er).f_function( Capture{ p : []*Any{ ' ~ (@.arguments>>.emit_go).join(', ') ~ ' } } ))';
}
};
@@ -517,7 +517,7 @@ class Call {
}
return
'(*' ~ $invocant ~ ').(' ~ $meth ~ '_er).f_' ~ $meth
- ~ '( Capture{ p : []*Any{ ' ~ (@.arguments.>>emit_go).join(', ') ~ ' } } )';
+ ~ '( Capture{ p : []*Any{ ' ~ (@.arguments>>.emit_go).join(', ') ~ ' } } )';
}
@@ -538,7 +538,7 @@ class Apply {
if $code.isa( 'Str' ) { }
else {
- return '(' ~ $.code.emit_go ~ ')->(' ~ (@.arguments.>>emit).join(', ') ~ ')';
+ return '(' ~ $.code.emit_go ~ ')->(' ~ (@.arguments>>.emit).join(', ') ~ ')';
};
if $code eq 'self' { return 'v_self' };
@@ -547,7 +547,7 @@ class Apply {
if $code eq 'make' {
return
'func () *Any { '
- ~ 'tmp := ' ~ (@.arguments.>>emit_go).join(', ') ~ '; '
+ ~ 'tmp := ' ~ (@.arguments>>.emit_go).join(', ') ~ '; '
~ '*(*v_MATCH).(capture_er).f_capture(Capture{}) = *tmp; '
~ 'return tmp; '
~ '}()';
@@ -560,47 +560,47 @@ class Apply {
}
if $code eq 'say' { return 'f_print( Capture{ p : []*Any{ '
- ~ (@.arguments.>>emit_go).join(', ')
+ ~ (@.arguments>>.emit_go).join(', ')
~ ', toStr("\n") } } )'
}
if $code eq 'print' { return 'f_print( Capture{ p : []*Any{ '
- ~ (@.arguments.>>emit_go).join(', ')
+ ~ (@.arguments>>.emit_go).join(', ')
~ ' } } )'
}
if $code eq 'warn' { return 'f_print_stderr( Capture{ p : []*Any{ '
- ~ (@.arguments.>>emit_go).join(', ')
+ ~ (@.arguments>>.emit_go).join(', ')
~ ', toStr("\n") } } )'
}
if $code eq 'die' { return 'f_die( Capture{ p : []*Any{ '
- ~ (@.arguments.>>emit_go).join(', ')
+ ~ (@.arguments>>.emit_go).join(', ')
~ ' } } )'
}
if $code eq 'defined' { return 'f_defined( Capture{ p : []*Any{ '
- ~ (@.arguments.>>emit_go).join(', ')
+ ~ (@.arguments>>.emit_go).join(', ')
~ ' } } )'
}
if $code eq 'pop' { return 'f_pop( Capture{ p : []*Any{ '
- ~ (@.arguments.>>emit_go).join(', ')
+ ~ (@.arguments>>.emit_go).join(', ')
~ ' } } )'
}
if $code eq 'push' { return 'f_push( Capture{ p : []*Any{ '
- ~ (@.arguments.>>emit_go).join(', ')
+ ~ (@.arguments>>.emit_go).join(', ')
~ ' } } )'
}
if $code eq 'shift' { return 'f_shift( Capture{ p : []*Any{ '
- ~ (@.arguments.>>emit_go).join(', ')
+ ~ (@.arguments>>.emit_go).join(', ')
~ ' } } )'
}
if $code eq 'index' { return 'f_index( Capture{ p : []*Any{ '
- ~ (@.arguments.>>emit_go).join(', ')
+ ~ (@.arguments>>.emit_go).join(', ')
~ ' } } )'
}
if $code eq 'substr' { return 'f_substr( Capture{ p : []*Any{ '
- ~ (@.arguments.>>emit_go).join(', ')
+ ~ (@.arguments>>.emit_go).join(', ')
~ ' } } )'
}
if $code eq 'scalar' { return 'f_scalar( Capture{ p : []*Any{ '
- ~ (@.arguments.>>emit_go).join(', ')
+ ~ (@.arguments>>.emit_go).join(', ')
~ ' } } )'
}
if $code eq 'Int' { return 'toInt('
@@ -624,7 +624,7 @@ class Apply {
if $code eq 'prefix:<!>' { return 'toBool(!tobool(' ~ ( @.arguments[0]).emit_go ~ '))' };
if $code eq 'prefix:<?>' { return Call::emit_go_call( @.arguments[0], 'Bool') }
if $code eq 'prefix:<$>' { return 'f_scalar( Capture{ p : []*Any{ '
- ~ (@.arguments.>>emit_go).join(', ')
+ ~ (@.arguments>>.emit_go).join(', ')
~ ' } } )'
}
if $code eq 'prefix:<@>' { return Call::emit_go_call( @.arguments[0], 'array' ) }
@@ -636,17 +636,17 @@ class Apply {
~ ')'
}
if $code eq 'infix:<+>' { return 'f_add( '
- ~ (@.arguments.>>emit_go).join(', ') ~ ')' }
+ ~ (@.arguments>>.emit_go).join(', ') ~ ')' }
if $code eq 'infix:<->' { return 'f_sub( '
- ~ (@.arguments.>>emit_go).join(', ') ~ ')' }
+ ~ (@.arguments>>.emit_go).join(', ') ~ ')' }
if $code eq 'infix:<*>' { return 'f_mul( '
- ~ (@.arguments.>>emit_go).join(', ') ~ ')' }
+ ~ (@.arguments>>.emit_go).join(', ') ~ ')' }
if $code eq 'infix:</>' { return 'f_div( '
- ~ (@.arguments.>>emit_go).join(', ') ~ ')' }
+ ~ (@.arguments>>.emit_go).join(', ') ~ ')' }
if $code eq 'infix:<>>' { return 'f_greater( '
- ~ (@.arguments.>>emit_go).join(', ') ~ ')' }
+ ~ (@.arguments>>.emit_go).join(', ') ~ ')' }
if $code eq 'infix:<<>' { return 'f_smaller( '
- ~ (@.arguments.>>emit_go).join(', ') ~ ')' }
+ ~ (@.arguments>>.emit_go).join(', ') ~ ')' }
if $code eq 'infix:<>=>' { return 'toBool( '
~ 'toint(' ~ (@.arguments[0]).emit_go ~ ') >= '
~ 'toint(' ~ (@.arguments[1]).emit_go ~ ') '
@@ -712,7 +712,7 @@ class Apply {
else {
$code = 'this_namespace.' ~ $code;
}
- $code ~ '( Capture{ p : []*Any{ ' ~ (@.arguments.>>emit_go).join(', ') ~ ' } } )';
+ $code ~ '( Capture{ p : []*Any{ ' ~ (@.arguments>>.emit_go).join(', ') ~ ' } } )';
}
}
@@ -49,7 +49,7 @@ class IO {
class Main {
sub lisp_dump_object ( $class_name, $data ) {
- return $class_name ~ '( ' ~ ($data.>>perl).join(', ') ~ ' )';
+ return $class_name ~ '( ' ~ ($data>>.perl).join(', ') ~ ' )';
}
}
@@ -207,7 +207,7 @@ token val_buf {
make Apply.new(
namespace => '',
code => 'list:<~>',
- arguments => ($<double_quoted_buf>).>>capture,
+ arguments => ($<double_quoted_buf>)>>.capture,
)
}
}
@@ -226,7 +226,7 @@ token val_int {
token exp_stmts {
<Perlito6::Expression.delimited_statement>*
- { make $<Perlito6::Expression.delimited_statement>.>>capture }
+ { make $<Perlito6::Expression.delimited_statement>>>.capture }
}
token opt_name { <ident>? }
Oops, something went wrong.

0 comments on commit f490f1a

Please sign in to comment.