"/*" BEGIN(comment_ml);
<comment_ml>[^*\n]* /* eat anything that's not a '*' */
<comment_ml>"*"+[^*/\n]* /* eat up '*'s not followed by '/'s */
-<comment_ml>\n ++yylineno;
+<comment_ml>\n
<comment_ml>"*"+"/" BEGIN(INITIAL);
"//" BEGIN(comment_sl);
-<comment_sl>[^\n]*\n ++yylineno; BEGIN(INITIAL);
+<comment_sl>[^\n]*\n BEGIN(INITIAL);
L\' BEGIN(char_const); return CHARACTER_CONSTANT_START;
\' BEGIN(char_const); return CHARACTER_CONSTANT_START;
int yylex_destroy(yyscan_t yyscanner);
BT_HIDDEN
void yyrestart(FILE * in_str, yyscan_t scanner);
+BT_HIDDEN
+int yyget_lineno(yyscan_t yyscanner);
struct gc_string {
struct bt_list_head gc;
BT_HIDDEN
void yyerror(struct ctf_scanner *scanner, const char *str)
{
- fprintf(stderr, "error %s\n", str);
+ fprintf(stderr, "error at line %d: %s\n",
+ yyget_lineno(scanner->scanner), str);
}
BT_HIDDEN
%define api.pure
/* %locations */
+%error-verbose
%parse-param {struct ctf_scanner *scanner}
%lex-param {struct ctf_scanner *scanner}
/*
struct ctf_scanner_scope root_scope;
struct ctf_scanner_scope *cs;
struct bt_list_head allocated_strings;
+ size_t lineno;
};
struct ctf_scanner *ctf_scanner_alloc(FILE *input);