* semantic/lex-spp.el (semantic-c-end-of-macro): Declare.
(semantic-lex-spp-token-macro-to-macro-stream): Deal with macros which
open/close a scope. For this, leave an overlay if we encounter a
single open paren and return a semantic-list in the lexer. When this
list gets expanded, retrieve the old position from the overlay. See
the comments in the function for further details.
(semantic-lex-spp-find-closing-macro): New function to find the next
macro which closes scope (i.e., has a closing paren).
(semantic-lex-spp-replace-or-symbol-or-keyword): Go to end of closing
macro if necessary.
(semantic-lex-spp-paren-or-list): New lexer to specially deal with
parens in macro definitions.
* bovine/c.el (semantic-cpp-lexer): Use new
`semantic-lex-spp-paren-or-list'.
* tests/cedet/semantic/test/manual/cedet/testsppreplace.c:
* tests/cedet/semantic/test/manual/cedet/testsppreplaced.c: Add tests for the
above.
OBJ(test) /* expands to ABtest */
;
+
+/* TEST: Macros which open a scope which is closed by another macro */
+/* Simple: */
+#define OPEN_NS namespace foo {
+/* Less simple: */
+#define OPEN_NS_TWICE namespace foo { namespace bar {
+/* Really bad: */
+#define OPEN_NS_ARGS(a,b) namespace a { \
+ namespace b {
+/* Closing macros: */
+#define END_NS }
+#define END_NS_TWICE } }
+
+OPEN_NS
+struct inside_foo {};
+struct inside_foo_as_well {};
+END_NS
+
+OPEN_NS_TWICE
+struct inside_foo_bar {};
+END_NS_TWICE
+
+OPEN_NS_ARGS(one, two)
+struct inside_one_two ();
+END_NS_TWICE
+
+
/* TEST: Macro Recursion limits in arguments to a macro.
* This code is from ALSA (with names changed to moose), noticed by Yupeng. */