public inbox for cocci@systeme.lip6.fr
 help / color / mirror / Atom feed
From: maxclausen@gmail.com (Christian Clausen)
To: cocci@systeme.lip6.fr
Subject: [Cocci] C++ namespace in cocci files
Date: Wed, 21 Nov 2012 11:51:25 +0100	[thread overview]
Message-ID: <50ACB22D.3030201@gmail.com> (raw)
In-Reply-To: <50AA6091.8010702@gmail.com>

Hi,

Here is the same update, as I posted a couple of days ago, but in form 
of a patch.
This update adds support for c++ namespace syntax in cocci files.

On 19-11-2012 17:38, Christian Clausen wrote:
> Hi,
>
> Here is an update -- to the file parsing_cocci/lexer_cocci.mll -- 
> which adds support for c++ namespace syntax in cocci files.
>

-------------- next part --------------
diff --git a/parsing_cocci/lexer_cocci.mll b/parsing_cocci/lexer_cocci.mll
index 8a254e7..ec91a89 100755
--- a/parsing_cocci/lexer_cocci.mll
+++ b/parsing_cocci/lexer_cocci.mll
@@ -827,6 +827,57 @@ rule token = parse
   | letter (letter | digit)*
       { start_line true; id_tokens lexbuf }
 
+  | (letter | '$') (letter | digit | '$') *
+      { start_line true; id_tokens lexbuf }
+
+  | (letter | '$') (letter | digit | '$') *
+      ('<' (letter | '$' | '~') (letter | digit | '$' | '~') * '>') ?
+    ("::~" (letter | '$') (letter | digit | '$') *
+      ('<' (letter | '$' | '~') (letter | digit | '$' | '~') * '>') ?) +
+
+      { 
+	start_line true; 
+	if not !Flag.c_plus_plus
+	then Common.pr2_once "< and > not allowed in C identifiers, try -c++ option";
+	id_tokens lexbuf 
+      }
+  | ((letter | '$') (letter | digit | '$') * )
+      ('<' (letter | '$' | '~') (letter | digit | '$' | '~') * '>')
+
+      { 
+	start_line true; 
+	if not !Flag.c_plus_plus
+	then Common.pr2_once "< and > not allowed in C identifiers, try -c++ option";
+	id_tokens lexbuf 
+      }
+
+  | (((letter | '$') (letter | digit | '$') * ))
+      ('<' (letter | '$' | '~') (letter | digit | '$' | '~') * '>') ?
+    "::" (((letter | '$') (letter | digit | '$') * ))
+      ('<' (letter | '$' | '~') (letter | digit | '$' | '~') * '>') ?
+    ("::" ((letter | '$') (letter | digit | '$') * )
+      ('<' (letter | '$' | '~') (letter | digit | '$' | '~') * '>') ?) *
+
+      { 
+	start_line true; 
+	if not !Flag.c_plus_plus
+	then Common.pr2_once "~ and :: not allowed in C identifiers, try -c++ option";
+	id_tokens lexbuf 
+      }
+
+   | "::" ((letter | '$') (letter | digit | '$') * )
+      ('<' (letter | '$' | '~') (letter | digit | '$' | '~') * '>') ?
+    ("::" ((letter | '$') (letter | digit | '$') * )
+      ('<' (letter | '$' | '~') (letter | digit | '$' | '~') * '>') ?) *
+      { 
+	start_line true; 
+	if not !Flag.c_plus_plus
+	then Common.pr2_once "~ and :: not allowed in C identifiers, try -c++ option";
+	id_tokens lexbuf 
+      }
+       (* christia: end *)
+
+
   | "'" { start_line true;
 	  TChar(char lexbuf,get_current_line_type lexbuf) }
   | '"' { start_line true;

      reply	other threads:[~2012-11-21 10:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-19 16:38 [Cocci] C++ namespace in cocci files Christian Clausen
2012-11-21 10:51 ` Christian Clausen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50ACB22D.3030201@gmail.com \
    --to=maxclausen@gmail.com \
    --cc=cocci@systeme.lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox