1: #ifndef·SYNTAX_H 2: #define·SYNTAX_H 3: 4: #ifdef·__cplusplus 5: extern·"C"·{ 6: #endif 7: 8: typedef·enum·{ 9: ··IDENT=0,·KEYWORD,·COMMENT,·STRING,·CHAR,·PREPROCESSOR,·OPERATOR, 10: ··NUMBER,·INVALID,·WHITESPACE,·UNDEFINED,·NONE 11: }·syntax_t; 12: 13: typedef·enum·{ 14: ··C=0,·CPP,·JAVA 15: }·language_t; 16: extern·language_t·language;··/* which keyword set and comment style to use */ 17: 18: /* get_syntax: figure out the syntax of a string 19: * parameters: 20: * char *buf: the full line in question 21: * int i: the current index into the line 22: * int *di: this will return how much i should be incremented 23: * int reset: this should be true each time a new line is parsed 24: * return value: 25: * one of the syntax_t values defined above 26: * notes: 27: * this must be called repeatedly for a line, and i must always 28: * be incremented by the amount returned in *di. All lines are 29: * independent. Use reset=1 when starting a new line. 30: * See chtml.c and codeviewer.c for examples. 31: */ 32: syntax_t·get_syntax(char·*buf,·int·i,·int·*di,·int·reset); 33: 34: #ifdef·__cplusplus 35: } 36: #endif 37: 38: #endif