On Wed, Jun 3, 2009 at 1:28 AM, Luca <yel...@tin.it> wrote: > Location are created by lexer and "reduced" by the parser, so you have to > create them using the lexer: > > #define YY_USER_ACTION {yylloc.first_line = yylineno; yylloc.first_column = > colnum; colnum=colnum+yyleng; yylloc.last_column=colnum; yylloc.last_line = > yylineno;} > > this macro is executed at each token recognized by lex. Insert it in bug.l > inside %{}%; you have to define and manage colnum, yylineno is automatically > defined by flex. > You can access to location using @ from parser actions, or using yylloc from > flex. > > > You can also redefine, if you need, YYLTYPE (user custom locations, for > example to add a field to the struct to track also file location), > YYLLOC_DEFAULT (to merge locations) and YY_LOCATION_PRINT (to print > locations) without any trouble. > You have to redefine those macro BEFORE to include y.tab.h otherwise the > compiler will complain.
Thanks! These tips helped a great deal! Kynn _______________________________________________ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison