summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBranislav ZahradnĂ­k <barney@cpan.org>2020-12-11 17:19:09 +0100
committerKarl Williamson <khw@cpan.org>2020-12-27 09:46:09 -0700
commit3d9ccdfc9c042f91d022df1227f4b05ddeca831c (patch)
tree003566736db9c024cb22cd450aeadf9fc5cbd515
parent3d92c6b8aa91a3ee216dd4aafedacd8b6e129803 (diff)
downloadperl-3d9ccdfc9c042f91d022df1227f4b05ddeca831c.tar.gz
Distinguish C- and perly- literals - PERLY_COLON
-rw-r--r--perly.act2
-rw-r--r--perly.h47
-rw-r--r--perly.tab66
-rw-r--r--perly.y4
-rw-r--r--toke.c5
5 files changed, 63 insertions, 61 deletions
diff --git a/perly.act b/perly.act
index e4b1237d0a..35d7119716 100644
--- a/perly.act
+++ b/perly.act
@@ -2130,6 +2130,6 @@ case 2:
/* Generated from:
- * 3b37f5e99c3211f5a689f0b84d2f93ccb2d9dcee38cf8543545147c2f3232e4d perly.y
+ * 4254f7a193750fc5d4d9a58ee880004d69cfaecdf245c298f9f6357f963e5f42 perly.y
* acf1cbfd2545faeaaa58b1cf0cf9d7f98b5be0752eb7a54528ef904a9e2e1ca7 regen_perly.pl
* ex: set ro: */
diff --git a/perly.h b/perly.h
index 4e54401a56..7fbcd2fb5b 100644
--- a/perly.h
+++ b/perly.h
@@ -132,28 +132,29 @@ extern int yydebug;
ANDOP = 331,
NOTOP = 332,
ASSIGNOP = 333,
- OROR = 334,
- DORDOR = 335,
- ANDAND = 336,
- BITOROP = 337,
- BITANDOP = 338,
- CHEQOP = 339,
- NCEQOP = 340,
- CHRELOP = 341,
- NCRELOP = 342,
- SHIFTOP = 343,
- MATCHOP = 344,
- PERLY_EXCLAMATION_MARK = 345,
- PERLY_TILDE = 346,
- UMINUS = 347,
- REFGEN = 348,
- POWOP = 349,
- PREINC = 350,
- PREDEC = 351,
- POSTINC = 352,
- POSTDEC = 353,
- POSTJOIN = 354,
- ARROW = 355
+ PERLY_COLON = 334,
+ OROR = 335,
+ DORDOR = 336,
+ ANDAND = 337,
+ BITOROP = 338,
+ BITANDOP = 339,
+ CHEQOP = 340,
+ NCEQOP = 341,
+ CHRELOP = 342,
+ NCRELOP = 343,
+ SHIFTOP = 344,
+ MATCHOP = 345,
+ PERLY_EXCLAMATION_MARK = 346,
+ PERLY_TILDE = 347,
+ UMINUS = 348,
+ REFGEN = 349,
+ POWOP = 350,
+ PREINC = 351,
+ PREDEC = 352,
+ POSTINC = 353,
+ POSTDEC = 354,
+ POSTJOIN = 355,
+ ARROW = 356
};
#endif
@@ -205,6 +206,6 @@ int yyparse (void);
/* Generated from:
- * 3b37f5e99c3211f5a689f0b84d2f93ccb2d9dcee38cf8543545147c2f3232e4d perly.y
+ * 4254f7a193750fc5d4d9a58ee880004d69cfaecdf245c298f9f6357f963e5f42 perly.y
* acf1cbfd2545faeaaa58b1cf0cf9d7f98b5be0752eb7a54528ef904a9e2e1ca7 regen_perly.pl
* ex: set ro: */
diff --git a/perly.tab b/perly.tab
index 3f20fa3ee9..50e2a9bf68 100644
--- a/perly.tab
+++ b/perly.tab
@@ -18,7 +18,7 @@
#define YYNSTATES 573
#define YYUNDEFTOK 2
-#define YYMAXUTOK 355
+#define YYMAXUTOK 356
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
@@ -35,7 +35,7 @@ static const yytype_int8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 109, 13, 2, 2,
108, 107, 110, 11, 2, 10, 2, 111, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 84, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 83, 12, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -63,9 +63,9 @@ static const yytype_int8 yytranslate[] =
49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
- 79, 80, 81, 82, 85, 86, 87, 88, 89, 90,
- 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
- 101, 102, 103, 104, 105, 106
+ 79, 80, 81, 82, 84, 85, 86, 87, 88, 89,
+ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+ 100, 101, 102, 103, 104, 105, 106
};
#if YYDEBUG
@@ -123,20 +123,20 @@ static const char *const yytname[] =
"YADAYADA", "FUNC0", "FUNC1", "FUNC", "UNIOP", "LSTOP", "MULOP", "ADDOP",
"DOLSHARP", "DO", "HASHBRACK", "NOAMP", "LOCAL", "MY", "REQUIRE",
"COLONATTR", "FORMLBRACK", "FORMRBRACK", "SUBLEXSTART", "SUBLEXEND",
- "PREC_LOW", "OROP", "DOROP", "ANDOP", "NOTOP", "ASSIGNOP", "'?'", "':'",
- "OROR", "DORDOR", "ANDAND", "BITOROP", "BITANDOP", "CHEQOP", "NCEQOP",
- "CHRELOP", "NCRELOP", "SHIFTOP", "MATCHOP", "PERLY_EXCLAMATION_MARK",
- "PERLY_TILDE", "UMINUS", "REFGEN", "POWOP", "PREINC", "PREDEC",
- "POSTINC", "POSTDEC", "POSTJOIN", "ARROW", "')'", "'('", "'$'", "'*'",
- "'/'", "$accept", "grammar", "@1", "@2", "@3", "@4", "@5", "@6", "@7",
- "block", "formblock", "remember", "mblock", "mremember", "stmtseq",
- "formstmtseq", "fullstmt", "labfullstmt", "barestmt", "$@8", "$@9",
- "$@10", "$@11", "$@12", "@13", "$@14", "formline", "formarg",
- "condition", "sideff", "else", "cont", "mintro", "nexpr", "texpr",
- "iexpr", "mexpr", "mnexpr", "formname", "startsub", "startanonsub",
- "startformsub", "subname", "proto", "subattrlist", "myattrlist",
- "sigvarname", "sigslurpsigil", "sigslurpelem", "sigdefault",
- "sigscalarelem", "sigelem", "siglist", "siglistornull",
+ "PREC_LOW", "OROP", "DOROP", "ANDOP", "NOTOP", "ASSIGNOP", "'?'",
+ "PERLY_COLON", "OROR", "DORDOR", "ANDAND", "BITOROP", "BITANDOP",
+ "CHEQOP", "NCEQOP", "CHRELOP", "NCRELOP", "SHIFTOP", "MATCHOP",
+ "PERLY_EXCLAMATION_MARK", "PERLY_TILDE", "UMINUS", "REFGEN", "POWOP",
+ "PREINC", "PREDEC", "POSTINC", "POSTDEC", "POSTJOIN", "ARROW", "')'",
+ "'('", "'$'", "'*'", "'/'", "$accept", "grammar", "@1", "@2", "@3", "@4",
+ "@5", "@6", "@7", "block", "formblock", "remember", "mblock",
+ "mremember", "stmtseq", "formstmtseq", "fullstmt", "labfullstmt",
+ "barestmt", "$@8", "$@9", "$@10", "$@11", "$@12", "@13", "$@14",
+ "formline", "formarg", "condition", "sideff", "else", "cont", "mintro",
+ "nexpr", "texpr", "iexpr", "mexpr", "mnexpr", "formname", "startsub",
+ "startanonsub", "startformsub", "subname", "proto", "subattrlist",
+ "myattrlist", "sigvarname", "sigslurpsigil", "sigslurpelem",
+ "sigdefault", "sigscalarelem", "sigelem", "siglist", "siglistornull",
"optsubsignature", "subsignature", "subsigguts", "$@15", "optsubbody",
"subbody", "optsigsubbody", "sigsubbody", "expr", "listexpr", "listop",
"@16", "method", "subscripted", "termbinop", "termrelop", "relopchain",
@@ -160,9 +160,9 @@ static const yytype_int16 yytoknum[] =
301, 302, 303, 304, 305, 306, 307, 308, 309, 310,
311, 312, 313, 314, 315, 316, 317, 318, 319, 320,
321, 322, 323, 324, 325, 326, 327, 328, 329, 330,
- 331, 332, 333, 63, 58, 334, 335, 336, 337, 338,
- 339, 340, 341, 342, 343, 344, 345, 346, 347, 348,
- 349, 350, 351, 352, 353, 354, 355, 41, 40, 36,
+ 331, 332, 333, 63, 334, 335, 336, 337, 338, 339,
+ 340, 341, 342, 343, 344, 345, 346, 347, 348, 349,
+ 350, 351, 352, 353, 354, 355, 356, 41, 40, 36,
42, 47
};
# endif
@@ -1177,20 +1177,20 @@ static const toketypes yy_type_tab[] =
toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
- toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
- toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
- toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
+ toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
+ toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
+ toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
- toketype_opval, toketype_opval, toketype_ival, toketype_opval, toketype_ival, toketype_opval,
- toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_ival, toketype_ival,
- toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_opval, toketype_opval,
- toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_ival, toketype_opval, toketype_opval,
- toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_ival, toketype_ival,
+ toketype_ival, toketype_ival, toketype_ival, toketype_opval, toketype_opval, toketype_ival, toketype_opval,
toketype_ival, toketype_opval, toketype_opval, toketype_opval, toketype_opval,
- toketype_opval, toketype_ival, toketype_opval, toketype_opval,
- toketype_opval, toketype_opval, toketype_opval, toketype_opval,
+ toketype_opval, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival, toketype_ival,
+ toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_ival,
+ toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_ival,
+ toketype_ival, toketype_ival, toketype_opval, toketype_opval, toketype_opval,
+ toketype_opval, toketype_opval, toketype_ival, toketype_opval,
+ toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_opval,
toketype_opval, toketype_opval, toketype_opval, toketype_ival, toketype_opval,
toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_opval,
toketype_ival, toketype_opval, toketype_opval, toketype_opval, toketype_opval, toketype_opval,
@@ -1201,6 +1201,6 @@ static const toketypes yy_type_tab[] =
};
/* Generated from:
- * 3b37f5e99c3211f5a689f0b84d2f93ccb2d9dcee38cf8543545147c2f3232e4d perly.y
+ * 4254f7a193750fc5d4d9a58ee880004d69cfaecdf245c298f9f6357f963e5f42 perly.y
* acf1cbfd2545faeaaa58b1cf0cf9d7f98b5be0752eb7a54528ef904a9e2e1ca7 regen_perly.pl
* ex: set ro: */
diff --git a/perly.y b/perly.y
index 67bbda88ec..b05536b23a 100644
--- a/perly.y
+++ b/perly.y
@@ -102,7 +102,7 @@
%nonassoc LSTOP LSTOPSUB
%left PERLY_COMMA
%right <ival> ASSIGNOP
-%right <ival> '?' ':'
+%right <ival> '?' PERLY_COLON
%nonassoc DOTDOT
%left <ival> OROR DORDOR
%left <ival> ANDAND
@@ -1158,7 +1158,7 @@ term[product] : termbinop
| termunop
| anonymous
| termdo
- | term[condition] '?' term[then] ':' term[else]
+ | term[condition] '?' term[then] PERLY_COLON term[else]
{ $$ = newCONDOP(0, $condition, $then, $else); }
| REFGEN term[operand] /* \$x, \@y, \%z */
{ $$ = newUNOP(OP_REFGEN, 0, $operand); }
diff --git a/toke.c b/toke.c
index 71b36e437a..a0c9c47970 100644
--- a/toke.c
+++ b/toke.c
@@ -391,6 +391,7 @@ static struct debug_tokens {
DEBUG_TOKEN (IVAL, PERLY_BRACE_OPEN),
DEBUG_TOKEN (IVAL, PERLY_BRACKET_CLOSE),
DEBUG_TOKEN (IVAL, PERLY_BRACKET_OPEN),
+ DEBUG_TOKEN (IVAL, PERLY_COLON),
DEBUG_TOKEN (IVAL, PERLY_COMMA),
DEBUG_TOKEN (IVAL, PERLY_DOT),
DEBUG_TOKEN (IVAL, PERLY_EQUAL_SIGN),
@@ -5910,7 +5911,7 @@ yyl_colon(pTHX_ char *s)
: "Unterminated attribute list" ) );
if (attrs)
op_free(attrs);
- OPERATOR(':');
+ OPERATOR(PERLY_COLON);
}
got_attrs:
@@ -5935,7 +5936,7 @@ yyl_colon(pTHX_ char *s)
}
PL_lex_allbrackets--;
- OPERATOR(':');
+ OPERATOR(PERLY_COLON);
}
static int