Re: occ -p -s
[email protected] (Gilles J. Seguin)
| Newsgroups | gmane.comp.documentation.synopsis |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 2004-08-05 at 20:49, Stefan Seefeld wrote:
> Gilles J. Seguin wrote:
> > Allo Stefan,
> >
> > How can I have the equivalent of cli
> > $ occ -p -s tata.cc
>
> erm, you can't. That's precisely one of my goals: to
> provide similar functionality via python (synopsis) scripting.
>
> the 'occ' executable does quite a number of things:
>
> 1) running a preprocessor (already possible in synopsis)
> 2) parsing an input file (already possible in synopsis)
That is the one, I need a command to feed to QMtest.
presently I am try to modify thing
diff -u -r1.2.2.2 Parser.cc
--- Parser.cc 28 Jul 2004 05:44:33 -0000 1.2.2.2
+++ Parser.cc 6 Aug 2004 13:54:27 -0000
@@ -3673,10 +3673,35 @@
PtreeUtil::List(new
Leaf(op), e));
break;
}
+ case CONSTCAST :
+ case DYNCAST :
+ case REINTCAST :
+ case STATCAST :
+ Token res, tk1,tk2,tk3,tk4;
+ Ptree *castexp, *tname;
+ t2 = lex->GetToken(res);
+ if(lex->GetToken(tk1) != '<')
+ return false;
+ if(rTypeName(tname))
+ return false;
+ if(lex->GetToken(tk2) != '>')
+ return false;
+ if(lex->GetToken(tk3) != '(')
+ return false;
+ if(rExpression(castexp))
+ return false;
+ if(lex->GetToken(tk4) != ')')
+ return false;
+ exp = new PtreeCxxCastExpr( new LeafReserved(res),
+ PtreeUtil::List(new Leaf(tk1),
+ tname, new Leaf(tk2), new
Leaf(tk3),+ castexp, new
Leaf(tk3)));
+ break;
default :
return true;
}
}
+ return true;
}
/*
> 3) manipulating the generated parse tree based on special tokens
> embedded into the input file (not possible in synopsis)
> 4) generating code from this modified parse tree (not possible in synopsis)
> 5) running a compiler on the code (not done in synopsis)
> 6) rerun itself with plugins loaded that had been compiled by a previous run
> (not possible in synopsis)
>
>
> Point 3 is the interesting bit here, and there are multiple
> ways to do it. Point 4 is trivially done given the existing API.
> Point 5 is also quite simple (even portably) in python.
> I don't know what to do about point 6...I believe this can be
> done in a simpler way with a different approach.
>
> Again, this is all on my todo list. I have ideas how to get there,
> and I welcome everybody who wants to get involved.