[Top][All Lists]

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

Re: bison 2.0a token quoting change

From: Anthony Heading
Subject: Re: bison 2.0a token quoting change
Date: Wed, 20 Jul 2005 00:07:21 -0400
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Paul Eggert wrote:
That sounds like a reasonable approach, yes.  Instead of implementing
it right away, though, can you please show a sample Bison output both
before and after the change, so that we can see what you're thinking

Sure. Given an input file

%token FOO
%token BAR "|"


baz : "xyzzy"

the relevant section of the output might be:

/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
  "$end", "error", "$undefined", "FOO", "|", "xyzzy", "$accept", "baz", 0

static const char *const yytstring[] =
  0, 0, 0, 0, "|", "xyzzy"

yytname is unchanged, but yytstring is an new array of size NTOKENS,
containing the literal token string if one exists, or NULL if it

An alternative solution - with some appeal - might be to revert to
the previous 2.0 behaviour where the literal tokens preserved their
double-quote armour in the yytname table.  Code which uses the table
presumably has the option to strip any quotes - i.e. whatever user-
visible demand precipitated this 2.0a change could I imagine be met
at an output stage rather than changing the semantics of this array?

Apologies for the line-length chaos of my previous message - I hope
(without total confidence in Thunderbird) that this will be better.



reply via email to

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