poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] pkl: parser: make parens optional for format


From: Jose E. Marchesi
Subject: Re: [PATCH] pkl: parser: make parens optional for format
Date: Mon, 10 Oct 2022 18:46:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> This commit improves user experience of poke for jemarch.

This patch is OK provided the bison parser doesn't report ambiguities.

But if all these new tests are replicating logic in previous tests, I
don't think there is the need to do so.  I would just add a couple of
tests using the new syntax: with arguments and without arguments.  That
ought to b enough I think.

(And yes I like this patch :P)

>
> 2022-09-26  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
>
>       * libpoke/pkl-tab.y (primary): Add new rule for `format' with no
>       parens.
>       * testsuite/poke.pkl/format-43.pk: New test.
>       * testsuite/poke.pkl/format-44.pk: Likewise.
>       * testsuite/poke.pkl/format-45.pk: Likewise.
>       * testsuite/poke.pkl/format-46.pk: Likewise.
>       * testsuite/poke.pkl/format-47.pk: Likewise.
>       * testsuite/poke.pkl/format-48.pk: Likewise.
>       * testsuite/poke.pkl/format-49.pk: Likewise.
>       * testsuite/poke.pkl/format-50.pk: Likewise.
>       * testsuite/poke.pkl/format-51.pk: Likewise.
>       * testsuite/poke.pkl/format-52.pk: Likewise.
>       * testsuite/poke.pkl/format-53.pk: Likewise.
>       * testsuite/poke.pkl/format-54.pk: Likewise.
>       * testsuite/poke.pkl/format-55.pk: Likewise.
>       * testsuite/poke.pkl/format-56.pk: Likewise.
>       * testsuite/poke.pkl/format-57.pk: Likewise.
>       * testsuite/poke.pkl/format-58.pk: Likewise.
>       * testsuite/poke.pkl/format-59.pk: Likewise.
>       * testsuite/poke.pkl/format-60.pk: Likewise.
>       * testsuite/poke.pkl/format-61.pk: Likewise.
>       * testsuite/poke.pkl/format-62.pk: Likewise.
>       * testsuite/poke.pkl/format-63.pk: Likewise.
>       * testsuite/poke.pkl/format-64.pk: Likewise.
>       * testsuite/poke.pkl/format-65.pk: Likewise.
>       * testsuite/poke.pkl/format-66.pk: Likewise.
>       * testsuite/poke.pkl/format-67.pk: Likewise.
>       * testsuite/poke.pkl/format-68.pk: Likewise.
>       * testsuite/poke.pkl/format-69.pk: Likewise.
>       * testsuite/poke.pkl/format-70.pk: Likewise.
>       * testsuite/poke.pkl/format-71.pk: Likewise.
>       * testsuite/poke.pkl/format-72.pk: Likewise.
>       * testsuite/poke.pkl/format-73.pk: Likewise.
>       * testsuite/poke.pkl/format-74.pk: Likewise.
>       * testsuite/poke.pkl/format-75.pk: Likewise.
>       * testsuite/poke.pkl/format-76.pk: Likewise.
>       * testsuite/poke.pkl/format-77.pk: Likewise.
>       * testsuite/poke.pkl/format-78.pk: Likewise.
>       * testsuite/poke.pkl/format-79.pk: Likewise.
>       * testsuite/poke.pkl/format-80.pk: Likewise.
>       * testsuite/poke.pkl/format-81.pk: Likewise.
>       * testsuite/poke.pkl/format-82.pk: Likewise.
>       * testsuite/poke.pkl/format-83.pk: Likewise.
>       * testsuite/poke.pkl/format-84.pk: Likewise.
>       * testsuite/Makefile.am (EXTRA_DIST): Update.
> ---
>  ChangeLog                       | 48 +++++++++++++++++++++++++++++++++
>  libpoke/pkl-tab.y               | 12 +++++++++
>  testsuite/Makefile.am           | 42 +++++++++++++++++++++++++++++
>  testsuite/poke.pkl/format-43.pk | 21 +++++++++++++++
>  testsuite/poke.pkl/format-44.pk | 20 ++++++++++++++
>  testsuite/poke.pkl/format-45.pk | 20 ++++++++++++++
>  testsuite/poke.pkl/format-46.pk | 20 ++++++++++++++
>  testsuite/poke.pkl/format-47.pk |  4 +++
>  testsuite/poke.pkl/format-48.pk |  4 +++
>  testsuite/poke.pkl/format-49.pk |  4 +++
>  testsuite/poke.pkl/format-50.pk |  7 +++++
>  testsuite/poke.pkl/format-51.pk |  7 +++++
>  testsuite/poke.pkl/format-52.pk |  7 +++++
>  testsuite/poke.pkl/format-53.pk |  7 +++++
>  testsuite/poke.pkl/format-54.pk |  7 +++++
>  testsuite/poke.pkl/format-55.pk |  4 +++
>  testsuite/poke.pkl/format-56.pk |  4 +++
>  testsuite/poke.pkl/format-57.pk |  4 +++
>  testsuite/poke.pkl/format-58.pk |  7 +++++
>  testsuite/poke.pkl/format-59.pk |  7 +++++
>  testsuite/poke.pkl/format-60.pk |  4 +++
>  testsuite/poke.pkl/format-61.pk |  5 ++++
>  testsuite/poke.pkl/format-62.pk |  7 +++++
>  testsuite/poke.pkl/format-63.pk | 13 +++++++++
>  testsuite/poke.pkl/format-64.pk | 13 +++++++++
>  testsuite/poke.pkl/format-65.pk | 13 +++++++++
>  testsuite/poke.pkl/format-66.pk | 14 ++++++++++
>  testsuite/poke.pkl/format-67.pk | 15 +++++++++++
>  testsuite/poke.pkl/format-68.pk | 17 ++++++++++++
>  testsuite/poke.pkl/format-69.pk | 16 +++++++++++
>  testsuite/poke.pkl/format-70.pk | 17 ++++++++++++
>  testsuite/poke.pkl/format-71.pk | 11 ++++++++
>  testsuite/poke.pkl/format-72.pk |  6 +++++
>  testsuite/poke.pkl/format-73.pk |  6 +++++
>  testsuite/poke.pkl/format-74.pk |  6 +++++
>  testsuite/poke.pkl/format-75.pk |  6 +++++
>  testsuite/poke.pkl/format-76.pk |  6 +++++
>  testsuite/poke.pkl/format-77.pk |  6 +++++
>  testsuite/poke.pkl/format-78.pk |  5 ++++
>  testsuite/poke.pkl/format-79.pk |  6 +++++
>  testsuite/poke.pkl/format-80.pk |  6 +++++
>  testsuite/poke.pkl/format-81.pk |  6 +++++
>  testsuite/poke.pkl/format-82.pk |  5 ++++
>  testsuite/poke.pkl/format-83.pk |  5 ++++
>  testsuite/poke.pkl/format-84.pk |  5 ++++
>  45 files changed, 475 insertions(+)
>  create mode 100644 testsuite/poke.pkl/format-43.pk
>  create mode 100644 testsuite/poke.pkl/format-44.pk
>  create mode 100644 testsuite/poke.pkl/format-45.pk
>  create mode 100644 testsuite/poke.pkl/format-46.pk
>  create mode 100644 testsuite/poke.pkl/format-47.pk
>  create mode 100644 testsuite/poke.pkl/format-48.pk
>  create mode 100644 testsuite/poke.pkl/format-49.pk
>  create mode 100644 testsuite/poke.pkl/format-50.pk
>  create mode 100644 testsuite/poke.pkl/format-51.pk
>  create mode 100644 testsuite/poke.pkl/format-52.pk
>  create mode 100644 testsuite/poke.pkl/format-53.pk
>  create mode 100644 testsuite/poke.pkl/format-54.pk
>  create mode 100644 testsuite/poke.pkl/format-55.pk
>  create mode 100644 testsuite/poke.pkl/format-56.pk
>  create mode 100644 testsuite/poke.pkl/format-57.pk
>  create mode 100644 testsuite/poke.pkl/format-58.pk
>  create mode 100644 testsuite/poke.pkl/format-59.pk
>  create mode 100644 testsuite/poke.pkl/format-60.pk
>  create mode 100644 testsuite/poke.pkl/format-61.pk
>  create mode 100644 testsuite/poke.pkl/format-62.pk
>  create mode 100644 testsuite/poke.pkl/format-63.pk
>  create mode 100644 testsuite/poke.pkl/format-64.pk
>  create mode 100644 testsuite/poke.pkl/format-65.pk
>  create mode 100644 testsuite/poke.pkl/format-66.pk
>  create mode 100644 testsuite/poke.pkl/format-67.pk
>  create mode 100644 testsuite/poke.pkl/format-68.pk
>  create mode 100644 testsuite/poke.pkl/format-69.pk
>  create mode 100644 testsuite/poke.pkl/format-70.pk
>  create mode 100644 testsuite/poke.pkl/format-71.pk
>  create mode 100644 testsuite/poke.pkl/format-72.pk
>  create mode 100644 testsuite/poke.pkl/format-73.pk
>  create mode 100644 testsuite/poke.pkl/format-74.pk
>  create mode 100644 testsuite/poke.pkl/format-75.pk
>  create mode 100644 testsuite/poke.pkl/format-76.pk
>  create mode 100644 testsuite/poke.pkl/format-77.pk
>  create mode 100644 testsuite/poke.pkl/format-78.pk
>  create mode 100644 testsuite/poke.pkl/format-79.pk
>  create mode 100644 testsuite/poke.pkl/format-80.pk
>  create mode 100644 testsuite/poke.pkl/format-81.pk
>  create mode 100644 testsuite/poke.pkl/format-82.pk
>  create mode 100644 testsuite/poke.pkl/format-83.pk
>  create mode 100644 testsuite/poke.pkl/format-84.pk
>
> diff --git a/ChangeLog b/ChangeLog
> index fc4ab6f7..322cfbaf 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,51 @@
> +2022-09-26  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
> +
> +     * libpoke/pkl-tab.y (primary): Add new rule for `format' with no
> +     parens.
> +     * testsuite/poke.pkl/format-43.pk: New test.
> +     * testsuite/poke.pkl/format-44.pk: Likewise.
> +     * testsuite/poke.pkl/format-45.pk: Likewise.
> +     * testsuite/poke.pkl/format-46.pk: Likewise.
> +     * testsuite/poke.pkl/format-47.pk: Likewise.
> +     * testsuite/poke.pkl/format-48.pk: Likewise.
> +     * testsuite/poke.pkl/format-49.pk: Likewise.
> +     * testsuite/poke.pkl/format-50.pk: Likewise.
> +     * testsuite/poke.pkl/format-51.pk: Likewise.
> +     * testsuite/poke.pkl/format-52.pk: Likewise.
> +     * testsuite/poke.pkl/format-53.pk: Likewise.
> +     * testsuite/poke.pkl/format-54.pk: Likewise.
> +     * testsuite/poke.pkl/format-55.pk: Likewise.
> +     * testsuite/poke.pkl/format-56.pk: Likewise.
> +     * testsuite/poke.pkl/format-57.pk: Likewise.
> +     * testsuite/poke.pkl/format-58.pk: Likewise.
> +     * testsuite/poke.pkl/format-59.pk: Likewise.
> +     * testsuite/poke.pkl/format-60.pk: Likewise.
> +     * testsuite/poke.pkl/format-61.pk: Likewise.
> +     * testsuite/poke.pkl/format-62.pk: Likewise.
> +     * testsuite/poke.pkl/format-63.pk: Likewise.
> +     * testsuite/poke.pkl/format-64.pk: Likewise.
> +     * testsuite/poke.pkl/format-65.pk: Likewise.
> +     * testsuite/poke.pkl/format-66.pk: Likewise.
> +     * testsuite/poke.pkl/format-67.pk: Likewise.
> +     * testsuite/poke.pkl/format-68.pk: Likewise.
> +     * testsuite/poke.pkl/format-69.pk: Likewise.
> +     * testsuite/poke.pkl/format-70.pk: Likewise.
> +     * testsuite/poke.pkl/format-71.pk: Likewise.
> +     * testsuite/poke.pkl/format-72.pk: Likewise.
> +     * testsuite/poke.pkl/format-73.pk: Likewise.
> +     * testsuite/poke.pkl/format-74.pk: Likewise.
> +     * testsuite/poke.pkl/format-75.pk: Likewise.
> +     * testsuite/poke.pkl/format-76.pk: Likewise.
> +     * testsuite/poke.pkl/format-77.pk: Likewise.
> +     * testsuite/poke.pkl/format-78.pk: Likewise.
> +     * testsuite/poke.pkl/format-79.pk: Likewise.
> +     * testsuite/poke.pkl/format-80.pk: Likewise.
> +     * testsuite/poke.pkl/format-81.pk: Likewise.
> +     * testsuite/poke.pkl/format-82.pk: Likewise.
> +     * testsuite/poke.pkl/format-83.pk: Likewise.
> +     * testsuite/poke.pkl/format-84.pk: Likewise.
> +     * testsuite/Makefile.am (EXTRA_DIST): Update.
> +
>  2022-10-10  Jose E. Marchesi  <jemarch@gnu.org>
>  
>       * libpoke/pkl-rt.pk (_pkl_print_any): `depth' defaults to 1.
> diff --git a/libpoke/pkl-tab.y b/libpoke/pkl-tab.y
> index 0fb7335b..a9367a6b 100644
> --- a/libpoke/pkl-tab.y
> +++ b/libpoke/pkl-tab.y
> @@ -1230,6 +1230,18 @@ primary:
>                    PKL_AST_LOC ($$) = @$;
>                    PKL_AST_LOC (PKL_AST_TYPE ($$)) = @$;
>                  }
> +        | FORMAT STR format_arg_list
> +                {
> +                  $$ = pkl_ast_make_format (pkl_parser->ast, $2, $3,
> +                                            0 /* printf_p */);
> +                  PKL_AST_TYPE ($$)
> +                      = ASTREF (pkl_ast_make_string_type (pkl_parser->ast));
> +                  PKL_AST_LOC ($2) = @2;
> +                  if (PKL_AST_TYPE ($2))
> +                    PKL_AST_LOC (PKL_AST_TYPE ($2)) = @2;
> +                  PKL_AST_LOC ($$) = @$;
> +                  PKL_AST_LOC (PKL_AST_TYPE ($$)) = @$;
> +                }
>          | expression INC
>                  {
>                    $$ = pkl_ast_make_incrdecr (pkl_parser->ast, $1,
> diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
> index ae954a52..2a4354b3 100644
> --- a/testsuite/Makefile.am
> +++ b/testsuite/Makefile.am
> @@ -1342,6 +1342,48 @@ EXTRA_DIST = \
>    poke.pkl/format-40.pk \
>    poke.pkl/format-41.pk \
>    poke.pkl/format-42.pk \
> +  poke.pkl/format-43.pk \
> +  poke.pkl/format-44.pk \
> +  poke.pkl/format-45.pk \
> +  poke.pkl/format-46.pk \
> +  poke.pkl/format-47.pk \
> +  poke.pkl/format-48.pk \
> +  poke.pkl/format-49.pk \
> +  poke.pkl/format-50.pk \
> +  poke.pkl/format-51.pk \
> +  poke.pkl/format-52.pk \
> +  poke.pkl/format-53.pk \
> +  poke.pkl/format-54.pk \
> +  poke.pkl/format-55.pk \
> +  poke.pkl/format-56.pk \
> +  poke.pkl/format-57.pk \
> +  poke.pkl/format-58.pk \
> +  poke.pkl/format-59.pk \
> +  poke.pkl/format-60.pk \
> +  poke.pkl/format-61.pk \
> +  poke.pkl/format-62.pk \
> +  poke.pkl/format-63.pk \
> +  poke.pkl/format-64.pk \
> +  poke.pkl/format-65.pk \
> +  poke.pkl/format-66.pk \
> +  poke.pkl/format-67.pk \
> +  poke.pkl/format-68.pk \
> +  poke.pkl/format-69.pk \
> +  poke.pkl/format-70.pk \
> +  poke.pkl/format-71.pk \
> +  poke.pkl/format-72.pk \
> +  poke.pkl/format-73.pk \
> +  poke.pkl/format-74.pk \
> +  poke.pkl/format-75.pk \
> +  poke.pkl/format-76.pk \
> +  poke.pkl/format-77.pk \
> +  poke.pkl/format-78.pk \
> +  poke.pkl/format-79.pk \
> +  poke.pkl/format-80.pk \
> +  poke.pkl/format-81.pk \
> +  poke.pkl/format-82.pk \
> +  poke.pkl/format-83.pk \
> +  poke.pkl/format-84.pk \
>    poke.pkl/format-diag-1.pk \
>    poke.pkl/format-optcond-1.pk \
>    poke.pkl/format-optcond-2.pk \
> diff --git a/testsuite/poke.pkl/format-43.pk b/testsuite/poke.pkl/format-43.pk
> new file mode 100644
> index 00000000..6b694741
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-43.pk
> @@ -0,0 +1,21 @@
> +/* { dg-do run } */
> +
> +var eq = [
> +  (format "") == "",
> +  (format "%i1b", 0) == "0",
> +  (format "%i8b", 1) == "00000001",
> +  (format "%i8b", -1) == "11111111",
> +  (format "%u8b", 1) == "00000001",
> +  (format "%u8b", -1) == "11111111",
> +  (format "%i13b", -1 as uint<64>) == "1" * 13,
> +  (format "%i16b", -1) == "1" * 16,
> +  (format "%i16b", 0xa5) == "0" * 8 + "10100101",
> +  (format "%i16b", 0xa5) == "0" * 8 + "10100101",
> +  (format "%u16b", 0xa5) == "0" * 8 + "10100101",
> +  (format "%i32b", 0xdeadbeaf) == "11011110101011011011111010101111",
> +  (format "%u32b", 0xdeadbeaf) == "11011110101011011011111010101111",
> +  (format "%u63b", -1 as uint<64>) == "1" * 63,
> +  (format "%u64b", -1 as uint<64>) == "1" * 64,
> +];
> +
> +for (i in eq) printf ("%i32d", i); /* { dg-output "111111111111111" } */
> diff --git a/testsuite/poke.pkl/format-44.pk b/testsuite/poke.pkl/format-44.pk
> new file mode 100644
> index 00000000..501fc8ef
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-44.pk
> @@ -0,0 +1,20 @@
> +/* { dg-do run } */
> +
> +var eq = [
> +  (format "%i1o", 0) == "0",
> +  (format "%i8o", 0) == "000",
> +  (format "%i8o", 1) == "001",
> +  (format "%i8o", -1) == "377",
> +  (format "%u8o", 1) == "001",
> +  (format "%u8o", -1) == "377",
> +  (format "%i13o", -1) == "1" + "7" * 4,
> +  (format "%i16o", -1) == "1" + "7" * 5,
> +  (format "%i16o", 0xa5) == "000245",
> +  (format "%u16o", 0xa5) == "000245",
> +  (format "%i32o", 0xdeadbeef) == "33653337357",
> +  (format "%u32o", 0xdeadbeef) == "33653337357",
> +  (format "%u63o", -1 as uint<64>) == "7" * 21,
> +  (format "%u64o", -1 as uint<64>) == "1" + "7" * 21,
> +];
> +
> +for (i in eq) printf ("%i32d", i); /* { dg-output "11111111111111" } */
> diff --git a/testsuite/poke.pkl/format-45.pk b/testsuite/poke.pkl/format-45.pk
> new file mode 100644
> index 00000000..18a7c08e
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-45.pk
> @@ -0,0 +1,20 @@
> +/* { dg-do run } */
> +
> +var eq = [
> +  (format "%i1d", 0) == "0",
> +  (format "%i8d", 0) == "0",
> +  (format "%i8d", 1) == "1",
> +  (format "%i8d", -1) == "-1",
> +  (format "%u8d", 1) == "1",
> +  (format "%u8d", -1) == "255",
> +  (format "%i13d", -1) == "-1",
> +  (format "%i16d", -1) == "-1",
> +  (format "%i16d", 0xa5) == "165",
> +  (format "%u16d", 0xa5) == "165",
> +  (format "%i32d", 0xdeadbeef) == "-559038737",
> +  (format "%u32d", 0xdeadbeef) == "3735928559",
> +  (format "%u63d", -1 as uint<64>) == "9223372036854775807",
> +  (format "%u64d", -1 as uint<64>) == "18446744073709551615",
> +];
> +
> +for (i in eq) printf ("%i32d", i); /* { dg-output "11111111111111" } */
> diff --git a/testsuite/poke.pkl/format-46.pk b/testsuite/poke.pkl/format-46.pk
> new file mode 100644
> index 00000000..2b9121e6
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-46.pk
> @@ -0,0 +1,20 @@
> +/* { dg-do run } */
> +
> +var eq = [
> +  (format "%i1x", 0) == "0",
> +  (format "%i8x", 0) == "00",
> +  (format "%i8x", 1) == "01",
> +  (format "%i8x", -1) == "ff",
> +  (format "%u8x", 1) == "01",
> +  (format "%u8x", -1) == "ff",
> +  (format "%i13x", -1) == "1" + "f" * 3,
> +  (format "%i16x", -1) == "ffff",
> +  (format "%i16x", 0xa5) == "00a5",
> +  (format "%u16x", 0xa5) == "00a5",
> +  (format "%i32x", 0xdeadbeef) == "deadbeef",
> +  (format "%u32x", 0xdeadbeef) == "deadbeef",
> +  (format "%u63x", -1 as uint<64>) == "7" + "f" * 15,
> +  (format "%u64x", -1 as uint<64>) == "f" * 16,
> +];
> +
> +for (i in eq) printf ("%i32d", i); /* { dg-output "11111111111111" } */
> diff --git a/testsuite/poke.pkl/format-47.pk b/testsuite/poke.pkl/format-47.pk
> new file mode 100644
> index 00000000..d520c618
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-47.pk
> @@ -0,0 +1,4 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {format "Hello"} } */
> +/* { dg-output {"Hello"} } */
> diff --git a/testsuite/poke.pkl/format-48.pk b/testsuite/poke.pkl/format-48.pk
> new file mode 100644
> index 00000000..0a23a1e7
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-48.pk
> @@ -0,0 +1,4 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {format "Hello, %s!", "World"} } */
> +/* { dg-output {"Hello, World!"} } */
> diff --git a/testsuite/poke.pkl/format-49.pk b/testsuite/poke.pkl/format-49.pk
> new file mode 100644
> index 00000000..ef6ae659
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-49.pk
> @@ -0,0 +1,4 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {format "%s%s%s", "GNU", "", "poke"} } */
> +/* { dg-output {"GNUpoke"} } */
> diff --git a/testsuite/poke.pkl/format-50.pk b/testsuite/poke.pkl/format-50.pk
> new file mode 100644
> index 00000000..b20743b4
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-50.pk
> @@ -0,0 +1,7 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {vm_set_obase (16)} } */
> +/* { dg-command {format "%v", 1} } */
> +/* { dg-output {"0x00000001"\n} } */
> +/* { dg-command {format "%v", 1U} } */
> +/* { dg-output {"0x00000001U"\n} } */
> diff --git a/testsuite/poke.pkl/format-51.pk b/testsuite/poke.pkl/format-51.pk
> new file mode 100644
> index 00000000..c0f2264c
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-51.pk
> @@ -0,0 +1,7 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {vm_set_obase (16)} } */
> +/* { dg-command {format "%v", 1UN} } */
> +/* { dg-output {"0x1UN"\n} } */
> +/* { dg-command {format "%v", 1N} } */
> +/* { dg-output {"0x1N"\n} } */
> diff --git a/testsuite/poke.pkl/format-52.pk b/testsuite/poke.pkl/format-52.pk
> new file mode 100644
> index 00000000..504c80c5
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-52.pk
> @@ -0,0 +1,7 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {vm_set_obase (16)} } */
> +/* { dg-command {format "%v", 1UB} } */
> +/* { dg-output {"0x01UB"\n} } */
> +/* { dg-command {format "%v", 1B} } */
> +/* { dg-output {"0x01B"\n} } */
> diff --git a/testsuite/poke.pkl/format-53.pk b/testsuite/poke.pkl/format-53.pk
> new file mode 100644
> index 00000000..a4665fe1
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-53.pk
> @@ -0,0 +1,7 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {vm_set_obase (16)} } */
> +/* { dg-command {format "%v", 1UH} } */
> +/* { dg-output {"0x0001UH"\n} } */
> +/* { dg-command {format "%v", 1H} } */
> +/* { dg-output {"0x0001H"\n} } */
> diff --git a/testsuite/poke.pkl/format-54.pk b/testsuite/poke.pkl/format-54.pk
> new file mode 100644
> index 00000000..06f0c3c3
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-54.pk
> @@ -0,0 +1,7 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {vm_set_obase (16)} } */
> +/* { dg-command {format "%v", 1UL} } */
> +/* { dg-output {"0x0000000000000001UL"\n} } */
> +/* { dg-command {format "%v", 1L} } */
> +/* { dg-output {"0x0000000000000001L"\n} } */
> diff --git a/testsuite/poke.pkl/format-55.pk b/testsuite/poke.pkl/format-55.pk
> new file mode 100644
> index 00000000..cfa55408
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-55.pk
> @@ -0,0 +1,4 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {format "%v", "Hello"} } */
> +/* { dg-output {"\\"Hello\\""} } */
> diff --git a/testsuite/poke.pkl/format-56.pk b/testsuite/poke.pkl/format-56.pk
> new file mode 100644
> index 00000000..c14afe83
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-56.pk
> @@ -0,0 +1,4 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {format "%v", "A\x01B"} } */
> +/* { dg-output {"\\"A\\\\x01B\\""} } */
> diff --git a/testsuite/poke.pkl/format-57.pk b/testsuite/poke.pkl/format-57.pk
> new file mode 100644
> index 00000000..22a861f3
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-57.pk
> @@ -0,0 +1,4 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {format "%v", int[]()} } */
> +/* { dg-output {"\[]"} } */
> diff --git a/testsuite/poke.pkl/format-58.pk b/testsuite/poke.pkl/format-58.pk
> new file mode 100644
> index 00000000..e973befe
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-58.pk
> @@ -0,0 +1,7 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {vm_set_obase (10)} } */
> +/* { dg-command {format "%v", [1,2,3]} } */
> +/* { dg-output {"\[1,2,3]"\n} } */
> +/* { dg-command {format "%v", [1UB,2UB,3UB]} } */
> +/* { dg-output {"\[1UB,2UB,3UB]"\n} } */
> diff --git a/testsuite/poke.pkl/format-59.pk b/testsuite/poke.pkl/format-59.pk
> new file mode 100644
> index 00000000..a3c57eb8
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-59.pk
> @@ -0,0 +1,7 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {vm_set_obase (16)} } */
> +/* { dg-command {format "%v", [1,2,3]} } */
> +/* { dg-output {"\[0x00000001,0x00000002,0x00000003]"\n} } */
> +/* { dg-command {format "%v", [1UB,2UB,3UB]} } */
> +/* { dg-output {"\[0x01UB,0x02UB,0x03UB]"\n} } */
> diff --git a/testsuite/poke.pkl/format-60.pk b/testsuite/poke.pkl/format-60.pk
> new file mode 100644
> index 00000000..4244b1d9
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-60.pk
> @@ -0,0 +1,4 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {format "%v", ["GNU", "poke"]} } */
> +/* { dg-output {"\[\\"GNU\\",\\"poke\\"]"} } */
> diff --git a/testsuite/poke.pkl/format-61.pk b/testsuite/poke.pkl/format-61.pk
> new file mode 100644
> index 00000000..851f3834
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-61.pk
> @@ -0,0 +1,5 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {vm_set_oacutoff (4)} } */
> +/* { dg-command {format "%v", ["GNU", "poke", "by", "Jose", "Marchesi"]} } */
> +/* { dg-output {"\[\\"GNU\\",\\"poke\\",\\"by\\",\\"Jose\\"...]"} } */
> diff --git a/testsuite/poke.pkl/format-62.pk b/testsuite/poke.pkl/format-62.pk
> new file mode 100644
> index 00000000..e459e029
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-62.pk
> @@ -0,0 +1,7 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {vm_set_obase (10)} } */
> +/* { dg-command {vm_set_omaps (1)} } */
> +/* { dg-command {vm_set_oacutoff (3)} } */
> +/* { dg-command {format "%v", ["GNU", "poke", "by", "Jose", "Marchesi"]} } */
> +/* { dg-output {"\[\\"GNU\\" @ 0x0000000000000000#b,\\"poke\\" @ 
> 0x0000000000000020#b,\\"by\\" @ 0x0000000000000048#b...] @ 
> 0x0000000000000000#b"} } */
> diff --git a/testsuite/poke.pkl/format-63.pk b/testsuite/poke.pkl/format-63.pk
> new file mode 100644
> index 00000000..642d1463
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-63.pk
> @@ -0,0 +1,13 @@
> +/* { dg-do run } */
> +
> +type E = struct
> +  {
> +    int<32> code;
> +    string name;
> +    int<32> exit_status;
> +  };
> +var e = E {code = 0, name = "generic", exit_status = 1};
> +
> +/* { dg-command {vm_set_obase (10)} } */
> +/* { dg-command {format "%v", e} } */
> +/* { dg-output {"E {code=0,name=\\"generic\\",exit_status=1}"} } */
> diff --git a/testsuite/poke.pkl/format-64.pk b/testsuite/poke.pkl/format-64.pk
> new file mode 100644
> index 00000000..8cc3ba3a
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-64.pk
> @@ -0,0 +1,13 @@
> +/* { dg-do run } */
> +
> +type E = struct
> +  {
> +    int<32> code;
> +    string name;
> +    int<32> exit_status;
> +  };
> +var e = E {code = 0, name = "generic", exit_status = 1};
> +
> +/* { dg-command {vm_set_obase (10)} } */
> +/* { dg-command {format "%Fv", e} } */
> +/* { dg-output {"E {code=0,name=\\"generic\\",exit_status=1}"} } */
> diff --git a/testsuite/poke.pkl/format-65.pk b/testsuite/poke.pkl/format-65.pk
> new file mode 100644
> index 00000000..29f3f2fd
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-65.pk
> @@ -0,0 +1,13 @@
> +/* { dg-do run } */
> +
> +type E = struct
> +  {
> +    int<32> code;
> +    string name;
> +    int<32> exit_status;
> +  };
> +var e = E {code = 0, name = "generic", exit_status = 1};
> +
> +/* { dg-command {vm_set_obase (10)} } */
> +/* { dg-command {format "%Tv", e} } */
> +/* { dg-output {"E {\\n  code=0,\\n  name=\\"generic\\",\\n  
> exit_status=1\\n}"} } */
> diff --git a/testsuite/poke.pkl/format-66.pk b/testsuite/poke.pkl/format-66.pk
> new file mode 100644
> index 00000000..4962bae8
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-66.pk
> @@ -0,0 +1,14 @@
> +/* { dg-do run } */
> +
> +type E = struct
> +  {
> +    int<32> code;
> +    string name;
> +    int<32> exit_status;
> +  };
> +var e = E {code = 0, name = "generic", exit_status = 1};
> +
> +/* { dg-command {vm_set_obase (10)} } */
> +/* { dg-command {vm_set_oindent (4)} } */
> +/* { dg-command {format "%Tv", e} } */
> +/* { dg-output {"E {\\n    code=0,\\n    name=\\"generic\\",\\n    
> exit_status=1\\n}"} } */
> diff --git a/testsuite/poke.pkl/format-67.pk b/testsuite/poke.pkl/format-67.pk
> new file mode 100644
> index 00000000..1df24e3f
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-67.pk
> @@ -0,0 +1,15 @@
> +/* { dg-do run } */
> +
> +type E = struct
> +  {
> +    int<32> code;
> +    string name;
> +    int<32> exit_status;
> +  };
> +var e = E {code = 0, name = "generic", exit_status = 1};
> +
> +/* { dg-command {vm_set_obase (16)} } */
> +/* { dg-command {vm_set_oindent (4)} } */
> +/* { dg-command {vm_set_omode (VM_OMODE_TREE)} } */  /* No effect.  */
> +/* { dg-command {format "%v", e} } */
> +/* { dg-output {"E 
> {code=0x00000000,name=\\"generic\\",exit_status=0x00000001}"} } */
> diff --git a/testsuite/poke.pkl/format-68.pk b/testsuite/poke.pkl/format-68.pk
> new file mode 100644
> index 00000000..6b3127e7
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-68.pk
> @@ -0,0 +1,17 @@
> +/* { dg-do run } */
> +
> +type E = struct
> +  {
> +    int<32> code;
> +    string name;
> +    int<32> exit_status;
> +  };
> +type S = struct
> +  {
> +    E ex;
> +  };
> +
> +/* { dg-command {vm_set_obase (10)} } */
> +/* { dg-command {vm_set_odepth (1)} } */    /* No effect.  */
> +/* { dg-command {format "%v", S{}} } */
> +/* { dg-output {"S {ex=E {code=0,name=\\"\\",exit_status=0}}"} } */
> diff --git a/testsuite/poke.pkl/format-69.pk b/testsuite/poke.pkl/format-69.pk
> new file mode 100644
> index 00000000..c78a291e
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-69.pk
> @@ -0,0 +1,16 @@
> +/* { dg-do run } */
> +
> +type E = struct
> +  {
> +    int<32> code;
> +    string name;
> +    int<32> exit_status;
> +  };
> +type S = struct
> +  {
> +    E ex;
> +  };
> +
> +/* { dg-command {vm_set_obase (10)} } */
> +/* { dg-command {format "%1v", S{}} } */
> +/* { dg-output {"S {ex=E {...}}"} } */
> diff --git a/testsuite/poke.pkl/format-70.pk b/testsuite/poke.pkl/format-70.pk
> new file mode 100644
> index 00000000..9b5f40f3
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-70.pk
> @@ -0,0 +1,17 @@
> +/* { dg-do run } */
> +
> +type E = struct
> +  {
> +    int<32> code;
> +    string name;
> +    int<32> exit_status;
> +  };
> +type S = struct
> +  {
> +    E ex;
> +  };
> +
> +/* { dg-command {vm_set_obase (10)} } */
> +/* { dg-command {vm_set_omaps (1)} } */
> +/* { dg-command {format "%1v", S{}} } */
> +/* { dg-output {S {ex=E {...} @ 0x0000000000000000#b @ 0x0000000000000000#b} 
> @ 0x0000000000000000#b} } */
> diff --git a/testsuite/poke.pkl/format-71.pk b/testsuite/poke.pkl/format-71.pk
> new file mode 100644
> index 00000000..20b29620
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-71.pk
> @@ -0,0 +1,11 @@
> +/* { dg-do run } */
> +
> +type S = struct
> +  {
> +    int<32>[] i;
> +  };
> +
> +/* { dg-command {vm_set_obase (10)} } */
> +/* { dg-command {var s = S{ i=[1,2,3]} } } */
> +/* { dg-command {format "%v", s} } */
> +/* { dg-output {"S {i=\[1,2,3]}"} } */
> diff --git a/testsuite/poke.pkl/format-72.pk b/testsuite/poke.pkl/format-72.pk
> new file mode 100644
> index 00000000..a731c3b6
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-72.pk
> @@ -0,0 +1,6 @@
> +/* { dg-do run } */
> +
> +var s = "a\nb";
> +
> +/* { dg-command {format "%v", s} } */
> +/* { dg-output {"\\"a\\\\nb\\""} } */
> diff --git a/testsuite/poke.pkl/format-73.pk b/testsuite/poke.pkl/format-73.pk
> new file mode 100644
> index 00000000..79e8b94b
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-73.pk
> @@ -0,0 +1,6 @@
> +/* { dg-do run } */
> +
> +var s = "a\tb";
> +
> +/* { dg-command {format "%v", s} } */
> +/* { dg-output {"\\"a\\\\tb\\""} } */
> diff --git a/testsuite/poke.pkl/format-74.pk b/testsuite/poke.pkl/format-74.pk
> new file mode 100644
> index 00000000..7f16aa92
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-74.pk
> @@ -0,0 +1,6 @@
> +/* { dg-do run } */
> +
> +var s = "a\"b";
> +
> +/* { dg-command {format "%v", s} } */
> +/* { dg-output {"\\"a\\\\\\"b\\""} } */
> diff --git a/testsuite/poke.pkl/format-75.pk b/testsuite/poke.pkl/format-75.pk
> new file mode 100644
> index 00000000..5818805c
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-75.pk
> @@ -0,0 +1,6 @@
> +/* { dg-do run } */
> +
> +var s = "a\\b";
> +
> +/* { dg-command {format "%v", s} } */
> +/* { dg-output {"\\"a\\\\\\\\b\\""} } */
> diff --git a/testsuite/poke.pkl/format-76.pk b/testsuite/poke.pkl/format-76.pk
> new file mode 100644
> index 00000000..835aef9f
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-76.pk
> @@ -0,0 +1,6 @@
> +/* { dg-do run } */
> +
> +var s = "a\x0ab";
> +
> +/* { dg-command {format "%v", s} } */
> +/* { dg-output {"\\"a\\\\nb\\""} } */
> diff --git a/testsuite/poke.pkl/format-77.pk b/testsuite/poke.pkl/format-77.pk
> new file mode 100644
> index 00000000..c45fa067
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-77.pk
> @@ -0,0 +1,6 @@
> +/* { dg-do run } */
> +
> +var s = "a\x09b";
> +
> +/* { dg-command {format "%v", s} } */
> +/* { dg-output {"\\"a\\\\tb\\""} } */
> diff --git a/testsuite/poke.pkl/format-78.pk b/testsuite/poke.pkl/format-78.pk
> new file mode 100644
> index 00000000..c9cc7ef0
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-78.pk
> @@ -0,0 +1,5 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {.set obase 10} } */
> +/* { dg-command {format "%%%i32d%%", 23} } */
> +/* { dg-output {"%23%"} } */
> diff --git a/testsuite/poke.pkl/format-79.pk b/testsuite/poke.pkl/format-79.pk
> new file mode 100644
> index 00000000..382078cb
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-79.pk
> @@ -0,0 +1,6 @@
> +/* { dg-do run } */
> +
> +type Matrix = int[3];
> +
> +/* { dg-command { format "%v", [1,2,3] as Matrix; } } */
> +/* { dg-output "\"\\\[1,2,3\\\]\"" } */
> diff --git a/testsuite/poke.pkl/format-80.pk b/testsuite/poke.pkl/format-80.pk
> new file mode 100644
> index 00000000..3a8107f7
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-80.pk
> @@ -0,0 +1,6 @@
> +/* { dg-do run } */
> +
> +type Foo = struct {};
> +
> +/* { dg-command { format "%v", Foo {} } } */
> +/* { dg-output "\"Foo \{\}\"" } */
> diff --git a/testsuite/poke.pkl/format-81.pk b/testsuite/poke.pkl/format-81.pk
> new file mode 100644
> index 00000000..e46d03d6
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-81.pk
> @@ -0,0 +1,6 @@
> +/* { dg-do run } */
> +
> +type Foo = struct { int; };
> +
> +/* { dg-command { format "%v", Foo {} } } */
> +/* { dg-output {"Foo .0+."} } */
> diff --git a/testsuite/poke.pkl/format-82.pk b/testsuite/poke.pkl/format-82.pk
> new file mode 100644
> index 00000000..f26142ec
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-82.pk
> @@ -0,0 +1,5 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {.set obase 10} } */
> +/* { dg-command {format "%%v"} } */
> +/* { dg-output {"%v"} } */
> diff --git a/testsuite/poke.pkl/format-83.pk b/testsuite/poke.pkl/format-83.pk
> new file mode 100644
> index 00000000..aaa7db5b
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-83.pk
> @@ -0,0 +1,5 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {.set obase 10} } */
> +/* { dg-command {format "v%%j"} } */
> +/* { dg-output {"v%j"} } */
> diff --git a/testsuite/poke.pkl/format-84.pk b/testsuite/poke.pkl/format-84.pk
> new file mode 100644
> index 00000000..71d86ca9
> --- /dev/null
> +++ b/testsuite/poke.pkl/format-84.pk
> @@ -0,0 +1,5 @@
> +/* { dg-do run } */
> +
> +/* { dg-command {.set obase 10} } */
> +/* { dg-command {format "v%%%%j%%abc%%"} } */
> +/* { dg-output {"v%%j%abc%"} } */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]