1 /************************* Required for every parser *************************/
3 /* Parses a string buffer with C/C++ code.
5 * @param *buffer The string to parse.
6 * @param length The length of the string to parse.
7 * @param count Integer flag specifying whether or not to count lines. If yes,
8 * uses the Ragel machine optimized for counting. Otherwise uses the Ragel
9 * machine optimized for returning entity positions.
10 * @param *callback Callback function. If count is set, callback is called for
11 * every line of code, comment, or blank with 'lcode', 'lcomment', and
12 * 'lblank' respectively. Otherwise callback is called for each entity found.
14 void parse_c(char *buffer, int length, int count,
15 void (*callback) (const char *lang, const char *entity, int s,
22 cs = (count) ? c_en_c_line : c_en_c_entity;
25 // if no newline at EOF; callback contents of last line
26 if (count) { process_last_line(C_LANG) }
31 /*****************************************************************************/