[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
C++ template lalr1.cc: one use of location instead of location_type
From: |
Georg Sauthoff |
Subject: |
C++ template lalr1.cc: one use of location instead of location_type |
Date: |
Sun, 31 Aug 2008 21:27:58 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Hi,
I noticed, that in the C++ parser template class lalr1.cc is one usage
of 'location' hardcoded instead of the user configurable type-synonym
'location_type'.
This is a problem if you want to use your custom location-class to track
source locations. E.g. if you want to extend yy::location.
E.g.:
%locations
%define "location_type" "Loc"
And then it is quite possible that you have to define the macro
YYLLOC_DEFAULT, to get '@$' default computations right according to user
defined semantics.
But since in lalr1.cc there is this definition
location yyerror_range[2];
this is not enough - you have to patch the generated C++-parser file.
There are two possible fixes:
1. just replace 'location' with 'location_type', like in the rest of the
lalr1.cc.
2. do 1. and extend yy::location with a virtual method which does this
computation (-> user can over-load this function if needed when
extending yy::location)
I am using Bison 2.3 under Ubuntu 8.04.
Best regards
Georg Sauthoff
--
Fortune : 'Real programmers don't comment their code.
It was hard to write, it should be hard to understand.' ;)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- C++ template lalr1.cc: one use of location instead of location_type,
Georg Sauthoff <=