Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Perlito5 - cleanup parenthesis

  • Loading branch information...
commit 4b15a006c35aaf6659f1c3afdcdcd75103d666e0 1 parent 1cb513e
@fglock authored
View
11 TODO-perlito5
@@ -16,13 +16,6 @@ TODO list for Perlito5
-- add "require"
-* source code - remove Perl 6 code
-
--- "token"
-
--- for @x {...} --> for (@x) {...}
-
-
* libraries
-- these should probably go into namespace Perlito5X::*
@@ -51,6 +44,8 @@ TODO list for Perlito5
-- TODO move "CallSub" to last argument in order to get some more compatibility with native js
+-- in the browser: implement "use" with XMLHttpRequest
+
* Python backend
@@ -77,5 +72,7 @@ TODO list for Perlito5
-- finish "overload" implementation
+-- source code - remove Perl 6 code such as "token"
+
-- much more!
View
76 html/perlito5.js
@@ -7843,7 +7843,7 @@ if (typeof Perlito5$Expression !== 'object') {
throw(v_o);;
})(); };
(v_stmt = v_stmts[0]);
- if ( bool(((((v__NAMESPACE.ref || CORE.ref)(CallSub, v_stmt) == 'Var')))) ) { (function () {
+ if ( bool((((v__NAMESPACE.ref || CORE.ref)(CallSub, v_stmt) == 'Var'))) ) { (function () {
throw((function () { if (Lit$Hash.new ) { return Lit$Hash.new('hash1', (function () {
var List_a = [];
@@ -7860,10 +7860,10 @@ if (typeof Perlito5$Expression !== 'object') {
return(List_a);
})()}; tmp._class_ = Lit$Hash; return tmp; })());;
})(); };
- if ( bool((( bool(((((v__NAMESPACE.ref || CORE.ref)(CallSub, v_stmt) == 'Apply')))) ? false : true))) ) { (function () {
+ if ( bool((((v__NAMESPACE.ref || CORE.ref)(CallSub, v_stmt) != 'Apply'))) ) { (function () {
throw(v_o);;
})(); };
- if ( bool(((((v_stmt._class_ && v_stmt._class_.code) || v_stmt.code).call(v_stmt)) == 'infix:<=>>')) ) { (function () {
+ if ( bool(((((v_stmt._class_ && v_stmt._class_.code) || v_stmt.code).call(v_stmt) == 'infix:<=>>'))) ) { (function () {
throw((function () { if (Lit$Hash.new ) { return Lit$Hash.new('hash1', (function () {
var List_a = [];
@@ -7880,10 +7880,10 @@ if (typeof Perlito5$Expression !== 'object') {
return(List_a);
})()}; tmp._class_ = Lit$Hash; return tmp; })());;
})(); };
- if ( bool(((((v_stmt._class_ && v_stmt._class_.code) || v_stmt.code).call(v_stmt)) != 'list:<,>')) ) { (function () {
+ if ( bool(((((v_stmt._class_ && v_stmt._class_.code) || v_stmt.code).call(v_stmt) != 'list:<,>'))) ) { (function () {
throw(v_o);;
})(); };
- (function (a_) { for (var i_ = 0; i_ < a_.length ; i_++) { (function (v_item) { if ( bool((and((((v__NAMESPACE.ref || CORE.ref)(CallSub, v_item) == 'Apply')), function () { return ((((v_item._class_ && v_item._class_.code) || v_item.code).call(v_item)) == 'infix:<=>>'); }))) ) { (function () {
+ (function (a_) { for (var i_ = 0; i_ < a_.length ; i_++) { (function (v_item) { if ( bool((and(((v__NAMESPACE.ref || CORE.ref)(CallSub, v_item) == 'Apply'), function () { return (((v_item._class_ && v_item._class_.code) || v_item.code).call(v_item) == 'infix:<=>>'); }))) ) { (function () {
throw((function () { if (Lit$Hash.new ) { return Lit$Hash.new('hash1', (v__NAMESPACE.expand_list || CORE.expand_list)(CallSub, v_stmt)); } var tmp = {hash1: (v__NAMESPACE.expand_list || CORE.expand_list)(CallSub, v_stmt)}; tmp._class_ = Lit$Hash; return tmp; })());;
})(); };; })(a_[i_]) } })((((v_stmt._class_ && v_stmt._class_.arguments) || v_stmt.arguments).call(v_stmt)));
throw(v_o);;
@@ -8043,7 +8043,7 @@ if (typeof Perlito5$Expression !== 'object') {
if ( bool(((v_v[1] == 'methcall'))) ) { (function () {
var v_param_list = null;
- (v_param_list = (v__NAMESPACE.expand_list || CORE.expand_list)(CallSub, (v_v[3])['exp']));
+ (v_param_list = (v__NAMESPACE.expand_list || CORE.expand_list)(CallSub, v_v[3]['exp']));
(v_v = (function () { if (Call.new ) { return Call.new('invocant', v_value, 'method', v_v[2], 'arguments', v_param_list); } var tmp = {invocant: v_value,method: v_v[2],arguments: v_param_list}; tmp._class_ = Call; return tmp; })());
throw(v_v);;
})(); };
@@ -9494,7 +9494,7 @@ if (typeof Perlito5$Expression !== 'object') {
(v_last_pos = ((v_m._class_ && v_m._class_.to) || v_m.to).call(v_m));;
})(); };;
})(); };
- if ( and(and((((v_v[0]) == 'postfix_or_term')), function () { return (((v_v[1]) == 'block')); }), function () { return v_last_token_was_space; }) ) { (function () {
+ if ( bool((and(and((v_v[0] == 'postfix_or_term'), function () { return (v_v[1] == 'block'); }), function () { return v_last_token_was_space; }))) ) { (function () {
if ( bool((((((v_self._class_ && v_self._class_.has_newline_after) || v_self.has_newline_after).call(v_self,v_str,v_last_pos)._class_ && ((v_self._class_ && v_self._class_.has_newline_after) || v_self.has_newline_after).call(v_self,v_str,v_last_pos)._class_.bool) || ((v_self._class_ && v_self._class_.has_newline_after) || v_self.has_newline_after).call(v_self,v_str,v_last_pos).bool).call(((v_self._class_ && v_self._class_.has_newline_after) || v_self.has_newline_after).call(v_self,v_str,v_last_pos)))) ) { (function () {
(v_terminated = 1);
(v__NAMESPACE.push || CORE.push)(CallSub, (v_lexer_stack), (function () {
@@ -9934,7 +9934,7 @@ if (typeof Perlito5$Expression !== 'object') {
(v_last_pos = ((v_m._class_ && v_m._class_.to) || v_m.to).call(v_m));;
})(); };;
})(); };
- if ( bool((or(or(or((and((((v_v[0]) == 'postfix_or_term')), function () { return (((v_v[1]) == 'block')); })), function () { return (and((((v_v[0]) == 'term')), function () { return ((v__NAMESPACE.ref || CORE.ref)(CallSub, v_v[1]) == 'Sub'); })); }), function () { return (and((((v_v[0]) == 'term')), function () { return ((v__NAMESPACE.ref || CORE.ref)(CallSub, v_v[1]) == 'Do'); })); }), function () { return (and((((v_v[0]) == 'term')), function () { return ((v__NAMESPACE.ref || CORE.ref)(CallSub, v_v[1]) == 'CompUnit'); })); }))) ) { (function () {
+ if ( bool((or(or(or((and((v_v[0] == 'postfix_or_term'), function () { return (v_v[1] == 'block'); })), function () { return (and((v_v[0] == 'term'), function () { return ((v__NAMESPACE.ref || CORE.ref)(CallSub, v_v[1]) == 'Sub'); })); }), function () { return (and((v_v[0] == 'term'), function () { return ((v__NAMESPACE.ref || CORE.ref)(CallSub, v_v[1]) == 'Do'); })); }), function () { return (and((v_v[0] == 'term'), function () { return ((v__NAMESPACE.ref || CORE.ref)(CallSub, v_v[1]) == 'CompUnit'); })); }))) ) { (function () {
if ( bool((((((v_self._class_ && v_self._class_.has_newline_after) || v_self.has_newline_after).call(v_self,v_str,v_last_pos)._class_ && ((v_self._class_ && v_self._class_.has_newline_after) || v_self.has_newline_after).call(v_self,v_str,v_last_pos)._class_.bool) || ((v_self._class_ && v_self._class_.has_newline_after) || v_self.has_newline_after).call(v_self,v_str,v_last_pos).bool).call(((v_self._class_ && v_self._class_.has_newline_after) || v_self.has_newline_after).call(v_self,v_str,v_last_pos)))) ) { (function () {
(v_terminated = 1);
(v__NAMESPACE.push || CORE.push)(CallSub, (v_lexer_stack), (function () {
@@ -10412,7 +10412,7 @@ if (typeof Perlito5$Expression !== 'object') {
throw(v_res);;
})(); };
(v_modifier_exp = ((v_self._class_ && v_self._class_.exp_parse) || v_self.exp_parse).call(v_self,v_str,((v_modifier._class_ && v_modifier._class_.to) || v_modifier.to).call(v_modifier)));
- if ( bool((( bool((((v_modifier_exp._class_ && v_modifier_exp._class_.bool) || v_modifier_exp.bool).call(v_modifier_exp))) ? false : true))) ) { (function () {
+ if ( bool((( bool(((v_modifier_exp._class_ && v_modifier_exp._class_.bool) || v_modifier_exp.bool).call(v_modifier_exp)) ? false : true))) ) { (function () {
(v__NAMESPACE.die || CORE.die)(CallSub, ('Expected expression after ' + String.fromCharCode(39)), ((v_modifier._class_ && v_modifier._class_.flat) || v_modifier.flat).call(v_modifier), (String.fromCharCode(39)));;
})(); };
if ( bool((((v_modifier_exp._class_ && v_modifier_exp._class_.flat) || v_modifier_exp.flat).call(v_modifier_exp))['end_block']) ) { (function () {
@@ -10889,7 +10889,7 @@ if (typeof Perlito5$Expression !== 'object') {
return(List_a);
})());;
})(); };
- if ( bool((and(and((((v__NAMESPACE.ref || CORE.ref)(CallSub, v_arg[0]) == 'Apply')), function () { return ((v_last_op[0] == 'infix')); }), function () { return (((((v_arg[0])._class_ && (v_arg[0])._class_.code) || (v_arg[0]).code).call((v_arg[0])) == (('list:<' + string(v_last_op[1]) + '>')))); }))) ) { (function () {
+ if ( bool((and(and(((v__NAMESPACE.ref || CORE.ref)(CallSub, v_arg[0]) == 'Apply'), function () { return (v_last_op[0] == 'infix'); }), function () { return ((((v_arg[0]._class_ && v_arg[0]._class_.code) || v_arg[0].code).call(v_arg[0]) == ('list:<' + string(v_last_op[1]) + '>'))); }))) ) { (function () {
(v__NAMESPACE.push || CORE.push)(CallSub, (v_num_stack), (function () { if (Apply.new ) { return Apply.new('namespace', '', 'code', (((v_arg[0])._class_ && (v_arg[0])._class_.code) || (v_arg[0]).code).call((v_arg[0])), 'arguments', (function () {
var List_a = [];
@@ -12513,11 +12513,11 @@ if (typeof Perlito5$Grammar !== 'object') {
})()); }), function () { return ((function () {
var v_body = null;
- (v_body = (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['end_block']);
- if ( bool((( bool(((v_body != null))) ? false : true))) ) { (function () {
+ (v_body = ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['end_block']);
+ if ( bool((( bool((v_body != null)) ? false : true))) ) { (function () {
(v__NAMESPACE.die || CORE.die)(CallSub, ('Missing code block in ' + String.fromCharCode(39) + 'unless' + String.fromCharCode(39)));;
})(); };
- (function () { if (v_MATCH == null) { v_MATCH = {} }; return (v_MATCH[('capture')] = (function () { if (If.new ) { return If.new('cond', (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['exp'], 'body', (function () { if (Lit$Block.new ) { return Lit$Block.new('stmts', (function () {
+ (function () { if (v_MATCH == null) { v_MATCH = {} }; return (v_MATCH[('capture')] = (function () { if (If.new ) { return If.new('cond', ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['exp'], 'body', (function () { if (Lit$Block.new ) { return Lit$Block.new('stmts', (function () {
var List_a = [];
var List_v = [];
@@ -12529,7 +12529,7 @@ if (typeof Perlito5$Grammar !== 'object') {
var List_v = [];
return(List_a);
-})()}; tmp._class_ = Lit$Block; return tmp; })(), 'otherwise', v_body); } var tmp = {cond: (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['exp'],body: (function () { if (Lit$Block.new ) { return Lit$Block.new('stmts', (function () {
+})()}; tmp._class_ = Lit$Block; return tmp; })(), 'otherwise', v_body); } var tmp = {cond: ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['exp'],body: (function () { if (Lit$Block.new ) { return Lit$Block.new('stmts', (function () {
var List_a = [];
var List_v = [];
@@ -12639,9 +12639,9 @@ if (typeof Perlito5$Grammar !== 'object') {
var v_otherwise = null;
- (v_body = (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['end_block']);
+ (v_body = ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['end_block']);
(v_otherwise = (((v_MATCH[('exp2')]._class_ && v_MATCH[('exp2')]._class_.flat) || v_MATCH[('exp2')].flat).call(v_MATCH[('exp2')]))['exp']);
- if ( bool((( bool(((v_body != null))) ? false : true))) ) { (function () {
+ if ( bool((( bool((v_body != null)) ? false : true))) ) { (function () {
(v__NAMESPACE.die || CORE.die)(CallSub, ('Missing code block in ' + String.fromCharCode(39) + 'if' + String.fromCharCode(39)));;
})(); };
if ( bool((( bool(((v_otherwise != null))) ? false : true))) ) { (function () {
@@ -12650,7 +12650,7 @@ if (typeof Perlito5$Grammar !== 'object') {
if ( bool((((v__NAMESPACE.ref || CORE.ref)(CallSub, v_otherwise) == 'Lit::Hash'))) ) { (function () {
(v_otherwise = (function () { if (Lit$Block.new ) { return Lit$Block.new('stmts', ((v_otherwise._class_ && v_otherwise._class_.hash1) || v_otherwise.hash1).call(v_otherwise)); } var tmp = {stmts: ((v_otherwise._class_ && v_otherwise._class_.hash1) || v_otherwise.hash1).call(v_otherwise)}; tmp._class_ = Lit$Block; return tmp; })());;
})(); };
- (function () { if (v_MATCH == null) { v_MATCH = {} }; return (v_MATCH[('capture')] = (function () { if (If.new ) { return If.new('cond', (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['exp'], 'body', v_body, 'otherwise', v_otherwise); } var tmp = {cond: (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['exp'],body: v_body,otherwise: v_otherwise}; tmp._class_ = If; return tmp; })()); })();
+ (function () { if (v_MATCH == null) { v_MATCH = {} }; return (v_MATCH[('capture')] = (function () { if (If.new ) { return If.new('cond', ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['exp'], 'body', v_body, 'otherwise', v_otherwise); } var tmp = {cond: ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['exp'],body: v_body,otherwise: v_otherwise}; tmp._class_ = If; return tmp; })()); })();
return(1);
})()); }));
})()), function () { return ((function () {
@@ -12681,11 +12681,11 @@ if (typeof Perlito5$Grammar !== 'object') {
})()); }), function () { return ((function () {
var v_body = null;
- (v_body = (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['end_block']);
- if ( bool((( bool(((v_body != null))) ? false : true))) ) { (function () {
+ (v_body = ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['end_block']);
+ if ( bool((( bool((v_body != null)) ? false : true))) ) { (function () {
(v__NAMESPACE.die || CORE.die)(CallSub, ('Missing code block in ' + String.fromCharCode(39) + 'if' + String.fromCharCode(39)));;
})(); };
- (function () { if (v_MATCH == null) { v_MATCH = {} }; return (v_MATCH[('capture')] = (function () { if (If.new ) { return If.new('cond', (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['exp'], 'body', v_body, 'otherwise', (function () { if (Lit$Block.new ) { return Lit$Block.new('stmts', (function () {
+ (function () { if (v_MATCH == null) { v_MATCH = {} }; return (v_MATCH[('capture')] = (function () { if (If.new ) { return If.new('cond', ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['exp'], 'body', v_body, 'otherwise', (function () { if (Lit$Block.new ) { return Lit$Block.new('stmts', (function () {
var List_a = [];
var List_v = [];
@@ -12699,7 +12699,7 @@ if (typeof Perlito5$Grammar !== 'object') {
(v__NAMESPACE.push || CORE.push)(CallSub, List_a, ((v_MATCH[('if')]._class_ && v_MATCH[('if')]._class_.flat) || v_MATCH[('if')].flat).call(v_MATCH[('if')]));
return(List_a);
-})()}; tmp._class_ = Lit$Block; return tmp; })()); } var tmp = {cond: (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['exp'],body: v_body,otherwise: (function () { if (Lit$Block.new ) { return Lit$Block.new('stmts', (function () {
+})()}; tmp._class_ = Lit$Block; return tmp; })()); } var tmp = {cond: ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['exp'],body: v_body,otherwise: (function () { if (Lit$Block.new ) { return Lit$Block.new('stmts', (function () {
var List_a = [];
var List_v = [];
@@ -12721,11 +12721,11 @@ if (typeof Perlito5$Grammar !== 'object') {
return((((function () {
var v_body = null;
- (v_body = (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['end_block']);
- if ( bool((( bool(((v_body != null))) ? false : true))) ) { (function () {
+ (v_body = ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['end_block']);
+ if ( bool((( bool((v_body != null)) ? false : true))) ) { (function () {
(v__NAMESPACE.die || CORE.die)(CallSub, ('Missing code block in ' + String.fromCharCode(39) + 'if' + String.fromCharCode(39)));;
})(); };
- (function () { if (v_MATCH == null) { v_MATCH = {} }; return (v_MATCH[('capture')] = (function () { if (If.new ) { return If.new('cond', (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['exp'], 'body', v_body, 'otherwise', (function () { if (Lit$Block.new ) { return Lit$Block.new('stmts', (function () {
+ (function () { if (v_MATCH == null) { v_MATCH = {} }; return (v_MATCH[('capture')] = (function () { if (If.new ) { return If.new('cond', ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['exp'], 'body', v_body, 'otherwise', (function () { if (Lit$Block.new ) { return Lit$Block.new('stmts', (function () {
var List_a = [];
var List_v = [];
@@ -12737,7 +12737,7 @@ if (typeof Perlito5$Grammar !== 'object') {
var List_v = [];
return(List_a);
-})()}; tmp._class_ = Lit$Block; return tmp; })()); } var tmp = {cond: (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['exp'],body: v_body,otherwise: (function () { if (Lit$Block.new ) { return Lit$Block.new('stmts', (function () {
+})()}; tmp._class_ = Lit$Block; return tmp; })()); } var tmp = {cond: ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['exp'],body: v_body,otherwise: (function () { if (Lit$Block.new ) { return Lit$Block.new('stmts', (function () {
var List_a = [];
var List_v = [];
@@ -12819,11 +12819,11 @@ if (typeof Perlito5$Grammar !== 'object') {
})()); }), function () { return ((function () {
var v_body = null;
- (v_body = (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['end_block']);
- if ( bool((( bool(((v_body != null))) ? false : true))) ) { (function () {
+ (v_body = ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['end_block']);
+ if ( bool((( bool((v_body != null)) ? false : true))) ) { (function () {
(v__NAMESPACE.die || CORE.die)(CallSub, ('Missing code block in ' + String.fromCharCode(39) + 'when' + String.fromCharCode(39)));;
})(); };
- (function () { if (v_MATCH == null) { v_MATCH = {} }; return (v_MATCH[('capture')] = (function () { if (When.new ) { return When.new('parameters', (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['exp'], 'body', v_body); } var tmp = {parameters: (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['exp'],body: v_body}; tmp._class_ = When; return tmp; })()); })();
+ (function () { if (v_MATCH == null) { v_MATCH = {} }; return (v_MATCH[('capture')] = (function () { if (When.new ) { return When.new('parameters', ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['exp'], 'body', v_body); } var tmp = {parameters: ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['exp'],body: v_body}; tmp._class_ = When; return tmp; })()); })();
return(1);
})()); }));
})()));
@@ -13003,11 +13003,11 @@ if (typeof Perlito5$Grammar !== 'object') {
})()), function () { return ((function () {
var v_body = null;
- (v_body = (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['end_block']);
- if ( bool((( bool(((v_body != null))) ? false : true))) ) { (function () {
+ (v_body = ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['end_block']);
+ if ( bool((( bool((v_body != null)) ? false : true))) ) { (function () {
(v__NAMESPACE.die || CORE.die)(CallSub, ('Missing code block in ' + String.fromCharCode(39) + 'when' + String.fromCharCode(39)));;
})(); };
- (function () { if (v_MATCH == null) { v_MATCH = {} }; return (v_MATCH[('capture')] = (function () { if (For.new ) { return For.new('cond', (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['exp'], 'topic', null, 'body', v_body); } var tmp = {cond: (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['exp'],topic: null,body: v_body}; tmp._class_ = For; return tmp; })()); })();
+ (function () { if (v_MATCH == null) { v_MATCH = {} }; return (v_MATCH[('capture')] = (function () { if (For.new ) { return For.new('cond', ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['exp'], 'topic', null, 'body', v_body); } var tmp = {cond: ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['exp'],topic: null,body: v_body}; tmp._class_ = For; return tmp; })()); })();
return(1);
})()); })));
})()); }));
@@ -13077,11 +13077,11 @@ if (typeof Perlito5$Grammar !== 'object') {
})()); }), function () { return ((function () {
var v_body = null;
- (v_body = (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['end_block']);
- if ( bool((( bool(((v_body != null))) ? false : true))) ) { (function () {
+ (v_body = ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['end_block']);
+ if ( bool((( bool((v_body != null)) ? false : true))) ) { (function () {
(v__NAMESPACE.die || CORE.die)(CallSub, ('Missing code block in ' + String.fromCharCode(39) + 'while' + String.fromCharCode(39)));;
})(); };
- (function () { if (v_MATCH == null) { v_MATCH = {} }; return (v_MATCH[('capture')] = (function () { if (While.new ) { return While.new('cond', (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['exp'], 'body', v_body); } var tmp = {cond: (((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')]))['exp'],body: v_body}; tmp._class_ = While; return tmp; })()); })();
+ (function () { if (v_MATCH == null) { v_MATCH = {} }; return (v_MATCH[('capture')] = (function () { if (While.new ) { return While.new('cond', ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['exp'], 'body', v_body); } var tmp = {cond: ((v_MATCH[('exp')]._class_ && v_MATCH[('exp')]._class_.flat) || v_MATCH[('exp')].flat).call(v_MATCH[('exp')])['exp'],body: v_body}; tmp._class_ = While; return tmp; })()); })();
return(1);
})()); }));
})()));
@@ -16899,18 +16899,18 @@ if (typeof Rul$Quantifier !== 'object') {
var v_self = null;
(v_self = List__[0]);
- if ( bool((and(((v_self[('quant')] == '')), function () { return ((v_self[('greedy')] == '')); }))) ) { (function () {
+ if ( bool((and((v_self[('quant')] == ''), function () { return (v_self[('greedy')] == ''); }))) ) { (function () {
throw(((v_self[('term')]._class_ && v_self[('term')]._class_.emit_perl5) || v_self[('term')].emit_perl5).call(v_self[('term')]));;
})(); };
- if ( bool((and(((v_self[('quant')] == '+')), function () { return ((v_self[('greedy')] == '')); }))) ) { (function () {
+ if ( bool((and((v_self[('quant')] == '+'), function () { return (v_self[('greedy')] == ''); }))) ) { (function () {
((v_self[('term')]._class_ && v_self[('term')]._class_.set_captures_to_array) || v_self[('term')].set_captures_to_array).call(v_self[('term')]);
throw(('(do { ' + 'my $last_match_null = 0; ' + 'my $last_pos = $MATCH->to; ' + 'my $count = 0; ' + 'while (' + string(((v_self[('term')]._class_ && v_self[('term')]._class_.emit_perl5) || v_self[('term')].emit_perl5).call(v_self[('term')])) + ' && ($last_match_null < 2)) ' + '{ ' + 'if ($last_pos == $MATCH->to()) { ' + '$last_match_null = $last_match_null + 1; ' + '} ' + 'else { ' + '$last_match_null = 0; ' + '}; ' + '$last_pos = $MATCH->to; ' + '$count = $count + 1; ' + '}; ' + '$MATCH->{' + String.fromCharCode(34) + 'to' + String.fromCharCode(34) + '} = $last_pos; ' + '$count > 0; ' + '})'));;
})(); };
- if ( bool((and(((v_self[('quant')] == '*')), function () { return ((v_self[('greedy')] == '')); }))) ) { (function () {
+ if ( bool((and((v_self[('quant')] == '*'), function () { return (v_self[('greedy')] == ''); }))) ) { (function () {
((v_self[('term')]._class_ && v_self[('term')]._class_.set_captures_to_array) || v_self[('term')].set_captures_to_array).call(v_self[('term')]);
throw(('(do { ' + 'my $last_match_null = 0; ' + 'my $last_pos = $MATCH->to; ' + 'while (' + string(((v_self[('term')]._class_ && v_self[('term')]._class_.emit_perl5) || v_self[('term')].emit_perl5).call(v_self[('term')])) + ' && ($last_match_null < 2)) ' + '{ ' + 'if ($last_pos == $MATCH->to()) { ' + '$last_match_null = $last_match_null + 1; ' + '} ' + 'else { ' + '$last_match_null = 0; ' + '}; ' + '$last_pos = $MATCH->to; ' + '}; ' + '$MATCH->{' + String.fromCharCode(34) + 'to' + String.fromCharCode(34) + '} = $last_pos; ' + '1 ' + '})'));;
})(); };
- if ( bool((and(((v_self[('quant')] == String.fromCharCode(63))), function () { return ((v_self[('greedy')] == '')); }))) ) { (function () {
+ if ( bool((and((v_self[('quant')] == String.fromCharCode(63)), function () { return (v_self[('greedy')] == ''); }))) ) { (function () {
((v_self[('term')]._class_ && v_self[('term')]._class_.set_captures_to_array) || v_self[('term')].set_captures_to_array).call(v_self[('term')]);
throw(('(do { ' + 'my $last_pos = $MATCH->to; ' + 'if (' + String.fromCharCode(33) + '(do {' + string(((v_self[('term')]._class_ && v_self[('term')]._class_.emit_perl5) || v_self[('term')].emit_perl5).call(v_self[('term')])) + '})) ' + '{ ' + '$MATCH->{' + String.fromCharCode(34) + 'to' + String.fromCharCode(34) + '} = $last_pos; ' + '}; ' + '1 ' + '})'));;
})(); };
View
8 lib5/Perlito5/Emitter/Token.pm
@@ -88,18 +88,18 @@ package main;
sub emit_perl5 {
my $List__ = bless \@_, "ARRAY";
((my $self) = $List__->[0]);
- if ((((($self->{('quant')} eq '')) && (($self->{('greedy')} eq ''))))) {
+ if (((($self->{('quant')} eq '') && ($self->{('greedy')} eq '')))) {
return ($self->{('term')}->emit_perl5())
};
- if ((((($self->{('quant')} eq '+')) && (($self->{('greedy')} eq ''))))) {
+ if (((($self->{('quant')} eq '+') && ($self->{('greedy')} eq '')))) {
$self->{('term')}->set_captures_to_array();
return (('(do ' . chr(123) . ' ' . 'my ' . chr(36) . 'last_match_null ' . chr(61) . ' 0' . chr(59) . ' ' . 'my ' . chr(36) . 'last_pos ' . chr(61) . ' ' . chr(36) . 'MATCH->to' . chr(59) . ' ' . 'my ' . chr(36) . 'count ' . chr(61) . ' 0' . chr(59) . ' ' . 'while (' . $self->{('term')}->emit_perl5() . ' ' . chr(38) . chr(38) . ' (' . chr(36) . 'last_match_null < 2)) ' . chr(123) . ' ' . 'if (' . chr(36) . 'last_pos ' . chr(61) . chr(61) . ' ' . chr(36) . 'MATCH->to()) ' . chr(123) . ' ' . chr(36) . 'last_match_null ' . chr(61) . ' ' . chr(36) . 'last_match_null + 1' . chr(59) . ' ' . chr(125) . ' ' . 'else ' . chr(123) . ' ' . chr(36) . 'last_match_null ' . chr(61) . ' 0' . chr(59) . ' ' . chr(125) . chr(59) . ' ' . chr(36) . 'last_pos ' . chr(61) . ' ' . chr(36) . 'MATCH->to' . chr(59) . ' ' . chr(36) . 'count ' . chr(61) . ' ' . chr(36) . 'count + 1' . chr(59) . ' ' . chr(125) . chr(59) . ' ' . chr(36) . 'MATCH->' . chr(123) . chr(34) . 'to' . chr(34) . chr(125) . ' ' . chr(61) . ' ' . chr(36) . 'last_pos' . chr(59) . ' ' . chr(36) . 'count > 0' . chr(59) . ' ' . chr(125) . ')'))
};
- if ((((($self->{('quant')} eq '*')) && (($self->{('greedy')} eq ''))))) {
+ if (((($self->{('quant')} eq '*') && ($self->{('greedy')} eq '')))) {
$self->{('term')}->set_captures_to_array();
return (('(do ' . chr(123) . ' ' . 'my ' . chr(36) . 'last_match_null ' . chr(61) . ' 0' . chr(59) . ' ' . 'my ' . chr(36) . 'last_pos ' . chr(61) . ' ' . chr(36) . 'MATCH->to' . chr(59) . ' ' . 'while (' . $self->{('term')}->emit_perl5() . ' ' . chr(38) . chr(38) . ' (' . chr(36) . 'last_match_null < 2)) ' . chr(123) . ' ' . 'if (' . chr(36) . 'last_pos ' . chr(61) . chr(61) . ' ' . chr(36) . 'MATCH->to()) ' . chr(123) . ' ' . chr(36) . 'last_match_null ' . chr(61) . ' ' . chr(36) . 'last_match_null + 1' . chr(59) . ' ' . chr(125) . ' ' . 'else ' . chr(123) . ' ' . chr(36) . 'last_match_null ' . chr(61) . ' 0' . chr(59) . ' ' . chr(125) . chr(59) . ' ' . chr(36) . 'last_pos ' . chr(61) . ' ' . chr(36) . 'MATCH->to' . chr(59) . ' ' . chr(125) . chr(59) . ' ' . chr(36) . 'MATCH->' . chr(123) . chr(34) . 'to' . chr(34) . chr(125) . ' ' . chr(61) . ' ' . chr(36) . 'last_pos' . chr(59) . ' ' . '1 ' . chr(125) . ')'))
};
- if ((((($self->{('quant')} eq chr(63))) && (($self->{('greedy')} eq ''))))) {
+ if (((($self->{('quant')} eq chr(63)) && ($self->{('greedy')} eq '')))) {
$self->{('term')}->set_captures_to_array();
return (('(do ' . chr(123) . ' ' . 'my ' . chr(36) . 'last_pos ' . chr(61) . ' ' . chr(36) . 'MATCH->to' . chr(59) . ' ' . 'if (' . chr(33) . '(do ' . chr(123) . $self->{('term')}->emit_perl5() . chr(125) . ')) ' . chr(123) . ' ' . chr(36) . 'MATCH->' . chr(123) . chr(34) . 'to' . chr(34) . chr(125) . ' ' . chr(61) . ' ' . chr(36) . 'last_pos' . chr(59) . ' ' . chr(125) . chr(59) . ' ' . '1 ' . chr(125) . ')'))
};
View
20 lib5/Perlito5/Expression.pm
@@ -65,7 +65,7 @@ package main;
return ($o)
};
((my $stmt) = $stmts->[0]);
- if ((((ref($stmt) eq 'Var')))) {
+ if (((ref($stmt) eq 'Var'))) {
return (Lit::Hash->new(('hash1' => (do {
(my $List_a = bless [], 'ARRAY');
(my $List_v = bless [], 'ARRAY');
@@ -73,10 +73,10 @@ package main;
$List_a
}))))
};
- if ((!((((ref($stmt) eq 'Apply')))))) {
+ if (((ref($stmt) ne 'Apply'))) {
return ($o)
};
- if ((($stmt->code()) eq 'infix:<' . chr(61) . '>>')) {
+ if ((($stmt->code() eq 'infix:<' . chr(61) . '>>'))) {
return (Lit::Hash->new(('hash1' => (do {
(my $List_a = bless [], 'ARRAY');
(my $List_v = bless [], 'ARRAY');
@@ -84,11 +84,11 @@ package main;
$List_a
}))))
};
- if ((($stmt->code()) ne 'list:<,>')) {
+ if ((($stmt->code() ne 'list:<,>'))) {
return ($o)
};
for my $item ( @{($stmt->arguments())} ) {
- if (((((ref($item) eq 'Apply')) && (($item->code()) eq 'infix:<' . chr(61) . '>>')))) {
+ if ((((ref($item) eq 'Apply') && ($item->code() eq 'infix:<' . chr(61) . '>>')))) {
return (Lit::Hash->new(('hash1' => expand_list($stmt))))
}
};
@@ -181,7 +181,7 @@ package main;
return ($v)
};
if ((($v->[1] eq 'methcall'))) {
- ((my $param_list) = expand_list(($v->[3])->{'exp'}));
+ ((my $param_list) = expand_list($v->[3]->{'exp'}));
($v = Call->new(('invocant' => $value), ('method' => $v->[2]), ('arguments' => $param_list)));
return ($v)
};
@@ -291,7 +291,7 @@ package main;
$List_a
}))
};
- if ((((((ref($arg->[0]) eq 'Apply')) && (($last_op->[0] eq 'infix'))) && ((($arg->[0])->code() eq (('list:<' . $last_op->[1] . '>'))))))) {
+ if (((((ref($arg->[0]) eq 'Apply') && ($last_op->[0] eq 'infix')) && (($arg->[0]->code() eq ('list:<' . $last_op->[1] . '>')))))) {
push( @{($num_stack)}, Apply->new(('namespace' => ''), ('code' => ($arg->[0])->code()), ('arguments' => (do {
(my $List_a = bless [], 'ARRAY');
(my $List_v = bless [], 'ARRAY');
@@ -1401,7 +1401,7 @@ package main;
($last_pos = $m->to())
}
};
- if (((((($v->[0]) eq 'postfix_or_term')) && ((($v->[1]) eq 'block'))) && $last_token_was_space)) {
+ if ((((($v->[0] eq 'postfix_or_term') && ($v->[1] eq 'block')) && $last_token_was_space))) {
if (($self->has_newline_after($str, $last_pos)->bool())) {
($terminated = 1);
push( @{($lexer_stack)}, (do {
@@ -1588,7 +1588,7 @@ package main;
($last_pos = $m->to())
}
};
- if (((((((((($v->[0]) eq 'postfix_or_term')) && ((($v->[1]) eq 'block')))) || ((((($v->[0]) eq 'term')) && (ref($v->[1]) eq 'Sub')))) || ((((($v->[0]) eq 'term')) && (ref($v->[1]) eq 'Do')))) || ((((($v->[0]) eq 'term')) && (ref($v->[1]) eq 'CompUnit')))))) {
+ if (((((((($v->[0] eq 'postfix_or_term') && ($v->[1] eq 'block'))) || ((($v->[0] eq 'term') && (ref($v->[1]) eq 'Sub')))) || ((($v->[0] eq 'term') && (ref($v->[1]) eq 'Do')))) || ((($v->[0] eq 'term') && (ref($v->[1]) eq 'CompUnit')))))) {
if (($self->has_newline_after($str, $last_pos)->bool())) {
($terminated = 1);
push( @{($lexer_stack)}, (do {
@@ -1888,7 +1888,7 @@ package main;
return ($res)
};
((my $modifier_exp) = $self->exp_parse($str, $modifier->to()));
- if ((!(($modifier_exp->bool())))) {
+ if ((!($modifier_exp->bool()))) {
die(('Expected expression after ' . chr(39)), $modifier->flat(), (chr(39)))
};
if (($modifier_exp->flat())->{'end_block'}) {
View
42 lib5/Perlito5/Grammar/Control.pm
@@ -39,11 +39,11 @@ package main;
0
}
}))) && ((do {
- ((my $body) = ($MATCH->{('exp')}->flat())->{'end_block'});
- if ((!((defined($body))))) {
+ ((my $body) = $MATCH->{('exp')}->flat()->{'end_block'});
+ if ((!(defined($body)))) {
die(('Missing code block in ' . chr(39) . 'unless' . chr(39)))
};
- ($MATCH->{('capture')} = If->new(('cond' => ($MATCH->{('exp')}->flat())->{'exp'}), ('body' => Lit::Block->new(('stmts' => (do {
+ ($MATCH->{('capture')} = If->new(('cond' => $MATCH->{('exp')}->flat()->{'exp'}), ('body' => Lit::Block->new(('stmts' => (do {
(my $List_a = bless [], 'ARRAY');
(my $List_v = bless [], 'ARRAY');
$List_a
@@ -105,9 +105,9 @@ package main;
0
}
}))) && ((do {
- ((my $body) = ($MATCH->{('exp')}->flat())->{'end_block'});
+ ((my $body) = $MATCH->{('exp')}->flat()->{'end_block'});
((my $otherwise) = ($MATCH->{('exp2')}->flat())->{'exp'});
- if ((!((defined($body))))) {
+ if ((!(defined($body)))) {
die(('Missing code block in ' . chr(39) . 'if' . chr(39)))
};
if ((!((defined($otherwise))))) {
@@ -116,7 +116,7 @@ package main;
if (((ref($otherwise) eq 'Lit::Hash'))) {
($otherwise = Lit::Block->new(('stmts' => $otherwise->hash1())))
};
- ($MATCH->{('capture')} = If->new(('cond' => ($MATCH->{('exp')}->flat())->{'exp'}), ('body' => $body), ('otherwise' => $otherwise)));
+ ($MATCH->{('capture')} = If->new(('cond' => $MATCH->{('exp')}->flat()->{'exp'}), ('body' => $body), ('otherwise' => $otherwise)));
1
})))
})) || ((do {
@@ -141,11 +141,11 @@ package main;
0
}
}))) && ((do {
- ((my $body) = ($MATCH->{('exp')}->flat())->{'end_block'});
- if ((!((defined($body))))) {
+ ((my $body) = $MATCH->{('exp')}->flat()->{'end_block'});
+ if ((!(defined($body)))) {
die(('Missing code block in ' . chr(39) . 'if' . chr(39)))
};
- ($MATCH->{('capture')} = If->new(('cond' => ($MATCH->{('exp')}->flat())->{'exp'}), ('body' => $body), ('otherwise' => Lit::Block->new(('stmts' => (do {
+ ($MATCH->{('capture')} = If->new(('cond' => $MATCH->{('exp')}->flat()->{'exp'}), ('body' => $body), ('otherwise' => Lit::Block->new(('stmts' => (do {
(my $List_a = bless [], 'ARRAY');
(my $List_v = bless [], 'ARRAY');
push( @{$List_a}, $MATCH->{('if')}->flat() );
@@ -156,11 +156,11 @@ package main;
}))) || ((do {
($MATCH->{('to')} = $pos1);
(((do {
- ((my $body) = ($MATCH->{('exp')}->flat())->{'end_block'});
- if ((!((defined($body))))) {
+ ((my $body) = $MATCH->{('exp')}->flat()->{'end_block'});
+ if ((!(defined($body)))) {
die(('Missing code block in ' . chr(39) . 'if' . chr(39)))
};
- ($MATCH->{('capture')} = If->new(('cond' => ($MATCH->{('exp')}->flat())->{'exp'}), ('body' => $body), ('otherwise' => Lit::Block->new(('stmts' => (do {
+ ($MATCH->{('capture')} = If->new(('cond' => $MATCH->{('exp')}->flat()->{'exp'}), ('body' => $body), ('otherwise' => Lit::Block->new(('stmts' => (do {
(my $List_a = bless [], 'ARRAY');
(my $List_v = bless [], 'ARRAY');
$List_a
@@ -202,11 +202,11 @@ package main;
0
}
}))) && ((do {
- ((my $body) = ($MATCH->{('exp')}->flat())->{'end_block'});
- if ((!((defined($body))))) {
+ ((my $body) = $MATCH->{('exp')}->flat()->{'end_block'});
+ if ((!(defined($body)))) {
die(('Missing code block in ' . chr(39) . 'when' . chr(39)))
};
- ($MATCH->{('capture')} = When->new(('parameters' => ($MATCH->{('exp')}->flat())->{'exp'}), ('body' => $body)));
+ ($MATCH->{('capture')} = When->new(('parameters' => $MATCH->{('exp')}->flat()->{'exp'}), ('body' => $body)));
1
})))
}))
@@ -334,11 +334,11 @@ package main;
0
}
})) && ((do {
- ((my $body) = ($MATCH->{('exp')}->flat())->{'end_block'});
- if ((!((defined($body))))) {
+ ((my $body) = $MATCH->{('exp')}->flat()->{'end_block'});
+ if ((!(defined($body)))) {
die(('Missing code block in ' . chr(39) . 'when' . chr(39)))
};
- ($MATCH->{('capture')} = For->new(('cond' => ($MATCH->{('exp')}->flat())->{'exp'}), ('topic' => undef()), ('body' => $body)));
+ ($MATCH->{('capture')} = For->new(('cond' => $MATCH->{('exp')}->flat()->{'exp'}), ('topic' => undef()), ('body' => $body)));
1
}))))
})))
@@ -376,11 +376,11 @@ package main;
0
}
}))) && ((do {
- ((my $body) = ($MATCH->{('exp')}->flat())->{'end_block'});
- if ((!((defined($body))))) {
+ ((my $body) = $MATCH->{('exp')}->flat()->{'end_block'});
+ if ((!(defined($body)))) {
die(('Missing code block in ' . chr(39) . 'while' . chr(39)))
};
- ($MATCH->{('capture')} = While->new(('cond' => ($MATCH->{('exp')}->flat())->{'exp'}), ('body' => $body)));
+ ($MATCH->{('capture')} = While->new(('cond' => $MATCH->{('exp')}->flat()->{'exp'}), ('body' => $body)));
1
})))
}))
View
8 src5/lib/Perlito5/Emitter/Token.pm
@@ -36,10 +36,10 @@ sub ws3 { $_[0]->{'ws3'} }
sub emit_perl5 {
my $self = $_[0];
- if (($self->{"quant"} eq '') && ($self->{"greedy"} eq '')) {
+ if ($self->{"quant"} eq '' && $self->{"greedy"} eq '') {
return $self->{"term"}->emit_perl5;
}
- if (($self->{"quant"} eq '+') && ($self->{"greedy"} eq '')) {
+ if ($self->{"quant"} eq '+' && $self->{"greedy"} eq '') {
$self->{"term"}->set_captures_to_array;
return
'(do { '
@@ -61,7 +61,7 @@ sub emit_perl5 {
. '$count > 0; '
. '})';
}
- if (($self->{"quant"} eq '*') && ($self->{"greedy"} eq '')) {
+ if ($self->{"quant"} eq '*' && $self->{"greedy"} eq '') {
$self->{"term"}->set_captures_to_array;
return
'(do { '
@@ -81,7 +81,7 @@ sub emit_perl5 {
. '1 '
. '})';
}
- if (($self->{"quant"} eq '?') && ($self->{"greedy"} eq '')) {
+ if ($self->{"quant"} eq '?' && $self->{"greedy"} eq '') {
$self->{"term"}->set_captures_to_array;
return
'(do { '
View
36 src5/lib/Perlito5/Expression.pm
@@ -41,28 +41,28 @@ package Perlito5::Expression;
return $o
}
my $stmt = $stmts->[0];
- if (( ref($stmt) eq 'Var' )) {
+ if ( ref($stmt) eq 'Var' ) {
# the argument is a single variable
# say "# single var -- is hash";
return Lit::Hash->new(hash1 => [ $stmt ])
}
- if (!(( ref($stmt) eq 'Apply' ))) {
+ if ( ref($stmt) ne 'Apply' ) {
# say "# not Apply -- not hash";
return $o
}
- if ($stmt->code) eq 'infix:<=>>' {
+ if ($stmt->code eq 'infix:<=>>') {
# the argument is a single pair
# say "# single pair -- is hash";
return Lit::Hash->new(hash1 => [ $stmt ])
}
- if ($stmt->code) ne 'list:<,>' {
+ if ($stmt->code ne 'list:<,>') {
# say "# not a list -- not hash";
return $o
}
# the argument is a list -- check that it contains a pair
for my $item ( @{$stmt->arguments} ) {
# say "# item: ", $item->perl;
- if (( ref($item) eq 'Apply' ) && ($item->code) eq 'infix:<=>>') {
+ if ( ref($item) eq 'Apply' && $item->code eq 'infix:<=>>' ) {
# argument is a pair
# say "# block: ", $o->perl;
# say "# hash with args: ", ( expand_list($stmt->arguments) )->perl;
@@ -182,7 +182,7 @@ package Perlito5::Expression;
}
if ($v->[1] eq 'methcall') {
# say "# Call ", ($v->[2])->perl;
- my $param_list = expand_list(($v->[3]){'exp'});
+ my $param_list = expand_list($v->[3]{'exp'});
$v = Call->new( invocant => $value, method => $v->[2], arguments => $param_list );
return $v;
}
@@ -287,9 +287,9 @@ package Perlito5::Expression;
my $v2 = pop_term($num_stack);
$arg = [ pop_term($num_stack), $v2 ];
}
- if ( ( ref($arg->[0]) eq 'Apply' )
- && ($last_op->[0] eq 'infix')
- && (($arg->[0])->code eq ('list:<' . $last_op->[1] . '>'))
+ if ( ref($arg->[0]) eq 'Apply'
+ && $last_op->[0] eq 'infix'
+ && ($arg->[0]->code eq 'list:<' . $last_op->[1] . '>')
)
{
push @$num_stack,
@@ -531,8 +531,10 @@ package Perlito5::Expression;
# say "# list_lexer " . $v->perl;
- if (($v->[0]) eq 'postfix_or_term') && (($v->[1]) eq 'block')
+ if ( $v->[0] eq 'postfix_or_term'
+ && $v->[1] eq 'block'
&& $last_token_was_space
+ )
{
if ($self->has_newline_after($str, $last_pos)->bool) {
# a block followed by newline terminates the expression
@@ -677,10 +679,10 @@ package Perlito5::Expression;
}
# say "# exp_lexer got " . $v->perl;
- if ( ( (($v->[0]) eq 'postfix_or_term') && (($v->[1]) eq 'block') )
- || ( (($v->[0]) eq 'term') && ref($v->[1]) eq 'Sub' )
- || ( (($v->[0]) eq 'term') && ref($v->[1]) eq 'Do' )
- || ( (($v->[0]) eq 'term') && ref($v->[1]) eq 'CompUnit' )
+ if ( ( $v->[0] eq 'postfix_or_term' && $v->[1] eq 'block' )
+ || ( $v->[0] eq 'term' && ref($v->[1]) eq 'Sub' )
+ || ( $v->[0] eq 'term' && ref($v->[1]) eq 'Do' )
+ || ( $v->[0] eq 'term' && ref($v->[1]) eq 'CompUnit' )
)
{
# a block followed by newline terminates the expression
@@ -772,7 +774,7 @@ package Perlito5::Expression;
($res->flat()){'exp'} = Do->new(block => ($res->flat()){'exp'});
}
if ($res->flat()){'end_block'} {
- # warn "Block: ", (($res->flat()){'end_block'})->perl;
+ # warn "Block: ", $res->flat()->{'end_block'}->perl;
die "Unexpected block after expression near ", $pos;
}
if ($res->flat()){'terminated'} {
@@ -790,11 +792,11 @@ package Perlito5::Expression;
}
my $modifier_exp = $self->exp_parse($str, $modifier->to);
# say "# statement modifier [", $modifier->flat(), "] exp: ", $modifier_exp->perl;
- if (!($modifier_exp->bool)) {
+ if (!$modifier_exp->bool) {
die "Expected expression after '", $modifier->flat(), "'";
}
if ($modifier_exp->flat()){'end_block'} {
- # warn "Block: ", (($modifier_exp->flat()){'end_block'})->perl;
+ # warn "Block: ", $modifier_exp->flat()->{'end_block'}->perl;
die "Unexpected block after expression near ", $modifier->to;
}
# TODO - require a statement terminator
View
42 src5/lib/Perlito5/Grammar/Control.pm
@@ -3,12 +3,12 @@ package Perlito5::Grammar;
token unless {
unless <.ws> <exp>
{
- my $body = ($MATCH->{"exp"}->flat()){'end_block'};
- if (!(defined($body))) {
+ my $body = $MATCH->{"exp"}->flat()->{'end_block'};
+ if (!defined($body)) {
die "Missing code block in 'unless'";
}
$MATCH->{"capture"} = If->new(
- cond => ($MATCH->{"exp"}->flat()){'exp'},
+ cond => $MATCH->{"exp"}->flat()->{'exp'},
body => Lit::Block->new(stmts => [ ]),
otherwise => $body,
)
@@ -21,9 +21,9 @@ token if {
<.opt_ws>
else <exp2>
{
- my $body = ($MATCH->{"exp"}->flat()){'end_block'};
+ my $body = $MATCH->{"exp"}->flat()->{'end_block'};
my $otherwise = ($MATCH->{"exp2"}->flat()){'exp'};
- if (!(defined($body))) {
+ if (!defined($body)) {
die "Missing code block in 'if'";
}
if (!(defined($otherwise))) {
@@ -33,7 +33,7 @@ token if {
$otherwise = Lit::Block->new( stmts => $otherwise->hash1 );
}
$MATCH->{"capture"} = If->new(
- cond => ($MATCH->{"exp"}->flat()){'exp'},
+ cond => $MATCH->{"exp"}->flat()->{'exp'},
body => $body,
otherwise => $otherwise,
)
@@ -42,24 +42,24 @@ token if {
<.opt_ws>
els <if>
{
- my $body = ($MATCH->{"exp"}->flat()){'end_block'};
- if (!(defined($body))) {
+ my $body = $MATCH->{"exp"}->flat()->{'end_block'};
+ if (!defined($body)) {
die "Missing code block in 'if'";
}
$MATCH->{"capture"} = If->new(
- cond => ($MATCH->{"exp"}->flat()){'exp'},
+ cond => $MATCH->{"exp"}->flat()->{'exp'},
body => $body,
otherwise => Lit::Block->new( stmts => [ $MATCH->{"if"}->flat() ] ),
)
}
|
{
- my $body = ($MATCH->{"exp"}->flat()){'end_block'};
- if (!(defined($body))) {
+ my $body = $MATCH->{"exp"}->flat()->{'end_block'};
+ if (!defined($body)) {
die "Missing code block in 'if'";
}
$MATCH->{"capture"} = If->new(
- cond => ($MATCH->{"exp"}->flat()){'exp'},
+ cond => $MATCH->{"exp"}->flat()->{'exp'},
body => $body,
otherwise => Lit::Block->new(stmts => [ ]),
)
@@ -70,12 +70,12 @@ token if {
token when {
when <.ws> <exp>
{
- my $body = ($MATCH->{"exp"}->flat()){'end_block'};
- if (!(defined($body))) {
+ my $body = $MATCH->{"exp"}->flat()->{'end_block'};
+ if (!defined($body)) {
die "Missing code block in 'when'";
}
$MATCH->{"capture"} = When->new(
- parameters => ($MATCH->{"exp"}->flat()){'exp'},
+ parameters => $MATCH->{"exp"}->flat()->{'exp'},
body => $body )
}
}
@@ -99,11 +99,11 @@ token for {
|
<exp>
{
- my $body = ($MATCH->{"exp"}->flat()){'end_block'};
- if (!(defined($body))) {
+ my $body = $MATCH->{"exp"}->flat()->{'end_block'};
+ if (!defined($body)) {
die "Missing code block in 'when'";
}
- $MATCH->{"capture"} = For->new( cond => ($MATCH->{"exp"}->flat()){'exp'}, topic => undef, body => $body )
+ $MATCH->{"capture"} = For->new( cond => $MATCH->{"exp"}->flat()->{'exp'}, topic => undef, body => $body )
}
]
}
@@ -111,12 +111,12 @@ token for {
token while {
while <.ws> <exp>
{
- my $body = ($MATCH->{"exp"}->flat()){'end_block'};
- if (!(defined($body))) {
+ my $body = $MATCH->{"exp"}->flat()->{'end_block'};
+ if (!defined($body)) {
die "Missing code block in 'while'";
}
$MATCH->{"capture"} = While->new(
- cond => ($MATCH->{"exp"}->flat()){'exp'},
+ cond => $MATCH->{"exp"}->flat()->{'exp'},
body => $body )
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.