Thread: colour highlighting of syntax

  1. #16
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Note:
    - Neither Linux nor Windows liked the numbercol definition in codeform_cb_cpp.dat (the equal symbol before darkblue needs a backslash escape character)

    [numbercol]
    \=

    It says

    Quote Originally Posted by codeform
    Syntax error in data file "codeform.dat" on line 112:
    [numbercol]'s data must have 2 parts (it has 3)
    Yes, that was an error I forgot to fix before posting it.

    I have a few really tricky ones for you:
    Code:
    #define x printf("") /* comment */
    #define x printf("/*") /* comment */
    #define x printf("//")
    #define x printf(" /* " // "*/");
    /* #define x x */
    // /*
    #define x /**/
    I'm currently re-writing codeform. The new version is 1.2.0 and it should be ready in a week or so (maybe two).
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  2. #17
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246

    Thumbs up

    Code:
    #define x printf("") /* comment */
    #define x printf("/*") /* comment */
    #define x printf("//")
    #define x printf(" /* " // "*/");
    /* #define x x */
    // /*
    #define x /**/
    I'm currently re-writing codeform. The new version is 1.2.0 and it should be ready in a week or so (maybe two).
    What are its features?
    Last edited by siavoshkc; 09-21-2006 at 03:59 PM.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  3. #18
    Registered Luser risby's Avatar
    Join Date
    Jun 2006
    Posts
    72
    SiavoshKC's prog does this

    Code:
    #define x printf("") /* comment */
    #define x printf("/*") /* comment */
    #define x printf("//")
    #define x printf(" /* " // "*/");
    /* #define x x */
    // /*
    #define x /**/
    and Martin's does this

    Code:
    #define x printf("") /* comment */
    #define x printf([COLOR=RED]"/*") /* comment */
    #define x printf("//")
    #define x printf(" /* " // "*/");
    /* #define x x */
    [COLOR=GREEN]// /*
    #define x /**/
    and dwks' codeform

    Code:
    #define x printf("") /* comment */
    #define x printf("/*") /* comment */
    #define x printf("//")
    #define x printf(" /* " // "*/");
    /* #define x x */
    // /*
    #define x /**/
    which, by my reckoning, puts SiavoshKC's CPP Code Painter in the lead at the moment.
    ===
    Don't grumble about what you can't have;
    be grateful you don't get what you deserve.

  4. #19
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    How do you come up with these beauts dwks?

  5. #20
    Registered User
    Join Date
    Oct 2004
    Posts
    151
    Quote Originally Posted by risby
    which, by my reckoning, puts SiavoshKC's CPP Code Painter in the lead at the moment.
    So it's still tied with Vim, then:
    Code:
    #define x printf("") /* comment */
    #define x printf("/*") /* comment */
    #define x printf("//")
    #define x printf(" /* "// "*/");
    /* #define x x */
    // /*
    #define x /**/
    System: Debian Sid and FreeBSD 7.0. Both with GCC 4.3.

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

  6. #21
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Except for the gaudy colors

  7. #22
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    How about:
    Code:
    #if !defined DOODAH
    #endif
    Most editors/ides I've used handle the '#if' but omit highlighting for the whole of #if !defined'.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  8. #23
    Registered User
    Join Date
    Oct 2004
    Posts
    151
    It colors everything as a preprocessor directive.
    Code:
    #if defined DOODAH
    #endif
    Last edited by zx-1; 09-22-2006 at 04:59 AM.
    System: Debian Sid and FreeBSD 7.0. Both with GCC 4.3.

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

  9. #24
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Sorry, I meant some editors that just highlight the preprocessor directive itself would only highlight the #if and leave the '!defined DOODAH' unaffected. I note that msvc2005 can handle this but scite/wscite does not (and probably any other editor that uses the scintilla widget).
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  10. #25
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Code::Blocks highlights the whole text. It does use the scintilla widget
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  11. #26
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    I'm not describing highlighting the entire line, only the preprocessor directive itself.

    You can configure the scintilla widget to behave in a similar fashion with regards to highlighting preprocessor directives as msvc.

    But if you do so, it will not highlight the whole of that line containing that particular preprocessor directive ie, you'll get
    Code:
    //scintilla does this if configured to highlight only the directive:
    #if !defined DOODAH
    instead of
    Code:
    
    #if !defined DOODAH
    As far as I know, code::blocks doesn't yet implement this feature of the scintilla widget.

    Note that when so configured the scintilla widget will highlight other preprocessor lines as expected, eg
    Code:
    #define BLAH_BLAH
    #ifndef HOOHAH
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  12. #27
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Oh! I see your point.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  13. #28
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    My code painter will search for specific keywords in preprocessor directive line and will highlight them.

    Code:
    #if !defined CPP
    It works now but it is not ideal.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

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