delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/28/15:52:44

From: "Christopher Nelson" <paradox AT gye DOT satnet DOT net>
To: <djgpp AT delorie DOT com>
Subject: Re: DJGPP Project Idea
Date: Sun, 28 Mar 1999 13:19:49 -0700
Message-ID: <01be7958$55557760$LocalHost@thendren>
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Reply-To: djgpp AT delorie DOT com


>I started making an editor in visual basic (yuck!) and I got stumped on the
>syntax highlighting.  I could get it to highlight a document after the
>document was done, by clicking on a menu, and i eventaully got it to
>highlight a word after the word was done, but i couldn't get it to work if
>you edited a word.  it was really sloppy code too, so i just got
discouraged
>and gave up.  if anyone knows how to do syntax highlighting the "right"
was,
>i would really like to know.

the RIGHT way is somewhat relative to the project, but in my opinion, the
most perfect method is a simple LEX class that parses the file out just like
a compiler (without the actual parser (e.g. BISON) code, just retrieving
tokens, you know, the lexical part of it) and passing that to a draw
routine.  e.g. :

    document_stream->lexer->text_drawer

another simple way is just parsing each line with something like strbrk,
testing tokens (exactly like Lex would) and if they match a predefined
"reserved word" paint it the color indicated, otherwise, paint it normal.

>>Tom Fjellstrom wrote:
>>>
>>> I was wondering if any one would like to see a full featured IDE for
>>> DJGPP in windows *groan*.
>>> I have been thinking about it for some time, and haven't  gotten any
>>> thing done except for the basic gui layout . If any one would like to
>>> offer some spare time to help It might actually get done ;)

I actually wrote an editor for a different language I was developing in
VisualBasic 5.0, but abandoned it because I found DJGPP and decided that I
didn't need to write my own compiler after all.  the code should be fairly
straightforeward, and the list of reserved words is simple to modify.  it
also colors stuff like '[' and ']', etc.  It uses the Win95 RTF control.



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019