[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/merge-cedet-tests f580185 118/316: Expand preproce
From: |
Edward John Steere |
Subject: |
[Emacs-diffs] scratch/merge-cedet-tests f580185 118/316: Expand preprocessor to handle macros which open or close scope. |
Date: |
Fri, 27 Jan 2017 20:03:32 +0000 (UTC) |
branch: scratch/merge-cedet-tests
commit f5801857e589c52a9a40beaa9f8592203e108420
Author: David Engster <address@hidden>
Commit: Edward John Steere <address@hidden>
Expand preprocessor to handle macros which open or close scope.
* 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.
---
.../cedet/cedet/semantic/tests/testsppreplace.c | 27 ++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/test/manual/cedet/cedet/semantic/tests/testsppreplace.c
b/test/manual/cedet/cedet/semantic/tests/testsppreplace.c
index ae04d07..4e945c4 100644
--- a/test/manual/cedet/cedet/semantic/tests/testsppreplace.c
+++ b/test/manual/cedet/cedet/semantic/tests/testsppreplace.c
@@ -149,6 +149,33 @@ int
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. */
- [Emacs-diffs] scratch/merge-cedet-tests cfdd9a5 070/316: Tests for polymorphism, (continued)
- [Emacs-diffs] scratch/merge-cedet-tests cfdd9a5 070/316: Tests for polymorphism, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 41aebbc 072/316: Texinfo support for cedet integration tests., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 79008df 084/316: Fake config.h for project detection purposes., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 0c4deea 079/316: Test files contributed by Barry OReilly, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests b666682 082/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 89b52b8 087/316: New metaproject, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 6dfcb31 089/316: (Lisp): Add cit-srec.el (templates): New, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 96526d7 096/316: (Lisp): Add cit-uml.el (Misc): Add cit-uml.cgr, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 74de67a 105/316: Move Speedbar development to Emacs trunk., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests ee352df 113/316: How to use the cit-test.sh script., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests f580185 118/316: Expand preprocessor to handle macros which open or close scope.,
Edward John Steere <=
- [Emacs-diffs] scratch/merge-cedet-tests d58e8d8 063/316: Reverse the exist status of Emacs., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests b5a5b45 091/316: ("Lisp"): Add cit-gnustep.el, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 690c256 092/316: ("Lisp"): Add :versionsource, and :aux-packages, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests fac8155 094/316: ("cit"): Add speedbar aux package., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests f300a36 100/316: (Lisp): Add cit-symref.el., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests a6f2191 103/316: (Lisp): Add cit-arduino, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 8c4e7fd 111/316: Added arduino and better suggestions, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 901dc28 119/316: New test file., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests a375d40 093/316: ("cit"): Give it a new name. (Misc): New target., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests d2dcc15 112/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/27