* cc-mode feature request: ignorable syntax
@ 2011-12-06 19:59 Daniel Colascione
0 siblings, 0 replies; only message in thread
From: Daniel Colascione @ 2011-12-06 19:59 UTC (permalink / raw
To: Emacs development discussions
[-- Attachment #1: Type: text/plain, Size: 1503 bytes --]
I work on a codebase that uses a strange dialect of C++ --- it includes many new
"keywords", annotations, and so on that are #defined away when we compile so
that we produce working code. cc-mode doesn't benefit from these saving
preprocessor macros, however, and becomes confused by these annotations.
e.g.,
_Success_(return == TRUE)
BOOL
Foo(
_In_ DWORD Blah
)
{
...
}
Until now, I've hacked up my copy of cc-mode to understand our syntax, but this
approach isn't sustainable because I inevitably fall behind cc-mode trunk. I
have an idea for an alternative that might be generally useful instead:
1. We can define a text property, cc-ignore, that cc-mode will look for when
it's about to read a symbol from the buffer. When it finds this property, it'll
skip over all characters until the text property disappears again. Then, a minor
mode can make itself responsible for identifying all non-standard constructs in
a cc-mode buffer and mark them with cc-ignore so that cc-mode's parsing engine
handles the syntactically-valid remainder of the buffer.
2. Create a cc-mode synonym table. My team (much to my chagrin) insists on
#define struct interface, then using interface IFoo { ... }. Because "interface"
behaves identically to "struct", I just tried it as "struct" in my cc-mode. I
wonder whether this mechanism can be made more general.
With these changes, I think cc-mode could be made to work for a greater variety
of C dialects. Any thoughts?
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 235 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-12-06 19:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-06 19:59 cc-mode feature request: ignorable syntax Daniel Colascione
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.