helpBison - Support: sr #106503, C++ template makes it very...


sr #106503: C++ template makes it very difficult to override functions

Submitted by:  Thomas Bleher <thomasbleher>
Submitted on:  Tue 23 Sep 2008 07:11:44 PM UTC  
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  None

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Fri 23 Mar 2012 11:09:43 PM UTC, comment #4: 

Tim Landscheidt writes "This is probably a matter of taste." <>

Paul Eggert <eggert>
Project Administrator
Fri 20 Nov 2009 01:02:30 PM UTC, comment #3: 

Also, yytranslate_() (Convert a scanner token number to a bison symbol number) should be declared static.

Claude Brisson <claudebrisson>
Fri 20 Nov 2009 02:57:05 AM UTC, comment #2: 

I met the same limitation. Promote fields useful for debugging from private to protected looks like the way to go.

Claude Brisson <claudebrisson>
Wed 24 Sep 2008 09:22:17 AM UTC, comment #1: 

Additionally, it would be useful if yysyntax_error_ could access the semantic value of the erroneus token (yylval in parse()). This would be useful e.g. to print the exact string found for string tokens.

Thomas Bleher <thomasbleher>
Tue 23 Sep 2008 07:11:44 PM UTC, original submission:  

I'm currently trying to create a C++ parser, and I'm having some problems overriding certain functionality. Specifically, I'd like to derive a class from the bison-generated one and override yysyntax_error_ so I can generate special error messages. However, I cannot access most data structures as they are declared private (e.g. yytname_).

As far as I can see, this makes it impossible to properly replicate the work that yysyntax_error_ is doing (Please correct me if I'm wrong).

Suggested solution: change the "private:" declaration in to "protected:" so derived classes can access the data.

Thomas Bleher <thomasbleher>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by eggert (Posted a comment)
  • -email is unavailable- added by claudebrisson (Posted a comment)
  • -email is unavailable- added by thomasbleher (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.5