From 737d248a127f51d20555de53b9dfe28ca4682b54 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Tue, 25 Mar 2014 13:55:14 +0800 Subject: assembler: distinguish the channel of .z from the condition of .z The scratch patch only works for generic register Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75631 Tested-by: Matt Turner Signed-off-by: Xiang, Haihao Signed-off-by: Damien Lespiau --- assembler/lex.l | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'assembler') diff --git a/assembler/lex.l b/assembler/lex.l index 81a52baf..1ba576bf 100644 --- a/assembler/lex.l +++ b/assembler/lex.l @@ -24,6 +24,8 @@ int yycolumn = 1; %x CHANNEL %x LINENUMBER %x FILENAME +%x REG +%x DOTSEL %% \/\/.*[\r\n] { yycolumn = 1; } /* eat up single-line comments */ @@ -247,8 +249,46 @@ yylval.integer = BRW_CHANNEL_W; [gr][0-9]+ { yylval.integer = atoi(yytext + 1); + BEGIN(REG); return GENREG; } +"<" { return LANGLE; } +[0-9][0-9]* { + yylval.integer = strtoul(yytext, NULL, 10); + return INTEGER; +} +">" { return RANGLE; } + +"," { return COMMA; } +"." { BEGIN(DOTSEL); return DOT; } +";" { return SEMICOLON; } + +"x" { + yylval.integer = BRW_CHANNEL_X; + return X; +} +"y" { + yylval.integer = BRW_CHANNEL_Y; + return Y; +} +"z" { + yylval.integer = BRW_CHANNEL_Z; + return Z; +} +"w" { + yylval.integer = BRW_CHANNEL_W; + return W; +} +[0-9][0-9]* { + yylval.integer = strtoul(yytext, NULL, 10); + BEGIN(REG); + return INTEGER; +} +. { + yyless(0); + BEGIN(INITIAL); +} + [gr] { return GENREGFILE; } @@ -296,6 +336,11 @@ yylval.integer = BRW_CHANNEL_W; return LMS; } +. { + yyless(0); + BEGIN(INITIAL); +} + /* * Lexing of register types should probably require the ":" symbol specified * in the BNF of the assembly, but our existing source didn't use that syntax. -- cgit v1.2.3