1
votes

I'm looking at a bison+flex parser with the reentrant option. The parser is started up in a function that calls yylex_init(&scanner) where scanner is a yyscan_t. %locations is turned on.

This parser is used to parse embedded scripts found in the middle of other files. So, the line number does not start from 1.

However, in the reentrant parser, the current line number is buried in the opaque yyscan_t, and I am not seeing a clean way to set up. I am hoping that I am missing something.

1

1 Answers

3
votes

You can use yyset_lineno(int line_number, yyscan_t scanner) to set the current line number.