loongarch-lex.c revision 1.1.1.1 1
2 #line 2 "config/loongarch-lex.c"
3
4 #define YY_INT_ALIGNED short int
5
6 /* A lexical scanner generated by flex */
7
8 #define FLEX_SCANNER
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 6
11 #define YY_FLEX_SUBMINOR_VERSION 4
12 #if YY_FLEX_SUBMINOR_VERSION > 0
13 #define FLEX_BETA
14 #endif
15
16 /* First, we deal with platform-specific or compiler-specific issues. */
17
18 /* begin standard C headers. */
19 #include <stdio.h>
20 #include <string.h>
21 #include <errno.h>
22 #include <stdlib.h>
23
24 /* end standard C headers. */
25
26 /* flex integer type definitions */
27
28 #ifndef FLEXINT_H
29 #define FLEXINT_H
30
31 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
32
33 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
34
35 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
36 * if you want the limit (max/min) macros for int types.
37 */
38 #ifndef __STDC_LIMIT_MACROS
39 #define __STDC_LIMIT_MACROS 1
40 #endif
41
42 #include <inttypes.h>
43 typedef int8_t flex_int8_t;
44 typedef uint8_t flex_uint8_t;
45 typedef int16_t flex_int16_t;
46 typedef uint16_t flex_uint16_t;
47 typedef int32_t flex_int32_t;
48 typedef uint32_t flex_uint32_t;
49 #else
50 typedef signed char flex_int8_t;
51 typedef short int flex_int16_t;
52 typedef int flex_int32_t;
53 typedef unsigned char flex_uint8_t;
54 typedef unsigned short int flex_uint16_t;
55 typedef unsigned int flex_uint32_t;
56
57 /* Limits of integral types. */
58 #ifndef INT8_MIN
59 #define INT8_MIN (-128)
60 #endif
61 #ifndef INT16_MIN
62 #define INT16_MIN (-32767-1)
63 #endif
64 #ifndef INT32_MIN
65 #define INT32_MIN (-2147483647-1)
66 #endif
67 #ifndef INT8_MAX
68 #define INT8_MAX (127)
69 #endif
70 #ifndef INT16_MAX
71 #define INT16_MAX (32767)
72 #endif
73 #ifndef INT32_MAX
74 #define INT32_MAX (2147483647)
75 #endif
76 #ifndef UINT8_MAX
77 #define UINT8_MAX (255U)
78 #endif
79 #ifndef UINT16_MAX
80 #define UINT16_MAX (65535U)
81 #endif
82 #ifndef UINT32_MAX
83 #define UINT32_MAX (4294967295U)
84 #endif
85
86 #ifndef SIZE_MAX
87 #define SIZE_MAX (~(size_t)0)
88 #endif
89
90 #endif /* ! C99 */
91
92 #endif /* ! FLEXINT_H */
93
94 /* begin standard C++ headers. */
95
96 /* TODO: this is always defined, so inline it */
97 #define yyconst const
98
99 #if defined(__GNUC__) && __GNUC__ >= 3
100 #define yynoreturn __attribute__((__noreturn__))
101 #else
102 #define yynoreturn
103 #endif
104
105 /* Returned upon end-of-file. */
106 #define YY_NULL 0
107
108 /* Promotes a possibly negative, possibly signed char to an
109 * integer in range [0..255] for use as an array index.
110 */
111 #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
112
113 /* Enter a start condition. This macro really ought to take a parameter,
114 * but we do it the disgusting crufty way forced on us by the ()-less
115 * definition of BEGIN.
116 */
117 #define BEGIN (yy_start) = 1 + 2 *
118 /* Translate the current start state into a value that can be later handed
119 * to BEGIN to return to the state. The YYSTATE alias is for lex
120 * compatibility.
121 */
122 #define YY_START (((yy_start) - 1) / 2)
123 #define YYSTATE YY_START
124 /* Action number for EOF rule of a given start state. */
125 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
126 /* Special action meaning "start processing a new file". */
127 #define YY_NEW_FILE yyrestart( yyin )
128 #define YY_END_OF_BUFFER_CHAR 0
129
130 /* Size of default input buffer. */
131 #ifndef YY_BUF_SIZE
132 #ifdef __ia64__
133 /* On IA-64, the buffer size is 16k, not 8k.
134 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
135 * Ditto for the __ia64__ case accordingly.
136 */
137 #define YY_BUF_SIZE 32768
138 #else
139 #define YY_BUF_SIZE 16384
140 #endif /* __ia64__ */
141 #endif
142
143 /* The state buf must be large enough to hold one state per character in the main buffer.
144 */
145 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
146
147 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
148 #define YY_TYPEDEF_YY_BUFFER_STATE
149 typedef struct yy_buffer_state *YY_BUFFER_STATE;
150 #endif
151
152 #ifndef YY_TYPEDEF_YY_SIZE_T
153 #define YY_TYPEDEF_YY_SIZE_T
154 typedef size_t yy_size_t;
155 #endif
156
157 extern int yyleng;
158
159 extern FILE *yyin, *yyout;
160
161 #define EOB_ACT_CONTINUE_SCAN 0
162 #define EOB_ACT_END_OF_FILE 1
163 #define EOB_ACT_LAST_MATCH 2
164
165 #define YY_LESS_LINENO(n)
166 #define YY_LINENO_REWIND_TO(ptr)
167
168 /* Return all but the first "n" matched characters back to the input stream. */
169 #define yyless(n) \
170 do \
171 { \
172 /* Undo effects of setting up yytext. */ \
173 int yyless_macro_arg = (n); \
174 YY_LESS_LINENO(yyless_macro_arg);\
175 *yy_cp = (yy_hold_char); \
176 YY_RESTORE_YY_MORE_OFFSET \
177 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
178 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
179 } \
180 while ( 0 )
181 #define unput(c) yyunput( c, (yytext_ptr) )
182
183 #ifndef YY_STRUCT_YY_BUFFER_STATE
184 #define YY_STRUCT_YY_BUFFER_STATE
185 struct yy_buffer_state
186 {
187 FILE *yy_input_file;
188
189 char *yy_ch_buf; /* input buffer */
190 char *yy_buf_pos; /* current position in input buffer */
191
192 /* Size of input buffer in bytes, not including room for EOB
193 * characters.
194 */
195 int yy_buf_size;
196
197 /* Number of characters read into yy_ch_buf, not including EOB
198 * characters.
199 */
200 int yy_n_chars;
201
202 /* Whether we "own" the buffer - i.e., we know we created it,
203 * and can realloc() it to grow it, and should free() it to
204 * delete it.
205 */
206 int yy_is_our_buffer;
207
208 /* Whether this is an "interactive" input source; if so, and
209 * if we're using stdio for input, then we want to use getc()
210 * instead of fread(), to make sure we stop fetching input after
211 * each newline.
212 */
213 int yy_is_interactive;
214
215 /* Whether we're considered to be at the beginning of a line.
216 * If so, '^' rules will be active on the next match, otherwise
217 * not.
218 */
219 int yy_at_bol;
220
221 int yy_bs_lineno; /**< The line count. */
222 int yy_bs_column; /**< The column count. */
223
224 /* Whether to try to fill the input buffer when we reach the
225 * end of it.
226 */
227 int yy_fill_buffer;
228
229 int yy_buffer_status;
230
231 #define YY_BUFFER_NEW 0
232 #define YY_BUFFER_NORMAL 1
233 /* When an EOF's been seen but there's still some text to process
234 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
235 * shouldn't try reading from the input source any more. We might
236 * still have a bunch of tokens to match, though, because of
237 * possible backing-up.
238 *
239 * When we actually see the EOF, we change the status to "new"
240 * (via yyrestart()), so that the user can continue scanning by
241 * just pointing yyin at a new input file.
242 */
243 #define YY_BUFFER_EOF_PENDING 2
244
245 };
246 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
247
248 /* Stack of input buffers. */
249 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
250 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
251 static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
252
253 /* We provide macros for accessing buffer states in case in the
254 * future we want to put the buffer states in a more general
255 * "scanner state".
256 *
257 * Returns the top of the stack, or NULL.
258 */
259 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
260 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
261 : NULL)
262 /* Same as previous macro, but useful when we know that the buffer stack is not
263 * NULL or when we need an lvalue. For internal use only.
264 */
265 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
266
267 /* yy_hold_char holds the character lost when yytext is formed. */
268 static char yy_hold_char;
269 static int yy_n_chars; /* number of characters read into yy_ch_buf */
270 int yyleng;
271
272 /* Points to current character in buffer. */
273 static char *yy_c_buf_p = NULL;
274 static int yy_init = 0; /* whether we need to initialize */
275 static int yy_start = 0; /* start state number */
276
277 /* Flag which is used to allow yywrap()'s to do buffer switches
278 * instead of setting up a fresh yyin. A bit of a hack ...
279 */
280 static int yy_did_buffer_switch_on_eof;
281
282 void yyrestart ( FILE *input_file );
283 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
284 YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
285 void yy_delete_buffer ( YY_BUFFER_STATE b );
286 void yy_flush_buffer ( YY_BUFFER_STATE b );
287 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
288 void yypop_buffer_state ( void );
289
290 static void yyensure_buffer_stack ( void );
291 static void yy_load_buffer_state ( void );
292 static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
293 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
294
295 YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
296 YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
297 YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
298
299 void *yyalloc ( yy_size_t );
300 void *yyrealloc ( void *, yy_size_t );
301 void yyfree ( void * );
302
303 #define yy_new_buffer yy_create_buffer
304 #define yy_set_interactive(is_interactive) \
305 { \
306 if ( ! YY_CURRENT_BUFFER ){ \
307 yyensure_buffer_stack (); \
308 YY_CURRENT_BUFFER_LVALUE = \
309 yy_create_buffer( yyin, YY_BUF_SIZE ); \
310 } \
311 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
312 }
313 #define yy_set_bol(at_bol) \
314 { \
315 if ( ! YY_CURRENT_BUFFER ){\
316 yyensure_buffer_stack (); \
317 YY_CURRENT_BUFFER_LVALUE = \
318 yy_create_buffer( yyin, YY_BUF_SIZE ); \
319 } \
320 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
321 }
322 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
323
324 /* Begin user sect3 */
325
326 #define yywrap() (/*CONSTCOND*/1)
327 #define YY_SKIP_YYWRAP
328 typedef flex_uint8_t YY_CHAR;
329
330 FILE *yyin = NULL, *yyout = NULL;
331
332 typedef int yy_state_type;
333
334 extern int yylineno;
335 int yylineno = 1;
336
337 extern char *yytext;
338 #ifdef yytext_ptr
339 #undef yytext_ptr
340 #endif
341 #define yytext_ptr yytext
342
343 static yy_state_type yy_get_previous_state ( void );
344 static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
345 static int yy_get_next_buffer ( void );
346 static void yynoreturn yy_fatal_error ( const char* msg );
347
348 /* Done after the current pattern has been matched and before the
349 * corresponding action - sets up yytext.
350 */
351 #define YY_DO_BEFORE_ACTION \
352 (yytext_ptr) = yy_bp; \
353 yyleng = (int) (yy_cp - yy_bp); \
354 (yy_hold_char) = *yy_cp; \
355 *yy_cp = '\0'; \
356 (yy_c_buf_p) = yy_cp;
357 #define YY_NUM_RULES 16
358 #define YY_END_OF_BUFFER 17
359 /* This struct is not used in this scanner,
360 but its presence is necessary. */
361 struct yy_trans_info
362 {
363 flex_int32_t yy_verify;
364 flex_int32_t yy_nxt;
365 };
366 static const flex_int16_t yy_accept[40] =
367 { 0,
368 0, 0, 17, 15, 6, 16, 15, 5, 15, 1,
369 1, 15, 15, 15, 15, 15, 6, 14, 5, 9,
370 4, 0, 0, 0, 5, 5, 1, 0, 0, 8,
371 11, 13, 12, 7, 10, 3, 2, 0, 0
372 } ;
373
374 static const YY_CHAR yy_ec[256] =
375 { 0,
376 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
377 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
378 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
379 1, 2, 4, 1, 1, 5, 1, 6, 1, 1,
380 1, 1, 1, 1, 1, 5, 1, 7, 8, 9,
381 9, 9, 9, 9, 9, 10, 10, 11, 1, 12,
382 13, 14, 1, 1, 15, 16, 15, 15, 15, 15,
383 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
384 5, 5, 5, 5, 5, 5, 5, 17, 5, 5,
385 1, 1, 1, 1, 5, 1, 15, 18, 15, 15,
386
387 15, 19, 5, 5, 5, 5, 5, 5, 5, 5,
388 5, 5, 5, 5, 5, 5, 5, 5, 5, 17,
389 5, 5, 1, 20, 1, 1, 1, 5, 5, 5,
390 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
391 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
392 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
393 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
394 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
395 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
396 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
397
398 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
399 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
400 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
401 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
402 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
403 5, 5, 5, 5, 5
404 } ;
405
406 static const YY_CHAR yy_meta[21] =
407 { 0,
408 1, 1, 1, 1, 2, 1, 3, 3, 3, 3,
409 1, 1, 1, 1, 4, 4, 2, 5, 5, 1
410 } ;
411
412 static const flex_int16_t yy_base[45] =
413 { 0,
414 0, 0, 74, 75, 71, 75, 59, 0, 65, 14,
415 7, 63, 15, 56, 21, 47, 59, 75, 0, 75,
416 20, 32, 35, 0, 37, 75, 28, 30, 32, 75,
417 75, 75, 75, 75, 75, 45, 0, 36, 75, 54,
418 57, 26, 60, 63
419 } ;
420
421 static const flex_int16_t yy_def[45] =
422 { 0,
423 39, 1, 39, 39, 39, 39, 39, 40, 39, 39,
424 41, 42, 39, 39, 39, 39, 39, 39, 40, 39,
425 10, 21, 39, 43, 39, 39, 41, 39, 44, 39,
426 39, 39, 39, 39, 39, 39, 43, 44, 0, 39,
427 39, 39, 39, 39
428 } ;
429
430 static const flex_int16_t yy_nxt[96] =
431 { 0,
432 4, 5, 6, 7, 8, 9, 10, 11, 11, 11,
433 12, 13, 14, 15, 8, 8, 8, 8, 8, 16,
434 21, 21, 21, 22, 26, 26, 30, 31, 29, 23,
435 24, 25, 26, 33, 34, 39, 39, 26, 22, 22,
436 22, 36, 36, 36, 36, 26, 26, 26, 26, 26,
437 26, 36, 36, 26, 26, 19, 19, 19, 19, 27,
438 17, 27, 37, 37, 37, 38, 35, 38, 32, 28,
439 20, 18, 17, 39, 3, 39, 39, 39, 39, 39,
440 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
441 39, 39, 39, 39, 39
442
443 } ;
444
445 static const flex_int16_t yy_chk[96] =
446 { 0,
447 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
448 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
449 10, 10, 10, 10, 11, 11, 13, 13, 42, 10,
450 10, 10, 10, 15, 15, 21, 21, 21, 22, 22,
451 22, 23, 23, 25, 25, 27, 27, 28, 28, 29,
452 29, 36, 36, 38, 38, 40, 40, 40, 40, 41,
453 17, 41, 43, 43, 43, 44, 16, 44, 14, 12,
454 9, 7, 5, 3, 39, 39, 39, 39, 39, 39,
455 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
456 39, 39, 39, 39, 39
457
458 } ;
459
460 static yy_state_type yy_last_accepting_state;
461 static char *yy_last_accepting_cpos;
462
463 extern int yy_flex_debug;
464 int yy_flex_debug = 0;
465
466 /* The intent behind this definition is that it'll catch
467 * any uses of REJECT which flex missed.
468 */
469 #define REJECT reject_used_but_not_detected
470 #define yymore() yymore_used_but_not_detected
471 #define YY_MORE_ADJ 0
472 #define YY_RESTORE_YY_MORE_OFFSET
473 char *yytext;
474 #line 1 "./config/loongarch-lex.l"
475 /*
476 Copyright (C) 2021-2022 Free Software Foundation, Inc.
477
478 This file is part of GAS, the GNU Assembler.
479
480 GAS is free software; you can redistribute it and/or modify
481 it under the terms of the GNU General Public License as published by
482 the Free Software Foundation; either version 3, or (at your option)
483 any later version.
484
485 GAS is distributed in the hope that it will be useful,
486 but WITHOUT ANY WARRANTY; without even the implied warranty of
487 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
488 GNU General Public License for more details.
489
490 You should have received a copy of the GNU General Public License
491 along with this program; see the file COPYING3. If not,
492 see <http://www.gnu.org/licenses/>. */
493 #line 21 "./config/loongarch-lex.l"
494 #include "as.h"
495 #include "loongarch-parse.h"
496
497 /* Flex generates static functions "input" & "unput" which are not used. */
498 #define YY_NO_INPUT
499 #define YY_NO_UNPUT
500 #line 500 "config/loongarch-lex.c"
501 /* We consider anything greater than \x7f to be a "letter" for UTF-8
502 support. See the lex_type array in ../read.c. */
503 #line 503 "config/loongarch-lex.c"
504
505 #define INITIAL 0
506
507 #ifndef YY_NO_UNISTD_H
508 /* Special case for "unistd.h", since it is non-ANSI. We include it way
509 * down here because we want the user's section 1 to have been scanned first.
510 * The user has a chance to override it with an option.
511 */
512 #include <unistd.h>
513 #endif
514
515 #ifndef YY_EXTRA_TYPE
516 #define YY_EXTRA_TYPE void *
517 #endif
518
519 static int yy_init_globals ( void );
520
521 /* Accessor methods to globals.
522 These are made visible to non-reentrant scanners for convenience. */
523
524 int yylex_destroy ( void );
525
526 int yyget_debug ( void );
527
528 void yyset_debug ( int debug_flag );
529
530 YY_EXTRA_TYPE yyget_extra ( void );
531
532 void yyset_extra ( YY_EXTRA_TYPE user_defined );
533
534 FILE *yyget_in ( void );
535
536 void yyset_in ( FILE * _in_str );
537
538 FILE *yyget_out ( void );
539
540 void yyset_out ( FILE * _out_str );
541
542 int yyget_leng ( void );
543
544 char *yyget_text ( void );
545
546 int yyget_lineno ( void );
547
548 void yyset_lineno ( int _line_number );
549
550 /* Macros after this point can all be overridden by user definitions in
551 * section 1.
552 */
553
554 #ifndef YY_SKIP_YYWRAP
555 #ifdef __cplusplus
556 extern "C" int yywrap ( void );
557 #else
558 extern int yywrap ( void );
559 #endif
560 #endif
561
562 #ifndef YY_NO_UNPUT
563
564 static void yyunput ( int c, char *buf_ptr );
565
566 #endif
567
568 #ifndef yytext_ptr
569 static void yy_flex_strncpy ( char *, const char *, int );
570 #endif
571
572 #ifdef YY_NEED_STRLEN
573 static int yy_flex_strlen ( const char * );
574 #endif
575
576 #ifndef YY_NO_INPUT
577 #ifdef __cplusplus
578 static int yyinput ( void );
579 #else
580 static int input ( void );
581 #endif
582
583 #endif
584
585 /* Amount of stuff to slurp up with each read. */
586 #ifndef YY_READ_BUF_SIZE
587 #ifdef __ia64__
588 /* On IA-64, the buffer size is 16k, not 8k */
589 #define YY_READ_BUF_SIZE 16384
590 #else
591 #define YY_READ_BUF_SIZE 8192
592 #endif /* __ia64__ */
593 #endif
594
595 /* Copy whatever the last rule matched to the standard output. */
596 #ifndef ECHO
597 /* This used to be an fputs(), but since the string might contain NUL's,
598 * we now use fwrite().
599 */
600 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
601 #endif
602
603 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
604 * is returned in "result".
605 */
606 #ifndef YY_INPUT
607 #define YY_INPUT(buf,result,max_size) \
608 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
609 { \
610 int c = '*'; \
611 int n; \
612 for ( n = 0; n < max_size && \
613 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
614 buf[n] = (char) c; \
615 if ( c == '\n' ) \
616 buf[n++] = (char) c; \
617 if ( c == EOF && ferror( yyin ) ) \
618 YY_FATAL_ERROR( "input in flex scanner failed" ); \
619 result = n; \
620 } \
621 else \
622 { \
623 errno=0; \
624 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
625 { \
626 if( errno != EINTR) \
627 { \
628 YY_FATAL_ERROR( "input in flex scanner failed" ); \
629 break; \
630 } \
631 errno=0; \
632 clearerr(yyin); \
633 } \
634 }\
635 \
636
637 #endif
638
639 /* No semi-colon after return; correct usage is to write "yyterminate();" -
640 * we don't want an extra ';' after the "return" because that will cause
641 * some compilers to complain about unreachable statements.
642 */
643 #ifndef yyterminate
644 #define yyterminate() return YY_NULL
645 #endif
646
647 /* Number of entries by which start-condition stack grows. */
648 #ifndef YY_START_STACK_INCR
649 #define YY_START_STACK_INCR 25
650 #endif
651
652 /* Report a fatal error. */
653 #ifndef YY_FATAL_ERROR
654 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
655 #endif
656
657 /* end tables serialization structures and prototypes */
658
659 /* Default declaration of generated scanner - a define so the user can
660 * easily add parameters.
661 */
662 #ifndef YY_DECL
663 #define YY_DECL_IS_OURS 1
664
665 extern int yylex (void);
666
667 #define YY_DECL int yylex (void)
668 #endif /* !YY_DECL */
669
670 /* Code executed at the beginning of each rule, after yytext and yyleng
671 * have been set up.
672 */
673 #ifndef YY_USER_ACTION
674 #define YY_USER_ACTION
675 #endif
676
677 /* Code executed at the end of each rule. */
678 #ifndef YY_BREAK
679 #define YY_BREAK /*LINTED*/break;
680 #endif
681
682 #define YY_RULE_SETUP \
683 YY_USER_ACTION
684
685 /** The main scanner function which does all the work.
686 */
687 YY_DECL
688 {
689 yy_state_type yy_current_state;
690 char *yy_cp, *yy_bp;
691 int yy_act;
692
693 if ( !(yy_init) )
694 {
695 (yy_init) = 1;
696
697 #ifdef YY_USER_INIT
698 YY_USER_INIT;
699 #endif
700
701 if ( ! (yy_start) )
702 (yy_start) = 1; /* first start state */
703
704 if ( ! yyin )
705 yyin = stdin;
706
707 if ( ! yyout )
708 yyout = stdout;
709
710 if ( ! YY_CURRENT_BUFFER ) {
711 yyensure_buffer_stack ();
712 YY_CURRENT_BUFFER_LVALUE =
713 yy_create_buffer( yyin, YY_BUF_SIZE );
714 }
715
716 yy_load_buffer_state( );
717 }
718
719 {
720 #line 42 "./config/loongarch-lex.l"
721
722
723 #line 723 "config/loongarch-lex.c"
724
725 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
726 {
727 yy_cp = (yy_c_buf_p);
728
729 /* Support of yytext. */
730 *yy_cp = (yy_hold_char);
731
732 /* yy_bp points to the position in yy_ch_buf of the start of
733 * the current run.
734 */
735 yy_bp = yy_cp;
736
737 yy_current_state = (yy_start);
738 yy_match:
739 do
740 {
741 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
742 if ( yy_accept[yy_current_state] )
743 {
744 (yy_last_accepting_state) = yy_current_state;
745 (yy_last_accepting_cpos) = yy_cp;
746 }
747 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
748 {
749 yy_current_state = (int) yy_def[yy_current_state];
750 if ( yy_current_state >= 40 )
751 yy_c = yy_meta[yy_c];
752 }
753 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
754 ++yy_cp;
755 }
756 while ( yy_base[yy_current_state] != 75 );
757
758 yy_find_action:
759 yy_act = yy_accept[yy_current_state];
760 if ( yy_act == 0 )
761 { /* have to back up */
762 yy_cp = (yy_last_accepting_cpos);
763 yy_current_state = (yy_last_accepting_state);
764 yy_act = yy_accept[yy_current_state];
765 }
766
767 YY_DO_BEFORE_ACTION;
768
769 do_action: /* This label is used only to access EOF actions. */
770
771 switch ( yy_act )
772 { /* beginning of action switch */
773 case 0: /* must back up */
774 /* undo the effects of YY_DO_BEFORE_ACTION */
775 *yy_cp = (yy_hold_char);
776 yy_cp = (yy_last_accepting_cpos);
777 yy_current_state = (yy_last_accepting_state);
778 goto yy_find_action;
779
780 case 1:
781 YY_RULE_SETUP
782 #line 44 "./config/loongarch-lex.l"
783 { yylval.imm = strtoull (yytext, 0, 0); return INTEGER; }
784 YY_BREAK
785 case 2:
786 YY_RULE_SETUP
787 #line 45 "./config/loongarch-lex.l"
788 { yylval.imm = strtoull (yytext + 2, 0, 16); return INTEGER; }
789 YY_BREAK
790 case 3:
791 YY_RULE_SETUP
792 #line 46 "./config/loongarch-lex.l"
793 { yylval.imm = strtoull (yytext + 2, 0, 2); return INTEGER; }
794 YY_BREAK
795 case 4:
796 YY_RULE_SETUP
797 #line 47 "./config/loongarch-lex.l"
798 { yylval.imm = strtoull (yytext + 1, 0, 8); return INTEGER; }
799 YY_BREAK
800 case 5:
801 YY_RULE_SETUP
802 #line 48 "./config/loongarch-lex.l"
803 { yylval.c_str = strdup (yytext);return IDENTIFIER; }
804 YY_BREAK
805 case 6:
806 YY_RULE_SETUP
807 #line 49 "./config/loongarch-lex.l"
808 { }
809 YY_BREAK
810 case 7:
811 YY_RULE_SETUP
812 #line 51 "./config/loongarch-lex.l"
813 { return RIGHT_OP; }
814 YY_BREAK
815 case 8:
816 YY_RULE_SETUP
817 #line 52 "./config/loongarch-lex.l"
818 { return LEFT_OP; }
819 YY_BREAK
820 case 9:
821 YY_RULE_SETUP
822 #line 53 "./config/loongarch-lex.l"
823 { return AND_OP; }
824 YY_BREAK
825 case 10:
826 YY_RULE_SETUP
827 #line 54 "./config/loongarch-lex.l"
828 { return OR_OP; }
829 YY_BREAK
830 case 11:
831 YY_RULE_SETUP
832 #line 55 "./config/loongarch-lex.l"
833 { return LE_OP; }
834 YY_BREAK
835 case 12:
836 YY_RULE_SETUP
837 #line 56 "./config/loongarch-lex.l"
838 { return GE_OP; }
839 YY_BREAK
840 case 13:
841 YY_RULE_SETUP
842 #line 57 "./config/loongarch-lex.l"
843 { return EQ_OP; }
844 YY_BREAK
845 case 14:
846 YY_RULE_SETUP
847 #line 58 "./config/loongarch-lex.l"
848 { return NE_OP; }
849 YY_BREAK
850 case 15:
851 YY_RULE_SETUP
852 #line 59 "./config/loongarch-lex.l"
853 { return yytext[0];}
854 YY_BREAK
855 case 16:
856 YY_RULE_SETUP
857 #line 61 "./config/loongarch-lex.l"
858 ECHO;
859 YY_BREAK
860 #line 860 "config/loongarch-lex.c"
861 case YY_STATE_EOF(INITIAL):
862 yyterminate();
863
864 case YY_END_OF_BUFFER:
865 {
866 /* Amount of text matched not including the EOB char. */
867 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
868
869 /* Undo the effects of YY_DO_BEFORE_ACTION. */
870 *yy_cp = (yy_hold_char);
871 YY_RESTORE_YY_MORE_OFFSET
872
873 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
874 {
875 /* We're scanning a new file or input source. It's
876 * possible that this happened because the user
877 * just pointed yyin at a new source and called
878 * yylex(). If so, then we have to assure
879 * consistency between YY_CURRENT_BUFFER and our
880 * globals. Here is the right place to do so, because
881 * this is the first action (other than possibly a
882 * back-up) that will match for the new input source.
883 */
884 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
885 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
886 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
887 }
888
889 /* Note that here we test for yy_c_buf_p "<=" to the position
890 * of the first EOB in the buffer, since yy_c_buf_p will
891 * already have been incremented past the NUL character
892 * (since all states make transitions on EOB to the
893 * end-of-buffer state). Contrast this with the test
894 * in input().
895 */
896 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
897 { /* This was really a NUL. */
898 yy_state_type yy_next_state;
899
900 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
901
902 yy_current_state = yy_get_previous_state( );
903
904 /* Okay, we're now positioned to make the NUL
905 * transition. We couldn't have
906 * yy_get_previous_state() go ahead and do it
907 * for us because it doesn't know how to deal
908 * with the possibility of jamming (and we don't
909 * want to build jamming into it because then it
910 * will run more slowly).
911 */
912
913 yy_next_state = yy_try_NUL_trans( yy_current_state );
914
915 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
916
917 if ( yy_next_state )
918 {
919 /* Consume the NUL. */
920 yy_cp = ++(yy_c_buf_p);
921 yy_current_state = yy_next_state;
922 goto yy_match;
923 }
924
925 else
926 {
927 yy_cp = (yy_c_buf_p);
928 goto yy_find_action;
929 }
930 }
931
932 else switch ( yy_get_next_buffer( ) )
933 {
934 case EOB_ACT_END_OF_FILE:
935 {
936 (yy_did_buffer_switch_on_eof) = 0;
937
938 if ( yywrap( ) )
939 {
940 /* Note: because we've taken care in
941 * yy_get_next_buffer() to have set up
942 * yytext, we can now set up
943 * yy_c_buf_p so that if some total
944 * hoser (like flex itself) wants to
945 * call the scanner after we return the
946 * YY_NULL, it'll still work - another
947 * YY_NULL will get returned.
948 */
949 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
950
951 yy_act = YY_STATE_EOF(YY_START);
952 goto do_action;
953 }
954
955 else
956 {
957 if ( ! (yy_did_buffer_switch_on_eof) )
958 YY_NEW_FILE;
959 }
960 break;
961 }
962
963 case EOB_ACT_CONTINUE_SCAN:
964 (yy_c_buf_p) =
965 (yytext_ptr) + yy_amount_of_matched_text;
966
967 yy_current_state = yy_get_previous_state( );
968
969 yy_cp = (yy_c_buf_p);
970 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
971 goto yy_match;
972
973 case EOB_ACT_LAST_MATCH:
974 (yy_c_buf_p) =
975 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
976
977 yy_current_state = yy_get_previous_state( );
978
979 yy_cp = (yy_c_buf_p);
980 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
981 goto yy_find_action;
982 }
983 break;
984 }
985
986 default:
987 YY_FATAL_ERROR(
988 "fatal flex scanner internal error--no action found" );
989 } /* end of action switch */
990 } /* end of scanning one token */
991 } /* end of user's declarations */
992 } /* end of yylex */
993
994 /* yy_get_next_buffer - try to read in a new buffer
995 *
996 * Returns a code representing an action:
997 * EOB_ACT_LAST_MATCH -
998 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
999 * EOB_ACT_END_OF_FILE - end of file
1000 */
1001 static int yy_get_next_buffer (void)
1002 {
1003 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1004 char *source = (yytext_ptr);
1005 int number_to_move, i;
1006 int ret_val;
1007
1008 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1009 YY_FATAL_ERROR(
1010 "fatal flex scanner internal error--end of buffer missed" );
1011
1012 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1013 { /* Don't try to fill the buffer, so this is an EOF. */
1014 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1015 {
1016 /* We matched a single character, the EOB, so
1017 * treat this as a final EOF.
1018 */
1019 return EOB_ACT_END_OF_FILE;
1020 }
1021
1022 else
1023 {
1024 /* We matched some text prior to the EOB, first
1025 * process it.
1026 */
1027 return EOB_ACT_LAST_MATCH;
1028 }
1029 }
1030
1031 /* Try to read more data. */
1032
1033 /* First move last chars to start of buffer. */
1034 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
1035
1036 for ( i = 0; i < number_to_move; ++i )
1037 *(dest++) = *(source++);
1038
1039 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1040 /* don't do the read, it's not guaranteed to return an EOF,
1041 * just force an EOF
1042 */
1043 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1044
1045 else
1046 {
1047 int num_to_read =
1048 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1049
1050 while ( num_to_read <= 0 )
1051 { /* Not enough room in the buffer - grow it. */
1052
1053 /* just a shorter name for the current buffer */
1054 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1055
1056 int yy_c_buf_p_offset =
1057 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1058
1059 if ( b->yy_is_our_buffer )
1060 {
1061 int new_size = b->yy_buf_size * 2;
1062
1063 if ( new_size <= 0 )
1064 b->yy_buf_size += b->yy_buf_size / 8;
1065 else
1066 b->yy_buf_size *= 2;
1067
1068 b->yy_ch_buf = (char *)
1069 /* Include room in for 2 EOB chars. */
1070 yyrealloc( (void *) b->yy_ch_buf,
1071 (yy_size_t) (b->yy_buf_size + 2) );
1072 }
1073 else
1074 /* Can't grow it, we don't own it. */
1075 b->yy_ch_buf = NULL;
1076
1077 if ( ! b->yy_ch_buf )
1078 YY_FATAL_ERROR(
1079 "fatal error - scanner input buffer overflow" );
1080
1081 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1082
1083 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1084 number_to_move - 1;
1085
1086 }
1087
1088 if ( num_to_read > YY_READ_BUF_SIZE )
1089 num_to_read = YY_READ_BUF_SIZE;
1090
1091 /* Read in more data. */
1092 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1093 (yy_n_chars), num_to_read );
1094
1095 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1096 }
1097
1098 if ( (yy_n_chars) == 0 )
1099 {
1100 if ( number_to_move == YY_MORE_ADJ )
1101 {
1102 ret_val = EOB_ACT_END_OF_FILE;
1103 yyrestart( yyin );
1104 }
1105
1106 else
1107 {
1108 ret_val = EOB_ACT_LAST_MATCH;
1109 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1110 YY_BUFFER_EOF_PENDING;
1111 }
1112 }
1113
1114 else
1115 ret_val = EOB_ACT_CONTINUE_SCAN;
1116
1117 if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1118 /* Extend the array by 50%, plus the number we really need. */
1119 int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1120 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1121 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
1122 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1123 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1124 /* "- 2" to take care of EOB's */
1125 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1126 }
1127
1128 (yy_n_chars) += number_to_move;
1129 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1130 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1131
1132 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1133
1134 return ret_val;
1135 }
1136
1137 /* yy_get_previous_state - get the state just before the EOB char was reached */
1138
1139 static yy_state_type yy_get_previous_state (void)
1140 {
1141 yy_state_type yy_current_state;
1142 char *yy_cp;
1143
1144 yy_current_state = (yy_start);
1145
1146 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1147 {
1148 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1149 if ( yy_accept[yy_current_state] )
1150 {
1151 (yy_last_accepting_state) = yy_current_state;
1152 (yy_last_accepting_cpos) = yy_cp;
1153 }
1154 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1155 {
1156 yy_current_state = (int) yy_def[yy_current_state];
1157 if ( yy_current_state >= 40 )
1158 yy_c = yy_meta[yy_c];
1159 }
1160 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1161 }
1162
1163 return yy_current_state;
1164 }
1165
1166 /* yy_try_NUL_trans - try to make a transition on the NUL character
1167 *
1168 * synopsis
1169 * next_state = yy_try_NUL_trans( current_state );
1170 */
1171 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1172 {
1173 int yy_is_jam;
1174 char *yy_cp = (yy_c_buf_p);
1175
1176 YY_CHAR yy_c = 1;
1177 if ( yy_accept[yy_current_state] )
1178 {
1179 (yy_last_accepting_state) = yy_current_state;
1180 (yy_last_accepting_cpos) = yy_cp;
1181 }
1182 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1183 {
1184 yy_current_state = (int) yy_def[yy_current_state];
1185 if ( yy_current_state >= 40 )
1186 yy_c = yy_meta[yy_c];
1187 }
1188 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1189 yy_is_jam = (yy_current_state == 39);
1190
1191 return yy_is_jam ? 0 : yy_current_state;
1192 }
1193
1194 #ifndef YY_NO_UNPUT
1195
1196 static void yyunput (int c, char * yy_bp )
1197 {
1198 char *yy_cp;
1199
1200 yy_cp = (yy_c_buf_p);
1201
1202 /* undo effects of setting up yytext */
1203 *yy_cp = (yy_hold_char);
1204
1205 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1206 { /* need to shift things up to make room */
1207 /* +2 for EOB chars. */
1208 int number_to_move = (yy_n_chars) + 2;
1209 char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1210 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1211 char *source =
1212 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1213
1214 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1215 *--dest = *--source;
1216
1217 yy_cp += (int) (dest - source);
1218 yy_bp += (int) (dest - source);
1219 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1220 (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1221
1222 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1223 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1224 }
1225
1226 *--yy_cp = (char) c;
1227
1228 (yytext_ptr) = yy_bp;
1229 (yy_hold_char) = *yy_cp;
1230 (yy_c_buf_p) = yy_cp;
1231 }
1232
1233 #endif
1234
1235 #ifndef YY_NO_INPUT
1236 #ifdef __cplusplus
1237 static int yyinput (void)
1238 #else
1239 static int input (void)
1240 #endif
1241
1242 {
1243 int c;
1244
1245 *(yy_c_buf_p) = (yy_hold_char);
1246
1247 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1248 {
1249 /* yy_c_buf_p now points to the character we want to return.
1250 * If this occurs *before* the EOB characters, then it's a
1251 * valid NUL; if not, then we've hit the end of the buffer.
1252 */
1253 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1254 /* This was really a NUL. */
1255 *(yy_c_buf_p) = '\0';
1256
1257 else
1258 { /* need more input */
1259 int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
1260 ++(yy_c_buf_p);
1261
1262 switch ( yy_get_next_buffer( ) )
1263 {
1264 case EOB_ACT_LAST_MATCH:
1265 /* This happens because yy_g_n_b()
1266 * sees that we've accumulated a
1267 * token and flags that we need to
1268 * try matching the token before
1269 * proceeding. But for input(),
1270 * there's no matching to consider.
1271 * So convert the EOB_ACT_LAST_MATCH
1272 * to EOB_ACT_END_OF_FILE.
1273 */
1274
1275 /* Reset buffer status. */
1276 yyrestart( yyin );
1277
1278 /*FALLTHROUGH*/
1279
1280 case EOB_ACT_END_OF_FILE:
1281 {
1282 if ( yywrap( ) )
1283 return 0;
1284
1285 if ( ! (yy_did_buffer_switch_on_eof) )
1286 YY_NEW_FILE;
1287 #ifdef __cplusplus
1288 return yyinput();
1289 #else
1290 return input();
1291 #endif
1292 }
1293
1294 case EOB_ACT_CONTINUE_SCAN:
1295 (yy_c_buf_p) = (yytext_ptr) + offset;
1296 break;
1297 }
1298 }
1299 }
1300
1301 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1302 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1303 (yy_hold_char) = *++(yy_c_buf_p);
1304
1305 return c;
1306 }
1307 #endif /* ifndef YY_NO_INPUT */
1308
1309 /** Immediately switch to a different input stream.
1310 * @param input_file A readable stream.
1311 *
1312 * @note This function does not reset the start condition to @c INITIAL .
1313 */
1314 void yyrestart (FILE * input_file )
1315 {
1316
1317 if ( ! YY_CURRENT_BUFFER ){
1318 yyensure_buffer_stack ();
1319 YY_CURRENT_BUFFER_LVALUE =
1320 yy_create_buffer( yyin, YY_BUF_SIZE );
1321 }
1322
1323 yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1324 yy_load_buffer_state( );
1325 }
1326
1327 /** Switch to a different input buffer.
1328 * @param new_buffer The new input buffer.
1329 *
1330 */
1331 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1332 {
1333
1334 /* TODO. We should be able to replace this entire function body
1335 * with
1336 * yypop_buffer_state();
1337 * yypush_buffer_state(new_buffer);
1338 */
1339 yyensure_buffer_stack ();
1340 if ( YY_CURRENT_BUFFER == new_buffer )
1341 return;
1342
1343 if ( YY_CURRENT_BUFFER )
1344 {
1345 /* Flush out information for old buffer. */
1346 *(yy_c_buf_p) = (yy_hold_char);
1347 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1348 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1349 }
1350
1351 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1352 yy_load_buffer_state( );
1353
1354 /* We don't actually know whether we did this switch during
1355 * EOF (yywrap()) processing, but the only time this flag
1356 * is looked at is after yywrap() is called, so it's safe
1357 * to go ahead and always set it.
1358 */
1359 (yy_did_buffer_switch_on_eof) = 1;
1360 }
1361
1362 static void yy_load_buffer_state (void)
1363 {
1364 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1365 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1366 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1367 (yy_hold_char) = *(yy_c_buf_p);
1368 }
1369
1370 /** Allocate and initialize an input buffer state.
1371 * @param file A readable stream.
1372 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1373 *
1374 * @return the allocated buffer state.
1375 */
1376 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1377 {
1378 YY_BUFFER_STATE b;
1379
1380 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
1381 if ( ! b )
1382 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1383
1384 b->yy_buf_size = size;
1385
1386 /* yy_ch_buf has to be 2 characters longer than the size given because
1387 * we need to put in 2 end-of-buffer characters.
1388 */
1389 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
1390 if ( ! b->yy_ch_buf )
1391 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1392
1393 b->yy_is_our_buffer = 1;
1394
1395 yy_init_buffer( b, file );
1396
1397 return b;
1398 }
1399
1400 /** Destroy the buffer.
1401 * @param b a buffer created with yy_create_buffer()
1402 *
1403 */
1404 void yy_delete_buffer (YY_BUFFER_STATE b )
1405 {
1406
1407 if ( ! b )
1408 return;
1409
1410 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1411 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1412
1413 if ( b->yy_is_our_buffer )
1414 yyfree( (void *) b->yy_ch_buf );
1415
1416 yyfree( (void *) b );
1417 }
1418
1419 /* Initializes or reinitializes a buffer.
1420 * This function is sometimes called more than once on the same buffer,
1421 * such as during a yyrestart() or at EOF.
1422 */
1423 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1424
1425 {
1426 int oerrno = errno;
1427
1428 yy_flush_buffer( b );
1429
1430 b->yy_input_file = file;
1431 b->yy_fill_buffer = 1;
1432
1433 /* If b is the current buffer, then yy_init_buffer was _probably_
1434 * called from yyrestart() or through yy_get_next_buffer.
1435 * In that case, we don't want to reset the lineno or column.
1436 */
1437 if (b != YY_CURRENT_BUFFER){
1438 b->yy_bs_lineno = 1;
1439 b->yy_bs_column = 0;
1440 }
1441
1442 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1443
1444 errno = oerrno;
1445 }
1446
1447 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1448 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1449 *
1450 */
1451 void yy_flush_buffer (YY_BUFFER_STATE b )
1452 {
1453 if ( ! b )
1454 return;
1455
1456 b->yy_n_chars = 0;
1457
1458 /* We always need two end-of-buffer characters. The first causes
1459 * a transition to the end-of-buffer state. The second causes
1460 * a jam in that state.
1461 */
1462 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1463 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1464
1465 b->yy_buf_pos = &b->yy_ch_buf[0];
1466
1467 b->yy_at_bol = 1;
1468 b->yy_buffer_status = YY_BUFFER_NEW;
1469
1470 if ( b == YY_CURRENT_BUFFER )
1471 yy_load_buffer_state( );
1472 }
1473
1474 /** Pushes the new state onto the stack. The new state becomes
1475 * the current state. This function will allocate the stack
1476 * if necessary.
1477 * @param new_buffer The new state.
1478 *
1479 */
1480 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1481 {
1482 if (new_buffer == NULL)
1483 return;
1484
1485 yyensure_buffer_stack();
1486
1487 /* This block is copied from yy_switch_to_buffer. */
1488 if ( YY_CURRENT_BUFFER )
1489 {
1490 /* Flush out information for old buffer. */
1491 *(yy_c_buf_p) = (yy_hold_char);
1492 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1493 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1494 }
1495
1496 /* Only push if top exists. Otherwise, replace top. */
1497 if (YY_CURRENT_BUFFER)
1498 (yy_buffer_stack_top)++;
1499 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1500
1501 /* copied from yy_switch_to_buffer. */
1502 yy_load_buffer_state( );
1503 (yy_did_buffer_switch_on_eof) = 1;
1504 }
1505
1506 /** Removes and deletes the top of the stack, if present.
1507 * The next element becomes the new top.
1508 *
1509 */
1510 void yypop_buffer_state (void)
1511 {
1512 if (!YY_CURRENT_BUFFER)
1513 return;
1514
1515 yy_delete_buffer(YY_CURRENT_BUFFER );
1516 YY_CURRENT_BUFFER_LVALUE = NULL;
1517 if ((yy_buffer_stack_top) > 0)
1518 --(yy_buffer_stack_top);
1519
1520 if (YY_CURRENT_BUFFER) {
1521 yy_load_buffer_state( );
1522 (yy_did_buffer_switch_on_eof) = 1;
1523 }
1524 }
1525
1526 /* Allocates the stack if it does not exist.
1527 * Guarantees space for at least one push.
1528 */
1529 static void yyensure_buffer_stack (void)
1530 {
1531 yy_size_t num_to_alloc;
1532
1533 if (!(yy_buffer_stack)) {
1534
1535 /* First allocation is just for 2 elements, since we don't know if this
1536 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1537 * immediate realloc on the next call.
1538 */
1539 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
1540 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1541 (num_to_alloc * sizeof(struct yy_buffer_state*)
1542 );
1543 if ( ! (yy_buffer_stack) )
1544 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1545
1546 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1547
1548 (yy_buffer_stack_max) = num_to_alloc;
1549 (yy_buffer_stack_top) = 0;
1550 return;
1551 }
1552
1553 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1554
1555 /* Increase the buffer to prepare for a possible push. */
1556 yy_size_t grow_size = 8 /* arbitrary grow size */;
1557
1558 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1559 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1560 ((yy_buffer_stack),
1561 num_to_alloc * sizeof(struct yy_buffer_state*)
1562 );
1563 if ( ! (yy_buffer_stack) )
1564 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1565
1566 /* zero only the new slots.*/
1567 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1568 (yy_buffer_stack_max) = num_to_alloc;
1569 }
1570 }
1571
1572 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1573 * @param base the character buffer
1574 * @param size the size in bytes of the character buffer
1575 *
1576 * @return the newly allocated buffer state object.
1577 */
1578 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1579 {
1580 YY_BUFFER_STATE b;
1581
1582 if ( size < 2 ||
1583 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1584 base[size-1] != YY_END_OF_BUFFER_CHAR )
1585 /* They forgot to leave room for the EOB's. */
1586 return NULL;
1587
1588 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
1589 if ( ! b )
1590 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1591
1592 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
1593 b->yy_buf_pos = b->yy_ch_buf = base;
1594 b->yy_is_our_buffer = 0;
1595 b->yy_input_file = NULL;
1596 b->yy_n_chars = b->yy_buf_size;
1597 b->yy_is_interactive = 0;
1598 b->yy_at_bol = 1;
1599 b->yy_fill_buffer = 0;
1600 b->yy_buffer_status = YY_BUFFER_NEW;
1601
1602 yy_switch_to_buffer( b );
1603
1604 return b;
1605 }
1606
1607 /** Setup the input buffer state to scan a string. The next call to yylex() will
1608 * scan from a @e copy of @a str.
1609 * @param yystr a NUL-terminated string to scan
1610 *
1611 * @return the newly allocated buffer state object.
1612 * @note If you want to scan bytes that may contain NUL values, then use
1613 * yy_scan_bytes() instead.
1614 */
1615 YY_BUFFER_STATE yy_scan_string (const char * yystr )
1616 {
1617
1618 return yy_scan_bytes( yystr, (int) strlen(yystr) );
1619 }
1620
1621 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1622 * scan from a @e copy of @a bytes.
1623 * @param yybytes the byte buffer to scan
1624 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1625 *
1626 * @return the newly allocated buffer state object.
1627 */
1628 YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
1629 {
1630 YY_BUFFER_STATE b;
1631 char *buf;
1632 yy_size_t n;
1633 int i;
1634
1635 /* Get memory for full buffer, including space for trailing EOB's. */
1636 n = (yy_size_t) (_yybytes_len + 2);
1637 buf = (char *) yyalloc( n );
1638 if ( ! buf )
1639 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1640
1641 for ( i = 0; i < _yybytes_len; ++i )
1642 buf[i] = yybytes[i];
1643
1644 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1645
1646 b = yy_scan_buffer( buf, n );
1647 if ( ! b )
1648 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1649
1650 /* It's okay to grow etc. this buffer, and we should throw it
1651 * away when we're done.
1652 */
1653 b->yy_is_our_buffer = 1;
1654
1655 return b;
1656 }
1657
1658 #ifndef YY_EXIT_FAILURE
1659 #define YY_EXIT_FAILURE 2
1660 #endif
1661
1662 static void yynoreturn yy_fatal_error (const char* msg )
1663 {
1664 fprintf( stderr, "%s\n", msg );
1665 exit( YY_EXIT_FAILURE );
1666 }
1667
1668 /* Redefine yyless() so it works in section 3 code. */
1669
1670 #undef yyless
1671 #define yyless(n) \
1672 do \
1673 { \
1674 /* Undo effects of setting up yytext. */ \
1675 int yyless_macro_arg = (n); \
1676 YY_LESS_LINENO(yyless_macro_arg);\
1677 yytext[yyleng] = (yy_hold_char); \
1678 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1679 (yy_hold_char) = *(yy_c_buf_p); \
1680 *(yy_c_buf_p) = '\0'; \
1681 yyleng = yyless_macro_arg; \
1682 } \
1683 while ( 0 )
1684
1685 /* Accessor methods (get/set functions) to struct members. */
1686
1687 /** Get the current line number.
1688 *
1689 */
1690 int yyget_lineno (void)
1691 {
1692
1693 return yylineno;
1694 }
1695
1696 /** Get the input stream.
1697 *
1698 */
1699 FILE *yyget_in (void)
1700 {
1701 return yyin;
1702 }
1703
1704 /** Get the output stream.
1705 *
1706 */
1707 FILE *yyget_out (void)
1708 {
1709 return yyout;
1710 }
1711
1712 /** Get the length of the current token.
1713 *
1714 */
1715 int yyget_leng (void)
1716 {
1717 return yyleng;
1718 }
1719
1720 /** Get the current token.
1721 *
1722 */
1723
1724 char *yyget_text (void)
1725 {
1726 return yytext;
1727 }
1728
1729 /** Set the current line number.
1730 * @param _line_number line number
1731 *
1732 */
1733 void yyset_lineno (int _line_number )
1734 {
1735
1736 yylineno = _line_number;
1737 }
1738
1739 /** Set the input stream. This does not discard the current
1740 * input buffer.
1741 * @param _in_str A readable stream.
1742 *
1743 * @see yy_switch_to_buffer
1744 */
1745 void yyset_in (FILE * _in_str )
1746 {
1747 yyin = _in_str ;
1748 }
1749
1750 void yyset_out (FILE * _out_str )
1751 {
1752 yyout = _out_str ;
1753 }
1754
1755 int yyget_debug (void)
1756 {
1757 return yy_flex_debug;
1758 }
1759
1760 void yyset_debug (int _bdebug )
1761 {
1762 yy_flex_debug = _bdebug ;
1763 }
1764
1765 static int yy_init_globals (void)
1766 {
1767 /* Initialization is the same as for the non-reentrant scanner.
1768 * This function is called from yylex_destroy(), so don't allocate here.
1769 */
1770
1771 (yy_buffer_stack) = NULL;
1772 (yy_buffer_stack_top) = 0;
1773 (yy_buffer_stack_max) = 0;
1774 (yy_c_buf_p) = NULL;
1775 (yy_init) = 0;
1776 (yy_start) = 0;
1777
1778 /* Defined in main.c */
1779 #ifdef YY_STDINIT
1780 yyin = stdin;
1781 yyout = stdout;
1782 #else
1783 yyin = NULL;
1784 yyout = NULL;
1785 #endif
1786
1787 /* For future reference: Set errno on error, since we are called by
1788 * yylex_init()
1789 */
1790 return 0;
1791 }
1792
1793 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1794 int yylex_destroy (void)
1795 {
1796
1797 /* Pop the buffer stack, destroying each element. */
1798 while(YY_CURRENT_BUFFER){
1799 yy_delete_buffer( YY_CURRENT_BUFFER );
1800 YY_CURRENT_BUFFER_LVALUE = NULL;
1801 yypop_buffer_state();
1802 }
1803
1804 /* Destroy the stack itself. */
1805 yyfree((yy_buffer_stack) );
1806 (yy_buffer_stack) = NULL;
1807
1808 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1809 * yylex() is called, initialization will occur. */
1810 yy_init_globals( );
1811
1812 return 0;
1813 }
1814
1815 /*
1816 * Internal utility routines.
1817 */
1818
1819 #ifndef yytext_ptr
1820 static void yy_flex_strncpy (char* s1, const char * s2, int n )
1821 {
1822
1823 int i;
1824 for ( i = 0; i < n; ++i )
1825 s1[i] = s2[i];
1826 }
1827 #endif
1828
1829 #ifdef YY_NEED_STRLEN
1830 static int yy_flex_strlen (const char * s )
1831 {
1832 int n;
1833 for ( n = 0; s[n]; ++n )
1834 ;
1835
1836 return n;
1837 }
1838 #endif
1839
1840 void *yyalloc (yy_size_t size )
1841 {
1842 return malloc(size);
1843 }
1844
1845 void *yyrealloc (void * ptr, yy_size_t size )
1846 {
1847
1848 /* The cast to (char *) in the following accommodates both
1849 * implementations that use char* generic pointers, and those
1850 * that use void* generic pointers. It works with the latter
1851 * because both ANSI C and C++ allow castless assignment from
1852 * any pointer type to void*, and deal with argument conversions
1853 * as though doing an assignment.
1854 */
1855 return realloc(ptr, size);
1856 }
1857
1858 void yyfree (void * ptr )
1859 {
1860 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1861 }
1862
1863 #define YYTABLES_NAME "yytables"
1864
1865 #line 61 "./config/loongarch-lex.l"
1866
1867
1868