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

 
 

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

Submitter:  Thomas Bleher <thomasbleher>
Submitted:  Tue 23 Sep 2008 07:11:44 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  1 - Wish Status:  Wont Do
Privacy:  Public Assigned to:  akim
Open/Closed:  Closed Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 01 May 2020 06:49:58 AM UTC, comment #5: 

Let's close this issue.  Nothing changed in more than 10 years.  When designed, it was not clear whether the user should be allowed to derived from the parser class or not.  Maybe a good debate would be useful on this regard, but then it should be on our mailing lists, say bug-bison@gnu.org.

Cheers!

Akim Demaille <akim>
Group administrator
Fri 23 Mar 2012 11:09:43 PM UTC, comment #4: 

Tim Landscheidt writes "This is probably a matter of taste." <http://lists.gnu.org/archive/html/bug-bison/2012-03/msg00039.html>

Paul Eggert <eggert>
Group 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 lalr1.cc 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:
   
   
Comment:
   

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 akim (Posted a comment)
  • -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)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-05-01 akim Severity3 - Normal 1 - Wish
        StatusNone Wont Do
        Assigned toNone akim
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code