Dirty syntax highlighting example

BlitzMax Forums/BlitzMax Programming/Dirty syntax highlighting example

To program a highlighter, you need to program a lexer.

Function Test:Short(Blub:Int=8, Blub2:String="hello")
EndFunction


-- Terminals
Letter = [ "A".."Z" ] | [ "a".."z" ] ;
Digit = [ "0".."9" ] ;

-- Nonterminals
Types = "Int" | "String" | "Short" ;
Ident = Letter { Letter | Digit } ;
Parameter = Ident ":" Types ;
ParameterList = "(" Parameter { "," Parameter } ")" ;
Function = "Function" Parameter ParameterList "EndFunction" ;

Like this.

Very compilcated :)
Have fun!

cu olli