manpagez: man pages & more
info bison
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.5.1 Data Type of Locations

Defining a data type for locations is much simpler than for semantic values, since all tokens and groupings always use the same type.

You can specify the type of locations by defining a macro called YYLTYPE, just as you can specify the semantic value type by defining a YYSTYPE macro (see section Data Types of Semantic Values). When YYLTYPE is not defined, Bison uses a default structure type with four members:

typedef struct YYLTYPE
{
  int first_line;
  int first_column;
  int last_line;
  int last_column;
} YYLTYPE;

When YYLTYPE is not defined, at the beginning of the parsing, Bison initializes all these fields to 1 for yylloc. To initialize yylloc with a custom location type (or to chose a different initialization), use the %initial-action directive. See section Performing Actions before Parsing.


This document was generated on December 1, 2013 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.