[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cc-mode feature request: ignorable syntax

From: Daniel Colascione
Subject: cc-mode feature request: ignorable syntax
Date: Tue, 06 Dec 2011 11:59:26 -0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0

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.


_Success_(return == TRUE)
    _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: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]