mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-28 10:16:12 +00:00
Support #line directives
This commit is contained in:
parent
b81aca4948
commit
082fbe8738
@ -5,9 +5,12 @@
|
|||||||
#include "brw_defines.h"
|
#include "brw_defines.h"
|
||||||
|
|
||||||
int saved_state = 0;
|
int saved_state = 0;
|
||||||
|
extern char *input_filename;
|
||||||
|
|
||||||
%}
|
%}
|
||||||
%x BLOCK_COMMENT
|
%x BLOCK_COMMENT
|
||||||
|
%x LINENUMBER
|
||||||
|
%x FILENAME
|
||||||
|
|
||||||
%%
|
%%
|
||||||
\/\/.*[\r\n] { } /* eat up single-line comments */
|
\/\/.*[\r\n] { } /* eat up single-line comments */
|
||||||
@ -22,7 +25,21 @@ int saved_state = 0;
|
|||||||
}
|
}
|
||||||
<BLOCK_COMMENT>. { }
|
<BLOCK_COMMENT>. { }
|
||||||
<BLOCK_COMMENT>[\r\n] { }
|
<BLOCK_COMMENT>[\r\n] { }
|
||||||
|
"#line"" "* {
|
||||||
|
saved_state = YYSTATE;
|
||||||
|
BEGIN(LINENUMBER);
|
||||||
|
}
|
||||||
|
<LINENUMBER>[0-9]+" "* {
|
||||||
|
yylineno = atoi (yytext) - 1;
|
||||||
|
BEGIN(FILENAME);
|
||||||
|
}
|
||||||
|
<FILENAME>\"[^\"]+\" {
|
||||||
|
char *name = malloc (yyleng - 1);
|
||||||
|
memmove (name, yytext + 1, yyleng - 2);
|
||||||
|
name[yyleng-1] = '\0';
|
||||||
|
input_filename = name;
|
||||||
|
BEGIN(saved_state);
|
||||||
|
}
|
||||||
/* used for both null send and null register. */
|
/* used for both null send and null register. */
|
||||||
"null" { return NULL_TOKEN; }
|
"null" { return NULL_TOKEN; }
|
||||||
|
|
||||||
@ -311,9 +328,8 @@ int saved_state = 0;
|
|||||||
[ \t\n]+ { } /* eat up whitespace */
|
[ \t\n]+ { } /* eat up whitespace */
|
||||||
|
|
||||||
. {
|
. {
|
||||||
printf("parse error at line %d: unexpected \"%s\"\n",
|
fprintf(stderr, "%s: %d: %s at \"%s\"\n",
|
||||||
yylineno, yytext);
|
input_filename, yylineno, "unexpected token", lex_text());
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user