binutils-gdb/gas/config/loongarch-lex.l
Alan Modra fd67aa1129 Update year range in copyright notice of binutils files
Adds two new external authors to etc/update-copyright.py to cover
bfd/ax_tls.m4, and adds gprofng to dirs handled automatically, then
updates copyright messages as follows:

1) Update cgen/utils.scm emitted copyrights.
2) Run "etc/update-copyright.py --this-year" with an extra external
   author I haven't committed, 'Kalray SA.', to cover gas testsuite
   files (which should have their copyright message removed).
3) Build with --enable-maintainer-mode --enable-cgen-maint=yes.
4) Check out */po/*.pot which we don't update frequently.
2024-01-04 22:58:12 +10:30

62 lines
1.7 KiB
Plaintext

%option noyywrap
/*
Copyright (C) 2021-2024 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GAS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING3. If not,
see <http://www.gnu.org/licenses/>. */
%{
#include "as.h"
#include "loongarch-parse.h"
/* Flex generates static functions "input" & "unput" which are not used. */
#define YY_NO_INPUT
#define YY_NO_UNPUT
%}
D [0-9]
/* We consider anything greater than \x7f to be a "letter" for UTF-8
support. See the lex_type array in ../read.c. */
L [a-zA-Z_\.\$\x80-\xff]
H [0-9A-Fa-f]
hex 0[xX]{H}+
oct 0[0-7]+
bin 0[bB][01]+
dec ([1-9]{D}*)|0
id ({D}+[fb])|({L}({D}|{L})*)|(:{dec}[bf])
ws [ \t\v\f]+
%%
{dec} { yylval.imm = strtoull (yytext, 0, 0); return INTEGER; }
{hex} { yylval.imm = strtoull (yytext + 2, 0, 16); return INTEGER; }
{bin} { yylval.imm = strtoull (yytext + 2, 0, 2); return INTEGER; }
{oct} { yylval.imm = strtoull (yytext + 1, 0, 8); return INTEGER; }
{id} { yylval.c_str = strdup (yytext);return IDENTIFIER; }
{ws} { }
">>" { return RIGHT_OP; }
"<<" { return LEFT_OP; }
"&&" { return AND_OP; }
"||" { return OR_OP; }
"<=" { return LE_OP; }
">=" { return GE_OP; }
"==" { return EQ_OP; }
"!=" { return NE_OP; }
. { return yytext[0];}
%%