bug-bison
[Top][All Lists]
Advanced

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

Re: i18n for yacc backend messages


From: Hans Aberg
Subject: Re: i18n for yacc backend messages
Date: Mon, 18 Apr 2005 19:15:36 +0200

At 16:38 +0200 2005/04/18, Akim Demaille wrote:
 > Would you mind enlighten me as to how %printer works? -- It seems to
 > not be documented.

%printer { how to print $$ } SYMBOLS

e.g. in C++

%printer { debug_stream () << *$$; } "string" "identifier"
%printer { debug_stream () << $$; }  "integer"

If I look a bit into the output parser code, how error messages are written, then yyerror expects a full string. It might be too intrusive to change it accepting a stream instead. So it seems that one needs a command telling how to "stringize", or express (to "express" is opposite of to "parse") the token. For example:
%stringize { how to stringize $$ } "string" "identifier"

Then the %printer might use that, if the string value is somehow available via a symbol. E.g., in C++
%printer { debug_stream () << $$$ }
would generate a default printing rule, if $$$ represents the string value of the token at hand. (There is a tricky thing, if one admits a default printing rule, namely, if $$$ appears in its body, the default rule should only be defined for those tokens which has a %stringize definition.)

Otherwise, how and when is the defined %printer invoked for a particular token?
--
  Hans Aberg




reply via email to

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