1 %option noyywrap 2 /* 3 Copyright (C) 2021-2024 Free Software Foundation, Inc. 4 5 This file is part of GAS, the GNU Assembler. 6 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) 10 any later version. 11 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. 16 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/>. */ 20 %{ 21 #include "as.h" 22 #include "loongarch-parse.h" 23 24 /* Flex generates static functions "input" & "unput" which are not used. */ 25 #define YY_NO_INPUT 26 #define YY_NO_UNPUT 27 %} 28 29 D [0-9] 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] 33 H [0-9A-Fa-f] 34 35 hex 0[xX]{H}+ 36 oct 0[0-7]+ 37 bin 0[bB][01]+ 38 dec ([1-9]{D}*)|0 39 id ({D}+[fb])|({L}({D}|{L})*)|(:{dec}[bf]) 40 ws [ \t\v\f]+ 41 42 %% 43 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; } 49 {ws} { } 50 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];} 60 61 %% 62