[TxMt] C Syntax
Oscar Bonilla
ob at bitmover.com
Thu Nov 10 22:29:21 UTC 2005
How would people feel about this diff in the C syntax bundle?
It will work on functions of the form:
int
main () {
but not on
int main()
What would be the appropriate regexp for making it work in both
cases? What I'm trying to do is get the functions to show up in the
Symbols menu.
The other thing that's broken with C is that #defines which are not
functions are incorrectly marked as functions. For instance:
#define FOOBAR 10
adds FOOBAR to the symbols menu. I think that's because the regexp
that handles #defines tries to handle the case where the #define is
really a macro
#define MIN(a,b) ((a)<(b)?(a):(b))
but applies the name even if the syntax doesn't match... I'll take a
look at this later this week if no one has a workaround...
@@ -140,6 +140,20 @@
</array>
</dict>
<dict>
+ <key>captures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+
<string>entity.name.function.c</string>
+ </dict>
+ </dict>
+ <key>match</key>
+ <string>^([a-zA-Z_][a-zA-Z0-9_]*)\s*\(</string>
+ <key>name</key>
+ <string>source.c.function</string>
+ </dict>
+ <dict>
<key>begin</key>
<string>^\s*#\s*(define)\s+([a-zA-Z_][a-zA-
Z0-9_]*)(?:\(
((?:\s*[a-zA-Z_][a-zA-Z0-9_]*\s*,?)*)\)|\b)</string>
<key>captures</key>
--
pgp fingerprint: BC64 2E7A CAEF 39E1 9544 80CA F7D5 784D FB46 16C1
More information about the textmate
mailing list