help-bison
[Top][All Lists]
Advanced

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

Enabeling location tracking for bison 1.75


From: Oliver B. Fischer
Subject: Enabeling location tracking for bison 1.75
Date: Fri, 11 Jun 2004 11:06:34 +0200
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040605

Dear list,

I would like to provide a better error message to the users of my application. To achieve this I would like to enable location tracking in my bison parser. Sadly, I am not able to convince it.

I redefined YYLLOC_DEFAULT

#define YYLLOC_DEFAULT(Current, Rhs, N)          \
  Current.first_line   = Rhs[1].first_line;      \
  Current.first_column = Rhs[1].first_column;    \
  Current.last_line    = Rhs[N].last_line;       \
  Current.last_column  = Rhs[N].last_column;     \
  fprintf(stderr, "loc(%d) [l%d,c%d l%d,c%d] [l%d,c%d l%d,c%d]\n", N, \
    Rhs[1].first_line, Rhs[1].first_column, \
    Rhs[1].last_line, Rhs[1].last_column, \
    Rhs[N].first_line, Rhs[N].first_column, \
    Rhs[N].last_line, Rhs[N].last_column);

and put

%locations

in my grammar file.

If I parse an input file, my scanner never gives me the true position of any symbol. I get ony 0s.

Can someone help me?

Regards,

Oliver Fischer





reply via email to

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