Hello,
with this patch in C++ mode, the using directive is treated as a comment
so it allows parsing to proceed.
Code like
#include <iostream>
using namespace std;
int main() {
cout << "Hello" << endl;
return 0;
}
It can also be pulled from my cc_parsing branch on github in case it
looks good as is :)
https://github.com/janimo/coccinelle/commits/cc_parsing
thanks
Jani
>From 94d16a3675baa6f18a98470889c23753de83d625 Mon Sep 17 00:00:00 2001
From: Jani Monoses <[email protected]>
Date: Fri, 10 Jun 2011 00:37:04 +0300
Subject: [PATCH] Lex the 'using' and 'namespace' C++ keywords.
Treat them as comments for now, just to allow parsing to proceed.
---
parsing_c/lexer_c.mll | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/parsing_c/lexer_c.mll b/parsing_c/lexer_c.mll
index 0d88443..d20ff9a 100644
--- a/parsing_c/lexer_c.mll
+++ b/parsing_c/lexer_c.mll
@@ -171,7 +171,9 @@ let keyword_table = Common.hash_of_list [
let cpp_keyword_table = Common.hash_of_list [
"new", (fun ii -> Tnew ii);
- "delete",(fun ii -> Tdelete ii) ]
+ "delete",(fun ii -> Tdelete ii);
+ "using", (fun ii -> TComment ii);
+ "namespace",(fun ii -> TComment ii) ]
let error_radix s =
("numeric " ^ s ^ " constant contains digits beyond the radix:")
--
1.7.5.3
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)