[Top][All Lists]

[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: Thu, 14 Apr 2005 20:10:07 +0200

At 19:57 +0200 2005/04/14, Jan Nieuwenhuizen wrote:
there's a problem with backslashes.  Using

    %token BOOK "\book"
    %token PAPER "\paper"


    parser.yy:299.17-18: unrecognized escape sequence: `\\p'

However, the backslash is not used as an escape, because using the
parser that has

    %token BOOK "\book"
    %token PAPER "\\paper"

gives these error messages

    $ LANG=C lilypond bison
    GNU LilyPond 2.5.19
    Processing `bison.ly'
    bison.ly:1:5: error: syntax error, unexpected "\book", expecting '{'
         \book %expect \book error here
    bison.ly:8:5: error: syntax error, unexpected "\\paper", expecting '{'
         \paper %expect \paper error here


ie, \book shows OK, but \b is not backspace, \\paper shows extra
backslash.  I'm not sure what the correct fix would be, interpret the
escape, or just ignore it and allow \p (etc)?

I think the correct fix would be that the "..." part of %token is correctly encoded as a C-string, and then this is what is output in the error message. I.e., if one wants "\paper" in the output, then one should write
  %token PAPER "\\paper"
This gives full control of the output. Also, if the high bit is set, then it should be output the same as input; this will admit UTF-8 strings by simpy writing .y in UTF-8.
  Hans Aberg

reply via email to

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