[fpc-pascal]OT: Syntax Highlighting

Marco van de Voort marcov at stack.nl
Fri Nov 9 00:28:31 CET 2001


>  > their. So, my question is this; does anyone know of another method for
>  > syntax highlighting other then using pos() on each line? Is there a way to
>  > make pos() faster? Is there something better then pos() to check if a 
> string
>  > resides within another string?
> 
> You should stick to simple keyword highlighting in the beginning, real
> syntax highlighting is a very complicated business, requiring theoretical
> and practical familiarity with many concepts used in compiler design.
> 
> But even only to find keywords, pos() or anything similar is a completely
> impractical approach. What you have to do is to write a lexical scanner to
> scan your input and to turn it into tokens. 

[snip]

For an example of a lexical scanner, see the source of the ptop source
beautifier program, included with FPC. 





More information about the fpc-pascal mailing list