Thread: colour highlighting of syntax

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    I've got my own, but it gets color happy if you use keywords in parts of your variable names... for example, int sprint would look bad.
    Code:
    #include <stdio.h>
    
    int main(void) {
        int ch;
    
        while ((ch = getchar()) != EOF)
            if (ch == '\n')
                printf("\n");
            else
                printf("%0x ", ch ^ 0xaa);
    
        return 0;
    }
    oh yeah, and it's C++ specific... or I should say C wasn't included in it's design considerations as you can see from the code above.
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  2. #2
    Registered Luser risby's Avatar
    Join Date
    Jun 2006
    Posts
    72
    Quote Originally Posted by major_small
    I've got my own, but it gets color happy if you use keywords in parts of your variable names... for example, int sprint would look bad.
    Code:
                printf("%0x ", ch ^ 0xaa);
    oh yeah, and it's C++ specific... or I should say C wasn't included in it's design considerations as you can see from the code above.
    It seems that the consideration that keywords should be delimited by whitespace was also not in the design.

    Have you ever thought of fixing it or would that be a completely bizarre suggestion on my part?
    ===
    Don't grumble about what you can't have;
    be grateful you don't get what you deserve.

  3. #3
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Quote Originally Posted by risby
    It seems that the consideration that keywords should be delimited by whitespace was also not in the design.
    I have thought of that, and at first glance it seems like a good idea... but that won't always work: static_cast<int>(12.5);
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  4. #4
    Registered User
    Join Date
    Oct 2004
    Posts
    151
    Quote Originally Posted by risby
    It seems that the consideration that keywords should be delimited by whitespace was also not in the design.

    Have you ever thought of fixing it or would that be a completely bizarre suggestion on my part?
    More correctly they should be delimited by word boundaries, i.e. /\b\w+?\b/.

    I just use Vim's Convert to HTML and filter that through a Perl script to get BBCode whenever I want to get pretty. E.g.
    Code:
     1 #include <stdio.h>
     2 
     3 int main(void) {
     4     int ch;
     5 
     6     while ((ch = getchar()) != EOF)
     7         if (ch == '\n')
     8             printf("\n");
     9         else
    10             printf("%0x ", ch ^ 0xaa);
    11     printf("while Fooo if bar \"stuff\" foo break 'bar'....");
    12 
    13     return 0;
    14 }
    15 
    Last edited by zx-1; 09-19-2006 at 10:03 AM.
    System: Debian Sid and FreeBSD 7.0. Both with GCC 4.3.

    Useful resources:
    comp.lang.c FAQ | C++ FQA Lite

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM