[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CC Mode - syntactical can of worms.
From: |
Stefan Monnier |
Subject: |
Re: CC Mode - syntactical can of worms. |
Date: |
Thu, 31 Jan 2008 10:00:07 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) |
> Hi, Emacs and CC Mode!
> Following up from: address@hidden: Bug in emacs 22.1.1 (cosmetic
> bug)].
> This bug was in C Mode, with the following source line:
> #warning for isn't a keyword here.
> This fouls up the fontification, because the syntactic fontification
> recognises the apostrophe as a string opener. It can get pretty bad -
> here is a syntactically correct C function:
> 1 #warning for isn't a keyword here. (
> 2 //#warning for isnt a keyword here.
> 3 void foo (bar)
> 4 {
> 5 #error Brace yourself! }
> 6 printf ("Hello, world!\n") ; /* the famous one liner! */
> 7 }
You forget other interesting constructs such as
#define HELLO }
#define WORLD )
void foo (WORLD
{
printf ("Hello\n"WORLD;
HELLO
and of course, the more common ones like
#if foo
void foo (void)
{
size_t toto;
#else
int foo ()
{
unsigned toto;
#endif
or how 'bout
#include "hello.h"
void foo (WORLD
{
printf ("Hello\n"WORLD;
HELLO
CC-mode's job is fundamentally impossible.
Stefan