Commit 84766b75bc for perl
commit 84766b75bce121e8e0f0e74c96e25d412c83edf5
Author: Branislav Zahradník <barney@cpan.org>
Date: Sun Sep 27 13:58:07 2026 +0200
[perly] function invocation -> Start each sequence with example comment
Move grammar explanatory comments to the top of each alternative sequence.
This places example comments before the matching grammar rules rather than
embedded within or after them, making the grammar structure easier to follow.
diff --git a/perly.act b/perly.act
index 64fdada0f3..ca2fb58fad 100644
--- a/perly.act
+++ b/perly.act
@@ -2407,6 +2407,6 @@ case 2: /* @1: %empty */
/* Generated from:
- * ace56d97c7f5e3d041e7e3a801bb6e97384ddd1e10f1d8ed0d033e4b65f73f67 perly.y
+ * cbcd672850d1d32b4e4feded7a9fa38c273538bf99d2ad644b5387f2a8a42f6d perly.y
* ba173fe7f0e9b6b5465fb5d0705af3290ac7d8b511f0eead585307eb6c68918d regen_perly.pl
* ex: set ro ft=c: */
diff --git a/perly.h b/perly.h
index 3f44d1c3d5..2c2714534e 100644
--- a/perly.h
+++ b/perly.h
@@ -248,6 +248,6 @@ int yyparse (void);
/* Generated from:
- * ace56d97c7f5e3d041e7e3a801bb6e97384ddd1e10f1d8ed0d033e4b65f73f67 perly.y
+ * cbcd672850d1d32b4e4feded7a9fa38c273538bf99d2ad644b5387f2a8a42f6d perly.y
* ba173fe7f0e9b6b5465fb5d0705af3290ac7d8b511f0eead585307eb6c68918d regen_perly.pl
* ex: set ro ft=c: */
diff --git a/perly.tab b/perly.tab
index 310723172b..563a9a2c39 100644
--- a/perly.tab
+++ b/perly.tab
@@ -385,8 +385,8 @@ static const yytype_int16 yyrline[] =
1219, 1223, 1227, 1227, 1260, 1261, 1267, 1266, 1283, 1284,
1289, 1294, 1288, 1306, 1308, 1310, 1312, 1314, 1318, 1320,
1325, 1329, 1333, 1337, 1342, 1356, 1367, 1382, 1394, 1405,
- 1417, 1419, 1421, 1427, 1423, 1454, 1455, 1459, 1463, 1466,
- 1471, 1474, 1478, 1496, 1509, 1511, 1513, 1518, 1520, 1522,
+ 1417, 1419, 1421, 1427, 1424, 1454, 1455, 1459, 1463, 1466,
+ 1471, 1474, 1479, 1496, 1509, 1511, 1513, 1518, 1520, 1522,
1524, 1526, 1528, 1533, 1535, 1537, 1539, 1541, 1543, 1545,
1547, 1549, 1551, 1553, 1555, 1557, 1559, 1561, 1563, 1567,
1569, 1571, 1573, 1575, 1579, 1581, 1585, 1587, 1589, 1591,
@@ -394,9 +394,9 @@ static const yytype_int16 yyrline[] =
1631, 1639, 1641, 1643, 1646, 1648, 1651, 1653, 1658, 1663,
1665, 1669, 1670, 1671, 1672, 1673, 1675, 1677, 1679, 1681,
1683, 1685, 1687, 1689, 1691, 1693, 1695, 1697, 1699, 1709,
- 1719, 1729, 1739, 1741, 1750, 1761, 1777, 1792, 1794, 1796,
+ 1719, 1729, 1739, 1742, 1751, 1762, 1778, 1792, 1794, 1796,
1798, 1801, 1803, 1806, 1808, 1810, 1812, 1814, 1816, 1818,
- 1820, 1828, 1842, 1844, 1846, 1848, 1850, 1859, 1863, 1866,
+ 1820, 1829, 1842, 1844, 1846, 1848, 1851, 1859, 1863, 1866,
1865, 1878, 1879, 1880, 1885, 1887, 1889, 1891, 1896, 1898,
1901, 1903, 1905, 1910, 1915, 1920, 1928, 1936, 1935, 1953,
1954, 1958, 1959, 1963, 1964, 1969, 1974, 1976, 1980, 1984,
@@ -1667,6 +1667,6 @@ static const toketypes yy_type_tab[] =
};
/* Generated from:
- * ace56d97c7f5e3d041e7e3a801bb6e97384ddd1e10f1d8ed0d033e4b65f73f67 perly.y
+ * cbcd672850d1d32b4e4feded7a9fa38c273538bf99d2ad644b5387f2a8a42f6d perly.y
* ba173fe7f0e9b6b5465fb5d0705af3290ac7d8b511f0eead585307eb6c68918d regen_perly.pl
* ex: set ro ft=c: */
diff --git a/perly.y b/perly.y
index 629f4447aa..80f4d93943 100644
--- a/perly.y
+++ b/perly.y
@@ -1420,10 +1420,10 @@ listop : LSTOP indirob listexpr /* map {...} @args or print $fh @args */
{ $$ = op_convert_list($FUNC, 0, $optexpr); }
| FUNC SUBLEXSTART optexpr SUBLEXEND /* uc($arg) from "\U..." */
{ $$ = op_convert_list($FUNC, 0, $optexpr); }
- | LSTOPSUB
+ | /* sub f(&@); f { foo } ... */
+ LSTOPSUB
startanonsub
block
- /* sub f(&@); f { foo } ... */
{
SvREFCNT_inc_simple_void(PL_compcv);
$<opval>$ = newANONATTRSUB($startanonsub, 0, NULL, $block);
@@ -1475,11 +1475,11 @@ subscripted: gelem subscript_keys[selector] /* *main::{something} */
{ $$ = newBINOP(OP_HELEM, 0,
ref(newHVREF($hash_reference),OP_RV2HV),
jmaybe($selector)); }
- | subscriptable_reference [code_reference]
+ | /* $subref->(@args); $foo->{bar}(@args) */
+ subscriptable_reference [code_reference]
PERLY_PAREN_OPEN
expr
PERLY_PAREN_CLOSE
- /* $subref->(@args); $foo->{bar}(@args) */
{
$$ = newUNOP (
OP_ENTERSUB,
@@ -1738,8 +1738,8 @@ term[product] : termbinop
}
| THING %prec PERLY_PAREN_OPEN
{ $$ = $THING; }
- | amper
- /* &foo; */
+ | /* &foo; */
+ amper
{
$$ = newUNOP (
OP_ENTERSUB,
@@ -1747,10 +1747,10 @@ term[product] : termbinop
scalar ($amper)
);
}
- | amper
+ | /* &foo() or foo() */
+ amper
PERLY_PAREN_OPEN
PERLY_PAREN_CLOSE
- /* &foo() or foo() */
{
$$ = newUNOP (
OP_ENTERSUB,
@@ -1758,11 +1758,11 @@ term[product] : termbinop
scalar ($amper)
);
}
- | amper
+ | /* &foo(@args) or foo(@args) */
+ amper
PERLY_PAREN_OPEN
expr
PERLY_PAREN_CLOSE
- /* &foo(@args) or foo(@args) */
{
$$ = newUNOP (
OP_ENTERSUB,
@@ -1774,10 +1774,10 @@ term[product] : termbinop
)
);
}
- | NOAMP
+ | /* foo @args (no parens) */
+ NOAMP
subname
optlistexpr
- /* foo @args (no parens) */
{
$$ = newUNOP (
OP_ENTERSUB,
@@ -1825,9 +1825,9 @@ term[product] : termbinop
scalar ($UNIOPSUB)
);
}
- | UNIOPSUB
+ | /* Sub treated as unop */
+ UNIOPSUB
term[operand]
- /* Sub treated as unop */
{
$$ = newUNOP (
OP_ENTERSUB,
@@ -1847,8 +1847,8 @@ term[product] : termbinop
{ $$ = $FUNC0OP; }
| FUNC0OP PERLY_PAREN_OPEN PERLY_PAREN_CLOSE
{ $$ = $FUNC0OP; }
- | FUNC0SUB
- /* Sub treated as nullop */
+ | /* Sub treated as nullop */
+ FUNC0SUB
{
$$ = newUNOP (
OP_ENTERSUB,