1 #ifndef ELM_CODE_SYNTAX_H_ 2 # define ELM_CODE_SYNTAX_H_ 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 8 /** 9 * @file 10 * @brief These routines are used for handling the parsing of Elm Code content. 11 */ 12 13 typedef struct _Elm_Code_Syntax Elm_Code_Syntax; 14 15 /** 16 * @brief Syntax highlighting helper functions. 17 * @defgroup Syntax Parsing and marking up syntax in files 18 * 19 * @{ 20 * 21 * Syntax functions for adding syntax highlighting to elm code. 22 * 23 */ 24 25 /** 26 * Lookup a syntax definition from a mime type. 27 * If there is no syntax known NULL will be returned. 28 * 29 * @param mime The mime type to be looked up for a matching syntax definition 30 * @return A syntax definition, if one is found, or NULL 31 * 32 * @ingroup Syntax 33 */ 34 EAPI Elm_Code_Syntax *elm_code_syntax_for_mime_get(const char *mime); 35 36 /** 37 * Parse a line and apply the syntax definition by inserting Elm_Code_Token into the line. 38 * 39 * @param syntax The syntax definition to use (from elm_code_syntax_for_mime_get) 40 * @param line The line that contains the content to parse and will receive the tokens 41 * 42 * @ingroup Syntax 43 */ 44 EAPI void elm_code_syntax_parse_line(Elm_Code_Syntax *syntax, Elm_Code_Line *line); 45 46 /** 47 * Parse a file and apply the syntax definition one line at a time. 48 * 49 * @param syntax The syntax definition to use (from elm_code_syntax_for_mime_get) 50 * @param file The file to parse - each line in the file will be processed 51 * 52 * @ingroup Syntax 53 */ 54 EAPI void elm_code_syntax_parse_file(Elm_Code_Syntax *syntax, Elm_Code_File *file); 55 56 57 /** 58 * @} 59 */ 60 61 #ifdef __cplusplus 62 } 63 #endif 64 65 #endif /* ELM_CODE_SYNTAX_H_ */ 66