Writing a syntax highlighter
Syntax highlighters can work in two very general ways. The first implements a full lexer and parser for the language(s) being highlighted, exactly identifying each token’s type (keyword, class name, instance name, variable type, preprocessor directive…). This provides all the information needed to exactly highlight the code according to some specification (keywords in red, class … Read more