3 Copyright (C) 2021-2023 Free Software Foundation, Inc.
5 This file is part of GAS, the GNU Assembler.
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING3. If not,
19 see <http://www.gnu.org/licenses/>. */
22 #include "loongarch-parse.h"
24 /* Flex generates static functions "input" & "unput" which are not used. */
30 /* We consider anything greater than \x7f to be a "letter" for UTF-8
31 support. See the lex_type array in ../read.c. */
32 L [a-zA-Z_\.\$\x80-\xff]
39 id ({D}+[fb])|({L}({D}|{L})*)|(:{dec}[bf])
44 {dec} { yylval.imm = strtoull (yytext, 0, 0); return INTEGER; }
45 {hex} { yylval.imm = strtoull (yytext + 2, 0, 16); return INTEGER; }
46 {bin} { yylval.imm = strtoull (yytext + 2, 0, 2); return INTEGER; }
47 {oct} { yylval.imm = strtoull (yytext + 1, 0, 8); return INTEGER; }
48 {id} { yylval.c_str = strdup (yytext);return IDENTIFIER; }
51 ">>" { return RIGHT_OP; }
52 "<<" { return LEFT_OP; }
53 "&&" { return AND_OP; }
54 "||" { return OR_OP; }
55 "<=" { return LE_OP; }
56 ">=" { return GE_OP; }
57 "==" { return EQ_OP; }
58 "!=" { return NE_OP; }
59 . { return yytext[0];}