Previous: , Up: C++ Location Values   [Contents][Index]


10.1.5.4 User Defined Location Type

Instead of using the built-in types you may use the %define variable api.location.type to specify your own type:

%define api.location.type {LocationType}

The requirements over your LocationType are:


In programs with several C++ parsers, you may also use the %define variable api.location.type to share a common set of built-in definitions for position and location. For instance, one parser master/parser.yy might use:

%header
%locations
%define api.namespace {master::}

to generate the master/position.hh and master/location.hh files, reused by other parsers as follows:

%define api.location.type {master::location}
%code requires { #include <master/location.hh> }