2012/7/30 William S Fulton <wsf@fultondesigns.co.uk>
On 29/07/12 10:12, ฤอษิาษส หมยมห wrote:
Hello.

I'm a GSoC participant working on doxygen comments parsing and
translating. And currently I have some problems in extracting comments
from the source files in parser.y. The problem is that parser fails when
there is no node to attach comment to.
I'm defining comment rules like that:

interface š š š: interface declaration {

š š š š š š š š š š /* add declaration to end of linked list (the
declaration isn't always a single declaration, sometimes it is a linked
list itself) */

š š š š š š š š š š appendChild($1,$2);

š š š š š š š š š š $$ = $1;

š š š š š š š š }

š š š š š š š š | interface doxygen_comment declaration {

š š š š š š š š š š set_comment($3, $2);

š š š š š š š š š š appendChild($1, $3);

š š š š š š š š š š $$ = $1;

š š š š š š š š }

š š š š š š š š | interface declaration doxygen_post_comment {

š š š š š š š š š š set_comment($2, $3);

š š š š š š š š š š appendChild($1, $2);

š š š š š š š š š š $$ = $1;

š š š š š š š š }

And that was giving "Syntax error in input" for example for empty file
with no node to attach doxygen_comment to. Then I modified that:

interface š š š: ...

š š š š š š š š | interface doxygen_comment {

š š š š š š š š š š $$ = $1;

š š š š š š š š }

But that produces lots of reduce/reduce warnings and breaks the whole
comments parsing. And I don't understand why is it so, doxygen_comment
and doxygen_post_comment are defined as a simple DOXYGENSTRINGs tokens,
and there should be no problems.
As I'm not very good at bison, I'm asking for your help. I've tried lots
of lots of variations of rules, but nothing seems to work.
--
Hi Dmitry

I'm not sure there is much bison expertise here, I wish there was! Perhaps the bison mailing lists could help out more? Did you find out from the bison documentation what sort of things cause reduce/reduce warnings? Probably best to go back to basics.

William

Hi WIlliam,

Thank you for your answer.šThe problem is that parser.y is so large that I don't know if anyone wants to deal with it outside swig.
Yes, I've read some docs, I've understood that reduce/reduce conflicts are bad (I've even fixed some in my previous code) and still my results are not very promising. So, I'll keep trying.


--
Regards,
Dmitry Kabak