Re: Syntax highlighting theory implmentation



learfox furry ao net wrote:

lfan> Hi, I need to write a simple app for our company (OpenSource and
lfan> non-commercial), it involes a text editor that needs a GtkText widget
lfan> that handles syntax highlighting.

lfan> Nothing fancy, just to highlight some words like `if' and `then'.

Hmmm,  it's the same thing. You still must implement a complete syntax
highlighting algorithm.

[cut]

First, I recommend you don't develop a new editor which support syntax
highlighting.  It's a big work, that others did before, you don't need
to  invent  the  wheel  again.  GtkEditor is a very nice editor, whose
scanners  are  easy  to  understand and to wrote. But they're problems
with  it : It is based on tktext-port, which is now not maintained any
more. So, it will be stable only when Gtk+ 2.0 is out. But it is based
on  flex  which  is the best way to implement syntax highlighting. You
can  find it at gtkeditor.sourceforge.net . But they're still bugs, in
tktext-port (obviously, but they'll be fixed when Gtk2 is out), and in
GtkEditor (that's not a stable version).
Otherway,  you  can  take  a look at GtkExText, or GtkScText, and some
others   which   I  guess  are  listed in the Gtk+ Widgets list, whose
address  I  can't recall. But they're based on regex, with the code of
the old GtkEditor branch (before 0.10).

If   you   still  want  to  develop  your  own  editor,  I've  just  a
recommendation   :   Use  Flex. Flex was done to perform such actions.
And it is in the Ten Commandments of the C Programmers, that's a reference :-)

lfan> Thanks in advance!

lfan> --
lfan> Sincerely,                  ,"-_                         \|/
lfan> -Capt. Taura M.             ,   O=__                    --X--
lfan> ..__                         ,_JNMNNEO=_                 /|\
lfan> OMNOUMmnne.                  {OMMNNNEEEEOO=_
lfan> UOOOBIOOOEOMMn.               'LONMMMMNNEEEOOO=.__..,,..
lfan> UUOOEUUOOOOOOOObe              '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
lfan> OOUUUIEEIOONNOIUbe.                "7OMMMMNNNNNWWEEEEOOOOOO"   "'.
lfan> EEBNNMMMNWNWWEEIMMNe.             __  7EMMMNNNNNWWWEEEEEEEOO.     " .
lfan> NNMMMMWWWMMMWEINMMMNn            "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._     .
lfan>                   http://furry.ao.net/~learfox/



bye,

--
mmenal
                                 ____               _    _                    _
         __  __ _ __  __  __    / ___| ___  _   _  | |  ( )_ __  _   ___  __ | |
(o-      \ \/ /(_)\ \/ /  _ \  | |  _ /'_ \| | | | | |  | | '_ \| | | \ \/ / | |
/\        \  / | | \  / | __/  | |_| | | | | |_| | | |__| | | | | |_| |>  <  |_|
L_/_       \/  |_|  \/  \___|  \_____|_| |_|\__,_/ |____|_|_| |_|\__,_/_/\_\ (_)


 
______________________________________________________________________________
Vous avez un site perso ?
2 millions de francs à gagner sur i(france) !
Webmasters : ZE CONCOURS ! http://www.ifrance.com/_reloc/concours.emailif






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]