List Info

Thread: how to define order in visit_foo for KDevelop-pg




how to define order in visit_foo for KDevelop-pg
user name
2007-07-21 14:19:18
Hi,

Is there a way to influence the order of the visit_node
calls in this
visit_scope function?

  void default_visitor::visit_scope(scope_ast *node)
  {
    visit_node(node->func_args);
    visit_node(node->scope_body);
    visit_node(node->or_op);
  }

The rule is this:

   func_args=function_args ( scope_body=scope_body |
or_op=or_op scope_body=scope_body | 0 )
   | ( or_op=or_op | 0 ) scope_body=scope_body
-> scope ;;

I'd like to have the or_op visited first, then the func_args
and then
the scope_body.

Andreas

-- 
You will be misunderstood by everyone.

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

Re: how to define order in visit_foo for KDevelop-pg
country flaguser name
Austria
2007-07-22 15:08:18
On Saturday, 21. July 2007, Andreas Pakulat wrote:
> Hi,
>
> Is there a way to influence the order of the visit_node
calls in this
> visit_scope function?
>
>   void default_visitor::visit_scope(scope_ast *node)
>   {
>     visit_node(node->func_args);
>     visit_node(node->scope_body);
>     visit_node(node->or_op);
>   }
>
> The rule is this:
>
>    func_args=function_args ( scope_body=scope_body |
or_op=or_op
> scope_body=scope_body | 0 )
>
>    | ( or_op=or_op | 0 ) scope_body=scope_body
>
> -> scope ;;
>
> I'd like to have the or_op visited first, then the
func_args and then
> the scope_body.

No, as far as I know this is not possible without having a
custom visitor.

You could
a) subclass the default visitor and fix the order of the
calls in the
   overriding member function, or
b) add support for that to kdev-pg directly.

I think that's pretty much it.

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

Re: how to define order in visit_foo for KDevelop-pg
user name
2007-07-22 15:41:08
On 22.07.07 22:08:18, Jakob Petsovits wrote:
> On Saturday, 21. July 2007, Andreas Pakulat wrote:
> > Hi,
> >
> > Is there a way to influence the order of the
visit_node calls in this
> > visit_scope function?
> >
> >   void default_visitor::visit_scope(scope_ast
*node)
> >   {
> >     visit_node(node->func_args);
> >     visit_node(node->scope_body);
> >     visit_node(node->or_op);
> >   }
> >
> > The rule is this:
> >
> >    func_args=function_args ( scope_body=scope_body
| or_op=or_op
> > scope_body=scope_body | 0 )
> >
> >    | ( or_op=or_op | 0 ) scope_body=scope_body
> >
> > -> scope ;;
> >
> > I'd like to have the or_op visited first, then the
func_args and then
> > the scope_body.
> 
> No, as far as I know this is not possible without
having a custom visitor.
> 
> You could
> a) subclass the default visitor and fix the order of
the calls in the
>    overriding member function, or
> b) add support for that to kdev-pg directly.
> 
> I think that's pretty much it.

Actually a) is much easier than I initially thought and one
can still
use the default_visitor as base class. So I won't go with b)
until
there's real need :P

Andreas

-- 
You teach best what you most need to learn.

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

Re: how to define order in visit_foo for KDevelop-pg
country flaguser name
Italy
2007-07-22 15:51:41
Hi,

Il giorno 22/lug/07, alle ore 22:08, Jakob Petsovits ha
scritto:
> No, as far as I know this is not possible without
having a custom  
> visitor.
>
> You could
> a) subclass the default visitor and fix the order of
the calls in the
>    overriding member function, or

correct solution 

> b) add support for that to kdev-pg directly.

wrong solution

>
> I think that's pretty much it.

yup 

Jakob I think it is time to bootstrap kdev-pg, is it OK with
you? I  
have attached the initial version of the kdev-pg grammar in
kdev-pg.  
Now I'm trying to generate the kdev-pg AST using the new
grammar.

ciao robe


_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

  
Re: how to define order in visit_foo for KDevelop-pg
country flaguser name
Austria
2007-07-22 17:13:07
On Sunday, 22. July 2007, Roberto Raggi wrote:
> Jakob I think it is time to bootstrap kdev-pg, is it OK
with you?

Absolutely no problem from my side, imho it can only bring
kdev-pg forward.
If you commit this, please remove the corresponding item
from the TODO file.

> I have attached the initial version of the kdev-pg
grammar in kdev-pg.
> Now I'm trying to generate the kdev-pg AST using the
new grammar.

Beautiful, go for it 

Cheers ("whoo, Roberto!"),
  Jakob

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )