[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/2] pkl: parser: make parens optional for format
From: |
Jose E. Marchesi |
Subject: |
Re: [PATCH v2 2/2] pkl: parser: make parens optional for format |
Date: |
Sat, 22 Apr 2023 21:51:33 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Thanks! :)
OK for master.
> This commit improves user experience of poke for jemarch.
>
> 2023-04-21 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
>
> * libpoke/pkl-tab.y (primary): Add new rule for `format' with no
> parens.
> * testsuite/poke.pkl/format-74.pk: New test.
> * testsuite/Makefile.am (EXTRA_DIST): Update.
> ---
> ChangeLog | 7 +++++++
> libpoke/pkl-tab.y | 7 +++++++
> testsuite/Makefile.am | 1 +
> testsuite/poke.pkl/format-74.pk | 7 +++++++
> 4 files changed, 22 insertions(+)
> create mode 100644 testsuite/poke.pkl/format-74.pk
>
> diff --git a/ChangeLog b/ChangeLog
> index e0ceefba..61128120 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,10 @@
> +2023-04-21 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
> +
> + * libpoke/pkl-tab.y (primary): Add new rule for `format' with no
> + parens.
> + * testsuite/poke.pkl/format-74.pk: New test.
> + * testsuite/Makefile.am (EXTRA_DIST): Update.
> +
> 2023-04-21 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
>
> * libpoke/pkl-tab.y (primary): Remove typification of `format'.
> diff --git a/libpoke/pkl-tab.y b/libpoke/pkl-tab.y
> index 82d3168d..47023cc2 100644
> --- a/libpoke/pkl-tab.y
> +++ b/libpoke/pkl-tab.y
> @@ -1222,6 +1222,13 @@ primary:
> PKL_AST_LOC ($$) = @$;
>
> }
> + | FORMAT STR format_arg_list
> + {
> + $$ = pkl_ast_make_format (pkl_parser->ast, $2, $3,
> + 0 /* printf_p */);
> + PKL_AST_LOC ($2) = @2;
> + PKL_AST_LOC ($$) = @$;
> + }
> | expression INC
> {
> $$ = pkl_ast_make_incrdecr (pkl_parser->ast, $1,
> diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
> index de4bb752..a9c9a560 100644
> --- a/testsuite/Makefile.am
> +++ b/testsuite/Makefile.am
> @@ -1460,6 +1460,7 @@ EXTRA_DIST = \
> poke.pkl/format-71.pk \
> poke.pkl/format-72.pk \
> poke.pkl/format-73.pk \
> + poke.pkl/format-74.pk \
> poke.pkl/format-diag-1.pk \
> poke.pkl/format-diag-2.pk \
> poke.pkl/format-diag-3.pk \
> diff --git a/testsuite/poke.pkl/format-74.pk b/testsuite/poke.pkl/format-74.pk
> new file mode 100644
> index 00000000..8877e436
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-74.pk
> @@ -0,0 +1,7 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {.set obase 16} } */
> +/* { dg-command {format ""} } */
> +/* { dg-command {"\n"} } */
> +/* { dg-command {format "%i13x%s %u32x", -1, "Hello", 0xdeadbeef} } */
> +/* { dg-command {"1fffHello deadbeef"} } */