| 1 | # Do not edit this file - Generated by Perlito5 9.027 | ||
| 2 | |||
| 3 | { | ||
| 4 | package main; | ||
| 5 | package Perlito5::Grammar::Bareword; | ||
| 6 | use strict ; | ||
| 7 | sub Perlito5::Grammar::Bareword::the_object { | ||
| 8 | my $str = $_[0]; | ||
| 9 | my $pos = $_[1]; | ||
| 10 | my $MATCH = {"str" => $str, "from" => $pos, "to" => $pos, }; | ||
| 11 | my $tmp = ((do { | ||
| 12 | my $tmp100 = $MATCH->{"to"}; | ||
| 13 | (((do { | ||
| 14 | my $tmp = $MATCH; | ||
| 15 | $MATCH = {"from" => $tmp->{"to"}, "to" => $tmp->{"to"}, }; | ||
| 16 | my $res = (("\$" eq $str->[($MATCH->{"to"}) + 0]) && ($MATCH->{"to"} += 1)); | ||
| 17 | $MATCH = $tmp; | ||
| 18 | $res ? 1 : 0 | ||
| 19 | }) && (do { | ||
| 20 | my $m2 = Perlito5::Grammar::Sigil::term_sigil($str, $MATCH->{"to"}); | ||
| 21 | if ($m2) { | ||
| 22 | $MATCH->{"to"} = $m2->{"to"}; | ||
| 23 | $MATCH->{"Perlito5::Grammar::Sigil::term_sigil"} = $m2; | ||
| 24 | 1 | ||
| 25 | } | ||
| 26 | else {; | ||
| 27 | 0 | ||
| 28 | } | ||
| 29 | }) && (do { | ||
| 30 | $MATCH->{"capture"} = Perlito5::Match::flat($MATCH->{"Perlito5::Grammar::Sigil::term_sigil"})->[1]; | ||
| 31 | 1 | ||
| 32 | }))) || ($MATCH->{"to"} = $tmp100, ((("{" eq $str->[($MATCH->{"to"}) + 0]) && ($MATCH->{"to"} += 1)) && (do { | ||
| 33 | my $m2 = Perlito5::Grammar::Expression::curly_parse($str, $MATCH->{"to"}); | ||
| 34 | if ($m2) { | ||
| 35 | $MATCH->{"to"} = $m2->{"to"}; | ||
| 36 | $MATCH->{"Perlito5::Grammar::Expression::curly_parse"} = $m2; | ||
| 37 | 1 | ||
| 38 | } | ||
| 39 | else {; | ||
| 40 | 0 | ||
| 41 | } | ||
| 42 | }) && (("}" eq $str->[($MATCH->{"to"}) + 0]) && ($MATCH->{"to"} += 1)) && (do { | ||
| 43 | $MATCH->{"capture"} = Perlito5::Match::flat($MATCH->{"Perlito5::Grammar::Expression::curly_parse"}); | ||
| 44 | 1 | ||
| 45 | }))) || ($MATCH->{"to"} = $tmp100, ((do { | ||
| 46 | my $m2 = Perlito5::Grammar::Print::typeglob($str, $MATCH->{"to"}); | ||
| 47 | if ($m2) { | ||
| 48 | $MATCH->{"to"} = $m2->{"to"}; | ||
| 49 | $MATCH->{"Perlito5::Grammar::Print::typeglob"} = $m2; | ||
| 50 | 1 | ||
| 51 | } | ||
| 52 | else {; | ||
| 53 | 0 | ||
| 54 | } | ||
| 55 | }) && (do { | ||
| 56 | $MATCH->{"capture"} = Perlito5::Match::flat($MATCH->{"Perlito5::Grammar::Print::typeglob"}); | ||
| 57 | 1 | ||
| 58 | }))) | ||
| 59 | })); | ||
| 60 | $tmp ? $MATCH : undef | ||
| 61 | } | ||
| 62 | sub Perlito5::Grammar::Bareword::term_bareword { | ||
| 63 | my $str = $_[0]; | ||
| 64 | my $pos = $_[1]; | ||
| 65 | my $p = $pos; | ||
| 66 | my $m_namespace = Perlito5::Grammar::optional_namespace_before_ident($str, $p); | ||
| 67 | my $namespace = Perlito5::Match::flat($m_namespace); | ||
| 68 | $p = $m_namespace->{"to"}; | ||
| 69 | my $m_name = Perlito5::Grammar::ident($str, $p); | ||
| 70 | if (!$m_name) { | ||
| 71 | if ($namespace) { | ||
| 72 | $m_namespace->{"capture"} = ["term", Perlito5::AST::Var::->new("sigil", "::", "name", '', "namespace", $namespace)]; | ||
| 73 | return $m_namespace | ||
| 74 | } | ||
| 75 | return | ||
| 76 | } | ||
| 77 | my $name = Perlito5::Match::flat($m_name); | ||
| 78 | $p = $m_name->{"to"}; | ||
| 79 | if ($str->[$p] eq ":" && $str->[$p + 1] eq ":") { | ||
| 80 | $m_name->{"to"} = $p + 2; | ||
| 81 | $m_name->{"capture"} = ["term", Perlito5::AST::Var::->new("sigil", "::", "name", '', "namespace", $namespace . "::" . $name)]; | ||
| 82 | return $m_name | ||
| 83 | } | ||
| 84 | my $full_name = $name; | ||
| 85 | $namespace && ($full_name = $namespace . "::" . $name); | ||
| 86 | my $m = Perlito5::Grammar::Space::ws($str, $p); | ||
| 87 | if ($m) {; | ||
| 88 | $p = $m->{"to"} | ||
| 89 | } | ||
| 90 | my $invocant; | ||
| 91 | my $is_subroutine_name; | ||
| 92 | my $effective_name = ($namespace || $Perlito5::PKG_NAME) . "::" . $name; | ||
| 93 | if (exists(&{$effective_name})) { | ||
| 94 | my $p = eval {; | ||
| 95 | prototype($effective_name) | ||
| 96 | }; | ||
| 97 | $Perlito5::PROTO->{$effective_name} = $p | ||
| 98 | } | ||
| 99 | if (exists($Perlito5::Grammar::Print::Print{$name})) {; | ||
| 100 | $invocant = undef | ||
| 101 | } | ||
| 102 | elsif (exists($Perlito5::PROTO->{$effective_name}) || ((!$namespace || $namespace eq "CORE") && exists($Perlito5::CORE_PROTO->{"CORE::" . $name}))) { | ||
| 103 | if ($name eq "__END__" || $name eq "__DATA__") {; | ||
| 104 | return Perlito5::Grammar::Space::term_end(@_) | ||
| 105 | } | ||
| 106 | $is_subroutine_name = 1; | ||
| 107 | $invocant = Perlito5::Grammar::full_ident($str, $p); | ||
| 108 | if ($invocant) { | ||
| 109 | my $package = Perlito5::Match::flat($invocant); | ||
| 110 | if ($package) { | ||
| 111 | $invocant->{"capture"} = Perlito5::AST::Var::->new("sigil", "::", "name", '', "namespace", $package); | ||
| 112 | if ($str->[$invocant->{"to"}] eq ":" && $str->[($invocant->{"to"}) + 1] eq ":") {; | ||
| 113 | $invocant->{"to"} = ($invocant->{"to"}) + 2 | ||
| 114 | } | ||
| 115 | elsif (!$Perlito5::PACKAGES->{$package}) {; | ||
| 116 | $invocant = undef | ||
| 117 | } | ||
| 118 | } | ||
| 119 | } | ||
| 120 | } | ||
| 121 | else {; | ||
| 122 | $invocant = Perlito5::Grammar::Bareword::the_object($str, $p) | ||
| 123 | } | ||
| 124 | if ($invocant) { | ||
| 125 | $p = $invocant->{"to"}; | ||
| 126 | my $arg = []; | ||
| 127 | $m = Perlito5::Grammar::Space::ws($str, $p); | ||
| 128 | $m && ($p = $m->{"to"}); | ||
| 129 | if ($str->[$p] eq "-" && $str->[$p + 1] eq ">") {} | ||
| 130 | elsif ($str->[$p] eq "(") { | ||
| 131 | my $m = Perlito5::Grammar::Expression::term_paren($str, $p); | ||
| 132 | if ($m) { | ||
| 133 | $arg = $m->{"capture"}->[2]; | ||
| 134 | $p = $m->{"to"}; | ||
| 135 | $arg = Perlito5::Grammar::Expression::expand_list($arg) | ||
| 136 | } | ||
| 137 | } | ||
| 138 | else { | ||
| 139 | my $m = Perlito5::Grammar::Expression::list_parse($str, $p); | ||
| 140 | if ($m->{"capture"} ne "*undef*") { | ||
| 141 | $arg = Perlito5::Grammar::Expression::expand_list($m->{"capture"}); | ||
| 142 | $p = $m->{"to"} | ||
| 143 | } | ||
| 144 | } | ||
| 145 | $m_name->{"capture"} = ["term", Perlito5::AST::Call::->new("method", $full_name, "invocant", Perlito5::Match::flat($invocant), "arguments", $arg)]; | ||
| 146 | $m_name->{"to"} = $p; | ||
| 147 | return $m_name | ||
| 148 | } | ||
| 149 | if ($str->[$p] eq "=" && $str->[$p + 1] eq ">") { | ||
| 150 | $m_name->{"capture"} = ["term", Perlito5::AST::Apply::->new("code", $name, "namespace", $namespace, "arguments", [], "bareword", 1)]; | ||
| 151 | $m_name->{"to"} = $p; | ||
| 152 | return $m_name | ||
| 153 | } | ||
| 154 | my $sig = undef; | ||
| 155 | { | ||
| 156 | my $op = ($str->[$p]) . ($str->[$p + 1]); | ||
| 157 | if ($op eq "!=" || $op eq "!~" || $op eq "=~") {; | ||
| 158 | $sig = '' | ||
| 159 | } | ||
| 160 | } | ||
| 161 | if (exists($Perlito5::PROTO->{$effective_name})) { | ||
| 162 | $sig = $Perlito5::PROTO->{$effective_name}; | ||
| 163 | $namespace ||= $Perlito5::PKG_NAME | ||
| 164 | } | ||
| 165 | elsif ((!$namespace || $namespace eq "CORE") && exists($Perlito5::CORE_PROTO->{"CORE::" . $name})) { | ||
| 166 | $effective_name = "CORE::" . $name; | ||
| 167 | $sig = $Perlito5::CORE_PROTO->{$effective_name}; | ||
| 168 | my $core_global_name = "CORE::GLOBAL::" . $name; | ||
| 169 | if (!$namespace && exists($Perlito5::CORE_GLOBAL_OVERRIDABLE->{$name}) && exists(&{$core_global_name})) { | ||
| 170 | $namespace = "CORE::GLOBAL"; | ||
| 171 | $effective_name = $core_global_name; | ||
| 172 | if (!exists($Perlito5::PROTO->{$core_global_name})) {; | ||
| 173 | $Perlito5::PROTO->{$core_global_name} = prototype(&{$core_global_name}) | ||
| 174 | } | ||
| 175 | } | ||
| 176 | my $local_name = $Perlito5::PKG_NAME . ("::" . $name); | ||
| 177 | if (!$namespace && exists($Perlito5::CORE_OVERRIDABLE->{$name}) && exists(&{$local_name})) { | ||
| 178 | $namespace = ${$Perlito5::PKG_NAME}; | ||
| 179 | $effective_name = $local_name; | ||
| 180 | if (!exists($Perlito5::PROTO->{$local_name})) {; | ||
| 181 | $Perlito5::PROTO->{$local_name} = prototype(&{$local_name}) | ||
| 182 | } | ||
| 183 | } | ||
| 184 | } | ||
| 185 | else { | ||
| 186 | my $m = Perlito5::Grammar::Number::val_version($str, $pos); | ||
| 187 | if ($m) { | ||
| 188 | $m->{"capture"} = ["term", $m->{"capture"}]; | ||
| 189 | return $m | ||
| 190 | } | ||
| 191 | } | ||
| 192 | if ($str->[$p] eq "-" && $str->[$p + 1] eq ">") { | ||
| 193 | if ($is_subroutine_name) {; | ||
| 194 | $m_name->{"capture"} = ["term", Perlito5::AST::Apply::->new("arguments", [], "code", $name, "namespace", $namespace)] | ||
| 195 | } | ||
| 196 | else {; | ||
| 197 | $m_name->{"capture"} = ["term", Perlito5::AST::Var::->new("name", '', "namespace", $full_name, "sigil", "::")] | ||
| 198 | } | ||
| 199 | $m_name->{"to"} = $p; | ||
| 200 | return $m_name | ||
| 201 | } | ||
| 202 | if (defined($sig) && $sig eq '') { | ||
| 203 | my $expr = $Perlito5::CONSTANT{$namespace . "::" . $name}; | ||
| 204 | if ($expr) { | ||
| 205 | if ($str->[$p] eq "(") { | ||
| 206 | $p++; | ||
| 207 | my $m = Perlito5::Grammar::Space::ws($str, $p); | ||
| 208 | if ($m) {; | ||
| 209 | $p = $m->{"to"} | ||
| 210 | } | ||
| 211 | if ($str->[$p] ne ")") {; | ||
| 212 | Perlito5::Compiler::error("Too many arguments for " . $namespace . "::" . $name) | ||
| 213 | } | ||
| 214 | $p++ | ||
| 215 | } | ||
| 216 | $m_name->{"capture"} = ["term", $expr]; | ||
| 217 | $m_name->{"to"} = $p; | ||
| 218 | return $m_name | ||
| 219 | } | ||
| 220 | } | ||
| 221 | my $has_paren = 0; | ||
| 222 | if (defined($sig)) { | ||
| 223 | my $arg_index = 1; | ||
| 224 | my $optional = 0; | ||
| 225 | my @args; | ||
| 226 | my $sig_part = substr($sig, 0, 1); | ||
| 227 | my $m; | ||
| 228 | my $capture; | ||
| 229 | if ($sig_part eq "&") { | ||
| 230 | $m = Perlito5::Grammar::Space::ws($str, $p); | ||
| 231 | $m && ($p = $m->{"to"}); | ||
| 232 | if ($str->[$p] ne "(") { | ||
| 233 | $sig = substr($sig, 1); | ||
| 234 | $m = Perlito5::Grammar::Bareword::prototype_is_ampersand($str, $p); | ||
| 235 | $m && ($capture = $m->{"capture"}); | ||
| 236 | if (!$m) {; | ||
| 237 | Perlito5::Compiler::error("Type of arg " . $arg_index . " to " . $name . " must be block or sub {}") | ||
| 238 | } | ||
| 239 | $p = $m->{"to"}; | ||
| 240 | push(@args, $capture) | ||
| 241 | } | ||
| 242 | } | ||
| 243 | if (substr($sig, 0, 1) eq ";" && $str->[$p] eq "/" && $str->[$p + 1] eq "/") { | ||
| 244 | $m_name->{"capture"} = ["term", Perlito5::AST::Apply::->new("code", $name, "namespace", $namespace, "arguments", [], "bareword", 1)]; | ||
| 245 | $m_name->{"to"} = $p; | ||
| 246 | return $m_name | ||
| 247 | } | ||
| 248 | if ($sig eq '') { | ||
| 249 | if ($str->[$p] eq "(") { | ||
| 250 | $p++; | ||
| 251 | $has_paren = 1; | ||
| 252 | my $m = Perlito5::Grammar::Space::ws($str, $p); | ||
| 253 | if ($m) {; | ||
| 254 | $p = $m->{"to"} | ||
| 255 | } | ||
| 256 | if ($str->[$p] ne ")") {; | ||
| 257 | Perlito5::Compiler::error("syntax error near ", join('', @{$str}[$pos .. $pos + 10])) | ||
| 258 | } | ||
| 259 | $p++ | ||
| 260 | } | ||
| 261 | if ($name eq "__FILE__") {; | ||
| 262 | $m_name->{"capture"} = ["term", Perlito5::AST::Buf::->new("buf", $Perlito5::FILE_NAME)] | ||
| 263 | } | ||
| 264 | elsif ($name eq "__LINE__") {; | ||
| 265 | $m_name->{"capture"} = ["term", Perlito5::AST::Int::->new("int", $Perlito5::LINE_NUMBER)] | ||
| 266 | } | ||
| 267 | else {; | ||
| 268 | $m_name->{"capture"} = ["term", Perlito5::AST::Apply::->new("code", $name, "namespace", $namespace, "arguments", \@args, "bareword", ($has_paren == 0))] | ||
| 269 | } | ||
| 270 | $m_name->{"to"} = $p; | ||
| 271 | return $m_name | ||
| 272 | } | ||
| 273 | if ($sig eq "_" || $sig eq "\$" || $sig eq "+" || $sig eq ";\$") { | ||
| 274 | my $m; | ||
| 275 | my $arg; | ||
| 276 | if ($str->[$p] eq "(") { | ||
| 277 | $m = Perlito5::Grammar::Expression::term_paren($str, $p); | ||
| 278 | if (!$m) {; | ||
| 279 | return $m | ||
| 280 | } | ||
| 281 | $p = $m->{"to"}; | ||
| 282 | $has_paren = 1; | ||
| 283 | $arg = $m->{"capture"}->[2]; | ||
| 284 | $arg = Perlito5::Grammar::Expression::expand_list($arg); | ||
| 285 | my $v = shift(@{$arg}); | ||
| 286 | @{$arg} && Perlito5::Compiler::error("Too many arguments for " . $name); | ||
| 287 | $arg = $v | ||
| 288 | } | ||
| 289 | else { | ||
| 290 | $m = Perlito5::Grammar::Expression::argument_parse($str, $p); | ||
| 291 | $arg = $m->{"capture"}; | ||
| 292 | if ($arg eq "*undef*") {; | ||
| 293 | $arg = undef | ||
| 294 | } | ||
| 295 | elsif (ref($arg) eq "Perlito5::AST::Apply" && $arg->{"code"} eq "circumfix:<( )>") { | ||
| 296 | my $v = shift(@{$arg->{"arguments"}}); | ||
| 297 | @{$arg->{"arguments"}} && Perlito5::Compiler::error("Too many arguments for " . $name); | ||
| 298 | $arg = $v | ||
| 299 | } | ||
| 300 | } | ||
| 301 | if (defined($arg)) { | ||
| 302 | push(@args, $arg); | ||
| 303 | $has_paren = 1 | ||
| 304 | } | ||
| 305 | else { | ||
| 306 | $sig eq "\$" && Perlito5::Compiler::error("Not enough arguments for " . $name); | ||
| 307 | $sig eq "_" && push(@args, Perlito5::AST::Var::->new("namespace", '', "name", "_", "sigil", "\$")) | ||
| 308 | } | ||
| 309 | my $ast = Perlito5::AST::Apply::->new("code", $name, "namespace", $namespace, "arguments", \@args, "bareword", ($has_paren == 0)); | ||
| 310 | if ($name eq "eval" && !$namespace) { | ||
| 311 | $ast->{"_scope"} = Perlito5::Grammar::Scope::get_snapshot($Perlito5::CLOSURE_SCOPE); | ||
| 312 | $ast->{"_scalar_hints"} = ${^H}; | ||
| 313 | $ast->{"_hash_hints"} = {%{^H}, } | ||
| 314 | } | ||
| 315 | $m->{"capture"} = ["term", $ast]; | ||
| 316 | return $m | ||
| 317 | } | ||
| 318 | if ($sig eq ";\@" || $sig eq "\@") { | ||
| 319 | if ($str->[$p] eq "(") { | ||
| 320 | $m = Perlito5::Grammar::Expression::term_paren($str, $p); | ||
| 321 | $has_paren = 1; | ||
| 322 | my $arg = $m->{"capture"}->[2]; | ||
| 323 | $arg = Perlito5::Grammar::Expression::expand_list($arg); | ||
| 324 | push(@args, @{$arg}) | ||
| 325 | } | ||
| 326 | else { | ||
| 327 | $m = Perlito5::Grammar::Expression::list_parse($str, $p); | ||
| 328 | my $arg = $m->{"capture"}; | ||
| 329 | if ($arg ne "*undef*") { | ||
| 330 | $arg = Perlito5::Grammar::Expression::expand_list($arg); | ||
| 331 | push(@args, @{$arg}) | ||
| 332 | } | ||
| 333 | } | ||
| 334 | my $ast = Perlito5::AST::Apply::->new("code", $name, "namespace", $namespace, "arguments", \@args, "bareword", ($has_paren == 0)); | ||
| 335 | $m->{"capture"} = ["term", $ast]; | ||
| 336 | return $m | ||
| 337 | } | ||
| 338 | if ($sig eq "*") {} | ||
| 339 | } | ||
| 340 | if ($str->[$p] eq "(") { | ||
| 341 | $m = Perlito5::Grammar::Expression::term_paren($str, $p); | ||
| 342 | if (!$m) {; | ||
| 343 | return $m | ||
| 344 | } | ||
| 345 | my $arg = $m->{"capture"}->[2]; | ||
| 346 | $arg = Perlito5::Grammar::Expression::expand_list($arg); | ||
| 347 | if ($namespace eq '' || $namespace eq "CORE") { | ||
| 348 | if ($name eq "print" || $name eq "say") {; | ||
| 349 | if (@{$arg} == 0) {; | ||
| 350 | push(@{$arg}, Perlito5::AST::Var::->new("namespace", '', "name", "_", "sigil", "\$")) | ||
| 351 | } | ||
| 352 | } | ||
| 353 | if ($name eq "split") { | ||
| 354 | if (@{$arg} == 0) {; | ||
| 355 | push(@{$arg}, Perlito5::AST::Buf::->new("buf", " ")) | ||
| 356 | } | ||
| 357 | if (@{$arg} == 1) {; | ||
| 358 | push(@{$arg}, Perlito5::AST::Var::->new("namespace", '', "name", "_", "sigil", "\$")) | ||
| 359 | } | ||
| 360 | } | ||
| 361 | } | ||
| 362 | $m->{"capture"} = ["term", Perlito5::AST::Apply::->new("code", $name, "namespace", $namespace, "arguments", $arg, "proto", $sig)]; | ||
| 363 | return $m | ||
| 364 | } | ||
| 365 | my $m_list = Perlito5::Grammar::Expression::list_parse($str, $p); | ||
| 366 | my $list = $m_list->{"capture"}; | ||
| 367 | if ($list ne "*undef*") { | ||
| 368 | my $param_list = Perlito5::Grammar::Expression::expand_list($list); | ||
| 369 | if (${^H} & $Perlito5::STRICT_SUBS) {; | ||
| 370 | for my $i (0 .. $#{$param_list}) { | ||
| 371 | my $arg = $param_list->[$i]; | ||
| 372 | if (ref($arg) eq "Perlito5::AST::Apply" && $arg->{"bareword"} && $arg->{"_not_a_subroutine"}) { | ||
| 373 | my $name = $arg->{"code"}; | ||
| 374 | my $namespace = $arg->{"namespace"}; | ||
| 375 | if ($sig && (substr($sig, $i, 1) eq "*" || substr($sig, $i, 2) eq ";*")) {} | ||
| 376 | else {; | ||
| 377 | Perlito5::Compiler::error("Bareword \"" . ($namespace ? $namespace . "::" : '') . $name . "\" not allowed while \"strict subs\" in use") | ||
| 378 | } | ||
| 379 | } | ||
| 380 | } | ||
| 381 | } | ||
| 382 | $m_name->{"capture"} = ["postfix_or_term", "funcall", $namespace, $name, $param_list]; | ||
| 383 | $m_name->{"to"} = $m_list->{"to"}; | ||
| 384 | return $m_name | ||
| 385 | } | ||
| 386 | if ($namespace eq '' || $namespace eq "CORE") { | ||
| 387 | if ($name eq "print" || $name eq "say") { | ||
| 388 | $m_name->{"capture"} = ["term", Perlito5::AST::Apply::->new("code", $name, "namespace", $namespace, "arguments", [Perlito5::AST::Var::->new("namespace", '', "name", "_", "sigil", "\$")])]; | ||
| 389 | return $m_name | ||
| 390 | } | ||
| 391 | if ($name eq "split" && ($namespace eq '' || $namespace eq "CORE")) { | ||
| 392 | $m_name->{"capture"} = ["term", Perlito5::AST::Apply::->new("code", $name, "namespace", $namespace, "arguments", [Perlito5::AST::Buf::->new("buf", " "), Perlito5::AST::Var::->new("namespace", '', "name", "_", "sigil", "\$")])]; | ||
| 393 | return $m_name | ||
| 394 | } | ||
| 395 | } | ||
| 396 | if (${^H} & $Perlito5::STRICT_SUBS) { | ||
| 397 | my $m = Perlito5::Grammar::Space::opt_ws($str, $p); | ||
| 398 | my $p = $m->{"to"}; | ||
| 399 | if ($str->[$p] eq ":") {} | ||
| 400 | elsif (!(exists($Perlito5::PROTO->{$effective_name}) || ((!$namespace || $namespace eq "CORE") && exists($Perlito5::CORE_PROTO->{"CORE::" . $name})))) { | ||
| 401 | $m_name->{"capture"} = ["postfix_or_term", "funcall_no_params", Perlito5::AST::Apply::->new("code", $name, "namespace", $namespace, "arguments", [], "bareword", 1, "_not_a_subroutine", 1)]; | ||
| 402 | return $m_name | ||
| 403 | } | ||
| 404 | } | ||
| 405 | $m_name->{"capture"} = ["postfix_or_term", "funcall_no_params", Perlito5::AST::Apply::->new("code", $name, "namespace", $namespace, "arguments", [], "bareword", 1)]; | ||
| 406 | return $m_name | ||
| 407 | } | ||
| 408 | sub Perlito5::Grammar::Bareword::prototype_is_ampersand { | ||
| 409 | my $str = $_[0]; | ||
| 410 | my $pos = $_[1]; | ||
| 411 | my $MATCH = {"str" => $str, "from" => $pos, "to" => $pos, }; | ||
| 412 | my $tmp = ((do { | ||
| 413 | my $tmp161 = $MATCH->{"to"}; | ||
| 414 | (((("s" eq $str->[($MATCH->{"to"}) + 0]) && ("u" eq $str->[($MATCH->{"to"}) + 1]) && ("b" eq $str->[($MATCH->{"to"}) + 2]) && ($MATCH->{"to"} += 3)) && (do { | ||
| 415 | my $m2 = Perlito5::Grammar::Space::opt_ws($str, $MATCH->{"to"}); | ||
| 416 | if ($m2) { | ||
| 417 | $MATCH->{"to"} = $m2->{"to"}; | ||
| 418 | 1 | ||
| 419 | } | ||
| 420 | else {; | ||
| 421 | 0 | ||
| 422 | } | ||
| 423 | }) && (do { | ||
| 424 | my $m2 = Perlito5::Grammar::Block::anon_sub_def($str, $MATCH->{"to"}); | ||
| 425 | if ($m2) { | ||
| 426 | $MATCH->{"to"} = $m2->{"to"}; | ||
| 427 | $MATCH->{"Perlito5::Grammar::Block::anon_sub_def"} = $m2; | ||
| 428 | 1 | ||
| 429 | } | ||
| 430 | else {; | ||
| 431 | 0 | ||
| 432 | } | ||
| 433 | }) && (do { | ||
| 434 | $MATCH->{"capture"} = Perlito5::Match::flat($MATCH->{"Perlito5::Grammar::Block::anon_sub_def"}); | ||
| 435 | 1 | ||
| 436 | }))) || ($MATCH->{"to"} = $tmp161, ((do { | ||
| 437 | my $m2 = Perlito5::Grammar::block($str, $MATCH->{"to"}); | ||
| 438 | if ($m2) { | ||
| 439 | $MATCH->{"to"} = $m2->{"to"}; | ||
| 440 | $MATCH->{"Perlito5::Grammar::block"} = $m2; | ||
| 441 | 1 | ||
| 442 | } | ||
| 443 | else {; | ||
| 444 | 0 | ||
| 445 | } | ||
| 446 | }) && (do { | ||
| 447 | $MATCH->{"capture"} = Perlito5::AST::Sub::->new("attributes", [], "block", Perlito5::Match::flat($MATCH->{"Perlito5::Grammar::block"}), "name", undef, "namespace", undef, "sig", undef); | ||
| 448 | 1 | ||
| 449 | }))) || ($MATCH->{"to"} = $tmp161, ((do { | ||
| 450 | my $tmp = $MATCH; | ||
| 451 | $MATCH = {"from" => $tmp->{"to"}, "to" => $tmp->{"to"}, }; | ||
| 452 | my $res = ((("\\" eq $str->[($MATCH->{"to"}) + 0]) && ("\\" eq $str->[($MATCH->{"to"}) + 1]) && ($MATCH->{"to"} += 2)) && (do { | ||
| 453 | my $m2 = Perlito5::Grammar::Space::opt_ws($str, $MATCH->{"to"}); | ||
| 454 | if ($m2) { | ||
| 455 | $MATCH->{"to"} = $m2->{"to"}; | ||
| 456 | 1 | ||
| 457 | } | ||
| 458 | else {; | ||
| 459 | 0 | ||
| 460 | } | ||
| 461 | }) && (("&" eq $str->[($MATCH->{"to"}) + 0]) && ($MATCH->{"to"} += 1))); | ||
| 462 | $MATCH = $tmp; | ||
| 463 | $res ? 1 : 0 | ||
| 464 | }) && (do { | ||
| 465 | my $m2 = Perlito5::Grammar::Expression::argument_parse($str, $MATCH->{"to"}); | ||
| 466 | if ($m2) { | ||
| 467 | $MATCH->{"to"} = $m2->{"to"}; | ||
| 468 | $MATCH->{"Perlito5::Grammar::Expression::argument_parse"} = $m2; | ||
| 469 | 1 | ||
| 470 | } | ||
| 471 | else {; | ||
| 472 | 0 | ||
| 473 | } | ||
| 474 | }) && (do { | ||
| 475 | $MATCH->{"capture"} = Perlito5::Match::flat($MATCH->{"Perlito5::Grammar::Expression::argument_parse"}); | ||
| 476 | 1 | ||
| 477 | }))) | ||
| 478 | })); | ||
| 479 | $tmp ? $MATCH : undef | ||
| 480 | } | ||
| 481 | 1 | ||
| 482 | } | ||
| 483 | ;1 |