+
+<*>^#[ \t]*line[ \t]+[0-9]+([ \t]\"[^\n\r\f\"]*\")? {
+ char *p;
+ char *number;
+ char *filename;
+ char *str=g_strdup(yytext);
+
+ /* find first digit of line number */
+ p=str;
+ while(*p&&!isdigit(*p)) p++;
+ number=p;
+
+ /* find end of line number */
+ while(*p&&isdigit(*p)) p++;
+ if(*p) *p++=0;
+
+ /* find beginning of filename */
+ p=strchr(p,'"');
+ if(p) p++;
+ filename=p;
+
+ /* find end of filename */
+ if(p) p=strchr(p,'"');
+ if(p) *p=0;
+
+ /* stash number (minus one because we don't count this line) */
+ if(number) line_no=atoi(number)-1;
+
+ /* stash filename */
+ if(filename) {
+ if(hline_filename) g_free(hline_filename);
+ hline_filename=g_strdup(filename);
+ }
+
+ /* clean up */
+ g_free(str);
+}
+
+<C_CODE>^#[ \t]*include[ \t][<"][^\n\r">]*[>"] {
+ if(look_for_includes==1) {
+ char *p;
+ char *file;
+ char *str = g_strdup(yytext);
+ file = strchr(str,'"');
+ if(!file) file = strchr(str,'<');
+ file++;
+ p = strchr(file,'"');
+ if(!p) p = strchr(file,'>');
+ if (p != NULL) {
+ *p = '\0';
+ include_files = g_list_prepend(include_files,g_strdup(file));
+ g_free(str);
+ }
+ }
+ REJECT;
+}
+
+<CLASS_CODE_I>\/\*\*[ \t]*$ {
+ /* eat out gtk doc stuff */
+ BEGIN(GTK_DOC_BEFORE_NAME);
+ clear_cbuf();
+ }
+<GTK_DOC_BEFORE_NAME>^[ \t]*\*[ \t]*$ {
+ /* empty doc lines */
+ ;
+ }
+<GTK_DOC_BEFORE_NAME>^[ \t]*\*\ [_a-zA-Z][_a-zA-Z0-9]*:?[ \t]*$ {
+ char *p;
+ BEGIN(GTK_DOC);
+ p = strchr(yytext, '*');
+ g_free(gtk_doc_func);
+ gtk_doc_func = g_strdup(p+2);
+ p = strchr(gtk_doc_func, ':');
+ if(p) *p='\0';
+ g_strstrip(gtk_doc_func);
+ }
+<GTK_DOC_BEFORE_NAME>\*\/ {
+ BEGIN(CLASS_CODE_I);
+ }
+<GTK_DOC_BEFORE_NAME>. {
+ BEGIN(COMMENT);
+ before_comment = CLASS_CODE_I;
+ }
+<GTK_DOC>^[ \t]*\*[ \t]*$ {
+ /* empty doc lines */
+ add_to_cbuf(" *\n");
+ }
+<GTK_DOC>^[ \t]*\*?\*\/ {
+ BEGIN(CLASS_CODE_I);
+ add_gtk_doc_func();
+ }
+<GTK_DOC>^[ \t]*\*[ \t] {
+ fflush(stdout);
+ add_to_cbuf(" * ");
+ BEGIN(GTK_DOC_LINE);
+ }
+<GTK_DOC>\*\/ {
+ BEGIN(CLASS_CODE_I);
+ }
+<GTK_DOC>. {
+ BEGIN(COMMENT);
+ before_comment = CLASS_CODE_I;
+ }
+<GTK_DOC_LINE>\*\/ {
+ BEGIN(CLASS_CODE_I);
+ add_to_cbuf("\n");
+ add_gtk_doc_func();
+ }
+<GTK_DOC_LINE>.$ {
+ BEGIN(GTK_DOC);
+ add_to_cbuf(yytext);
+ add_to_cbuf("\n");
+ }
+<GTK_DOC_LINE>. {
+ fflush(stdout);
+ add_to_cbuf(yytext);
+ }
+
+<C_CODE>\/\/.*$ { add_to_cbuf(yytext); /*comment, ignore*/ }