perl/perly.h
Paul "LeoNerd" Evans da6c78e212 Allow multivariable foreach to use refaliases
As noted by https://github.com/Perl/perl5/issues/24027, while multivar
foreach and refalias foreach have each been available separately for
some time now, it wasn't possible to combine the two until now.

This current implementation does have limits on the number of variables
in total are allowed in a multivariable foreach loop if any are
refaliases (no more than 256), and which ones can be refaliases (none
past the 24th) that are all to do with the way I am abusing the U32
`op_targ` field to store the variable count in the lower 8 bits, and a
bitmask of which vars are refaliases in the upper 24 bits. I decided to
do that as it means I don't have to make the `OP_ITER` op any larger -
such as by expanding it to an UNOP_AUX to give it that extra storage
space. In practice I don't imagine those limits will be a problem for
any practical use-case.

If in a future version we did want to expand on those limits, I think it
would be possible by moving the `refalias_mask` storage to a PV stored
in the UNOP_AUX vector, or somesuch.
2026-01-22 00:07:41 +00:00

254 lines
10 KiB
C
Generated

/* -*- mode: C; buffer-read-only: t -*-
!!!!!!! DO NOT EDIT THIS FILE !!!!!!!
This file is built by regen_perly.pl from perly.y.
Any changes made here will be lost!
*/
#define PERL_BISON_VERSION 30008
#ifdef PERL_CORE
/* A Bison parser, made by GNU Bison 3.8.2. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
especially those whose name start with YY_ or yy_. They are
private implementation details that can be changed or removed. */
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Token kinds. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
YYEMPTY = -2,
YYEOF = 0, /* "end of file" */
YYerror = 256, /* error */
YYUNDEF = 257, /* "invalid token" */
GRAMPROG = 258, /* GRAMPROG */
GRAMEXPR = 259, /* GRAMEXPR */
GRAMBLOCK = 260, /* GRAMBLOCK */
GRAMBARESTMT = 261, /* GRAMBARESTMT */
GRAMFULLSTMT = 262, /* GRAMFULLSTMT */
GRAMSTMTSEQ = 263, /* GRAMSTMTSEQ */
GRAMSUBSIGNATURE = 264, /* GRAMSUBSIGNATURE */
PERLY_AMPERSAND = 265, /* PERLY_AMPERSAND */
PERLY_BRACE_OPEN = 266, /* PERLY_BRACE_OPEN */
PERLY_BRACE_CLOSE = 267, /* PERLY_BRACE_CLOSE */
PERLY_BRACKET_OPEN = 268, /* PERLY_BRACKET_OPEN */
PERLY_BRACKET_CLOSE = 269, /* PERLY_BRACKET_CLOSE */
PERLY_COMMA = 270, /* PERLY_COMMA */
PERLY_DOLLAR = 271, /* PERLY_DOLLAR */
PERLY_DOT = 272, /* PERLY_DOT */
PERLY_EQUAL_SIGN = 273, /* PERLY_EQUAL_SIGN */
PERLY_MINUS = 274, /* PERLY_MINUS */
PERLY_PERCENT_SIGN = 275, /* PERLY_PERCENT_SIGN */
PERLY_PLUS = 276, /* PERLY_PLUS */
PERLY_SEMICOLON = 277, /* PERLY_SEMICOLON */
PERLY_SLASH = 278, /* PERLY_SLASH */
PERLY_SNAIL = 279, /* PERLY_SNAIL */
PERLY_STAR = 280, /* PERLY_STAR */
KW_FORMAT = 281, /* KW_FORMAT */
KW_PACKAGE = 282, /* KW_PACKAGE */
KW_CLASS = 283, /* KW_CLASS */
KW_LOCAL = 284, /* KW_LOCAL */
KW_MY = 285, /* KW_MY */
KW_FIELD = 286, /* KW_FIELD */
KW_IF = 287, /* KW_IF */
KW_ELSE = 288, /* KW_ELSE */
KW_ELSIF = 289, /* KW_ELSIF */
KW_UNLESS = 290, /* KW_UNLESS */
KW_FOR = 291, /* KW_FOR */
KW_UNTIL = 292, /* KW_UNTIL */
KW_WHILE = 293, /* KW_WHILE */
KW_CONTINUE = 294, /* KW_CONTINUE */
KW_GIVEN = 295, /* KW_GIVEN */
KW_WHEN = 296, /* KW_WHEN */
KW_DEFAULT = 297, /* KW_DEFAULT */
KW_TRY = 298, /* KW_TRY */
KW_CATCH = 299, /* KW_CATCH */
KW_FINALLY = 300, /* KW_FINALLY */
KW_DEFER = 301, /* KW_DEFER */
KW_REQUIRE = 302, /* KW_REQUIRE */
KW_DO = 303, /* KW_DO */
KW_USE_or_NO = 304, /* KW_USE_or_NO */
KW_SUB_named = 305, /* KW_SUB_named */
KW_SUB_named_sig = 306, /* KW_SUB_named_sig */
KW_SUB_anon = 307, /* KW_SUB_anon */
KW_SUB_anon_sig = 308, /* KW_SUB_anon_sig */
KW_METHOD_named = 309, /* KW_METHOD_named */
KW_METHOD_anon = 310, /* KW_METHOD_anon */
BAREWORD = 311, /* BAREWORD */
METHCALL0 = 312, /* METHCALL0 */
METHCALL = 313, /* METHCALL */
ATTRLIST = 314, /* ATTRLIST */
THING = 315, /* THING */
PMFUNC = 316, /* PMFUNC */
PRIVATEREF = 317, /* PRIVATEREF */
QWLIST = 318, /* QWLIST */
FUNC0OP = 319, /* FUNC0OP */
FUNC0SUB = 320, /* FUNC0SUB */
UNIOPSUB = 321, /* UNIOPSUB */
LSTOPSUB = 322, /* LSTOPSUB */
PLUGEXPR = 323, /* PLUGEXPR */
PLUGSTMT = 324, /* PLUGSTMT */
LABEL = 325, /* LABEL */
PROTOTYPE = 326, /* PROTOTYPE */
LOOPEX = 327, /* LOOPEX */
DOTDOT = 328, /* DOTDOT */
YADAYADA = 329, /* YADAYADA */
FUNC0 = 330, /* FUNC0 */
FUNC1 = 331, /* FUNC1 */
FUNC = 332, /* FUNC */
UNIOP = 333, /* UNIOP */
LSTOP = 334, /* LSTOP */
BLKLSTOP = 335, /* BLKLSTOP */
POWOP = 336, /* POWOP */
MULOP = 337, /* MULOP */
ADDOP = 338, /* ADDOP */
DOLSHARP = 339, /* DOLSHARP */
HASHBRACK = 340, /* HASHBRACK */
NOAMP = 341, /* NOAMP */
COLONATTR = 342, /* COLONATTR */
FORMLBRACK = 343, /* FORMLBRACK */
FORMRBRACK = 344, /* FORMRBRACK */
SUBLEXSTART = 345, /* SUBLEXSTART */
SUBLEXEND = 346, /* SUBLEXEND */
PHASER = 347, /* PHASER */
PREC_LOW = 348, /* PREC_LOW */
PLUGIN_LOW_OP = 349, /* PLUGIN_LOW_OP */
OROP = 350, /* OROP */
PLUGIN_LOGICAL_OR_LOW_OP = 351, /* PLUGIN_LOGICAL_OR_LOW_OP */
ANDOP = 352, /* ANDOP */
PLUGIN_LOGICAL_AND_LOW_OP = 353, /* PLUGIN_LOGICAL_AND_LOW_OP */
NOTOP = 354, /* NOTOP */
ASSIGNOP = 355, /* ASSIGNOP */
PLUGIN_ASSIGN_OP = 356, /* PLUGIN_ASSIGN_OP */
PERLY_QUESTION_MARK = 357, /* PERLY_QUESTION_MARK */
PERLY_COLON = 358, /* PERLY_COLON */
OROR = 359, /* OROR */
DORDOR = 360, /* DORDOR */
PLUGIN_LOGICAL_OR_OP = 361, /* PLUGIN_LOGICAL_OR_OP */
ANDAND = 362, /* ANDAND */
PLUGIN_LOGICAL_AND_OP = 363, /* PLUGIN_LOGICAL_AND_OP */
BITOROP = 364, /* BITOROP */
BITANDOP = 365, /* BITANDOP */
CHEQOP = 366, /* CHEQOP */
NCEQOP = 367, /* NCEQOP */
CHRELOP = 368, /* CHRELOP */
NCRELOP = 369, /* NCRELOP */
PLUGIN_REL_OP = 370, /* PLUGIN_REL_OP */
SHIFTOP = 371, /* SHIFTOP */
PLUGIN_ADD_OP = 372, /* PLUGIN_ADD_OP */
PLUGIN_MUL_OP = 373, /* PLUGIN_MUL_OP */
MATCHOP = 374, /* MATCHOP */
PERLY_EXCLAMATION_MARK = 375, /* PERLY_EXCLAMATION_MARK */
PERLY_TILDE = 376, /* PERLY_TILDE */
UMINUS = 377, /* UMINUS */
REFGEN = 378, /* REFGEN */
PLUGIN_POW_OP = 379, /* PLUGIN_POW_OP */
PREINC = 380, /* PREINC */
PREDEC = 381, /* PREDEC */
POSTINC = 382, /* POSTINC */
POSTDEC = 383, /* POSTDEC */
POSTJOIN = 384, /* POSTJOIN */
PLUGIN_HIGH_OP = 385, /* PLUGIN_HIGH_OP */
ARROW = 386, /* ARROW */
PERLY_PAREN_CLOSE = 387, /* PERLY_PAREN_CLOSE */
PERLY_PAREN_OPEN = 388 /* PERLY_PAREN_OPEN */
};
typedef enum yytokentype yytoken_kind_t;
#endif
/* Value type. */
#ifdef PERL_IN_TOKE_C
static bool
S_is_opval_token(int type) {
switch (type) {
case ATTRLIST:
case BAREWORD:
case FUNC0OP:
case FUNC0SUB:
case LABEL:
case LSTOPSUB:
case METHCALL:
case METHCALL0:
case PLUGEXPR:
case PLUGSTMT:
case PMFUNC:
case PRIVATEREF:
case PROTOTYPE:
case QWLIST:
case THING:
case UNIOPSUB:
return 1;
}
return 0;
}
#endif /* PERL_IN_TOKE_C */
#endif /* PERL_CORE */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
I32 ival; /* __DEFAULT__ (marker for regen_perly.pl;
must always be 1st union member) */
void *pval;
OP *opval;
GV *gvval;
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
int yyparse (void);
/* Generated from:
* 11a76178c6bb99bd6c08dfcc2b9fa80e33e491a061e3f2722d8ff2a9d9a5e7fd perly.y
* f13e9c08cea6302f0c1d1f467405bd0e0880d0ea92d0669901017a7f7e94ab28 regen_perly.pl
* ex: set ro ft=c: */