Another quick update for the syntax highlighter. I've rewritten a bit of the main program for extensibility and I've bundled an HTML tokenizer (unfortunately this is a finite state automata, its almost impossible to go completely stateless) and syntax files. Coinciding with some of the new changes the php syntax file has been linked to the html syntax file so they can be highlighted in tandem.
PlainCommand line syntax highlighter ------------------------------- Getting Started: Requirements: Requires PHP 5.2.x or greater Installing: 1. Extract to desired directory 2. Make 'highlight' executable 3. Edit RESC_DIR constant in 'highlight' to point to the directory 4. (optional) symlink highlight file in /usr/bin/ Usage: See command (highlight -h) Extending: To add a syntax to the highlighter you need to create two files: <syntax>.syn and <syntax>.lib. <syntax>.syn will be a newline separated file containing the tokens and associated color (see man console_codes) Example: T_STRING 1;32 T_ELSEIF 31 The tokens in <syntax>.syn must match the tokens produced by <syntax>.lib. The .syn files can link together by using the #LINK directive ie., T_STRING 1;32 T_ELSEIF 31 #LINK html.syn This will bring in any of the highlighting from the other .syn file. The <syntax>.lib file at minimum must contain the function tokenize_<syntax> ie., tokenize_php. This function will return an array of tokenizations of the code passed to the function as a string. The array should follow the format of: array( 0 => array( 'token' => 'T_STRING', 'string' => "'this is some string in the code'" ), 1 => array( 'token' => 'T_ELSEIF', 'string' => 'elseif' ) ) See the bundled php.lib and php.syn for more examples. Each token may have a specialized handler for the color, see T_VARIABLE in php.syn and handlevar() in php.lib as an example. Coinciding with the #LINK directive in the .syn files you must include() or require() the appropriate .tok file to produce tokens for the colors.