On Fri, 17 Dec 2010, Michael T wrote:
> Julia Lawall <julia <at> diku.dk> writes:
> > It looks like I need ~ too? (I don't know C++ at all :)
> Right. Sorry, forgot that one. (Don't know if I have forgotten anything
> else,
> but I am sure that using an updated version of spatch on our code base will
> soon
> refresh my memory! Nothing immediately springs to mind though.)
OK, I'm not very eager to commit this change, because it will break C code
like:
if (x<y) ...
But if you have the source code, you can easily try it out and we can see
how useful it is. Here is a patch against the latest version (0.2.5-rc1):
--- a/parsing_c/lexer_c.mll 2010-11-13 21:09:48.000000000 +0100
+++ b/parsing_c/lexer_c.mll 2010-12-17 17:25:46.000000000 +0100
@@ -229,6 +229,7 @@ let ulong = (UnSigned,CLong)
(*****************************************************************************)
let letter = ['A'-'Z' 'a'-'z' '_']
+let extended_letter = ['A'-'Z' 'a'-'z' '_' ':' '<' '>' '~'] (* for c++ *)
let digit = ['0'-'9']
(* not used for the moment *)
@@ -643,7 +644,7 @@ rule token = parse
* truncate to 31 when compare and truncate to 6 and even lowerise
* in the external linkage phase
*)
- | letter (letter | digit) *
+ | letter (extended_letter | digit) *
{ let info = tokinfo lexbuf in
let s = tok lexbuf in
Common.profile_code "C parsing.lex_ident" (fun () ->
If this turns out to be good enough to do some things, I can try to figure
out how to make this depend on some command-line option.
For your code, you will also want to make a file cpp.h containing:
#define RETVAL(x) x
And to run Coccinelle with the option -macro_file cpp.h
julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)