yylineno
yylineno is a global integer variable used in lexical scanners generated by Flex to track the current line number of the input being tokenized. It is provided when the scanner is built with the option %option yylineno and is intended for use by the scanner, the parser, or host code to generate accurate line-based messages.
The value of yylineno is updated as the scanner processes input. By default, the initial value is
Access to yylineno is usually through external linkage. The scanner defines the variable, and outside code
Usage considerations include the fact that yylineno reflects line boundaries as recognized by the scanner’s newline
In practice, enabling yylineno is common when detailed line reporting is needed in error handling. A typical