aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-04-14 07:00:15 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-04-14 07:00:15 -0700
commitf00e74ffc73f6ba6fe74fb7a26319770b8c3792c (patch)
tree931278a791b5ed7bacd47ce35c7ed224a9e0ccce /doc
parentd3064bd9a5116f57e60f3da91ffcf3f1a58b9ab0 (diff)
downloadegawk-master.tar.gz
egawk-master.tar.bz2
egawk-master.zip
@let: allow trailing comma.HEADmaster
We allow forms like @let(x,) and @let(x, y=1,) with the trailing comma. This is helpful for code generators and macros, which can then treat temporary variables as comma-terminated items. * awkgram.y (let_var_list_opt): Add a production which matches a trailing comma after let_var_list. * test/let1.awk, test/let1.ok: Test cases. * doc/gawkt.texi, doc/gawktexi.in: Trailing comma documented. * awkgram.c: Regenerated with Bison 3.8.
Diffstat (limited to 'doc')
-rw-r--r--doc/gawk.texi7
-rw-r--r--doc/gawktexi.in7
2 files changed, 12 insertions, 2 deletions
diff --git a/doc/gawk.texi b/doc/gawk.texi
index dea485c6..2535e45a 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -21658,7 +21658,7 @@ statement.
The @code{@@let} statement is introduced by the @code{@@} symbol
followed by the special keyword @code{let}. These tokens are
-then followed by a comma-separated list of variable declarators,
+then followed by a comma-separated or comma-terminated list of variable declarators,
enclosed in parentheses. After the parentheses comes a required statement,
The list of variables may be empty.
@@ -21809,6 +21809,11 @@ The @code{print} statement is then executed in the scope of the
rightmost @code{x}. The initializing expressions @code{x + 1}
have the previous @code{x} still in scope.
+The @code{@@let} statement allows a trailing comma after the last
+variable declarator. Effectively, the declarators can be regarded
+as either comma-separated or comma-terminated. Comma termination is
+easier to deal with in macro preprocessing and code generation.
+
@node Pass By Value/Reference
@subsubsection Passing Function Arguments by Value Or by Reference
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 651bd8d2..0bb4f4dc 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -20570,7 +20570,7 @@ statement.
The @code{@@let} statement is introduced by the @code{@@} symbol
followed by the special keyword @code{let}. These tokens are
-then followed by a comma-separated list of variable declarators,
+then followed by a comma-separated or comma-terminated list of variable declarators,
enclosed in parentheses. After the parentheses comes a required statement,
The list of variables may be empty.
@@ -20721,6 +20721,11 @@ The @code{print} statement is then executed in the scope of the
rightmost @code{x}. The initializing expressions @code{x + 1}
have the previous @code{x} still in scope.
+The @code{@@let} statement allows a trailing comma after the last
+variable declarator. Effectively, the declarators can be regarded
+as either comma-separated or comma-terminated. Comma termination is
+easier to deal with in macro preprocessing and code generation.
+
@node Pass By Value/Reference
@subsubsection Passing Function Arguments by Value Or by Reference