libqasm
library for handling cQASM files
cqasm-v1-lexer.cpp
Go to the documentation of this file.
1 #line 2 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/cbuild/src/cqasm/cqasm-v1-lexer.cpp"
2 
3 #line 4 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/cbuild/src/cqasm/cqasm-v1-lexer.cpp"
4 
5 #define YY_INT_ALIGNED short int
6 
7 /* A lexical scanner generated by flex */
8 
9 #define FLEX_SCANNER
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 6
12 #define YY_FLEX_SUBMINOR_VERSION 1
13 #if YY_FLEX_SUBMINOR_VERSION > 0
14 #define FLEX_BETA
15 #endif
16 
17 /* First, we deal with platform-specific or compiler-specific issues. */
18 
19 /* begin standard C headers. */
20 #include <stdio.h>
21 #include <string.h>
22 #include <errno.h>
23 #include <stdlib.h>
24 
25 /* end standard C headers. */
26 
27 /* flex integer type definitions */
28 
29 #ifndef FLEXINT_H
30 #define FLEXINT_H
31 
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33 
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35 
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37  * if you want the limit (max/min) macros for int types.
38  */
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
41 #endif
42 
43 #include <inttypes.h>
44 typedef int8_t flex_int8_t;
45 typedef uint8_t flex_uint8_t;
46 typedef int16_t flex_int16_t;
47 typedef uint16_t flex_uint16_t;
48 typedef int32_t flex_int32_t;
49 typedef uint32_t flex_uint32_t;
50 #else
51 typedef signed char flex_int8_t;
52 typedef short int flex_int16_t;
53 typedef int flex_int32_t;
54 typedef unsigned char flex_uint8_t;
55 typedef unsigned short int flex_uint16_t;
56 typedef unsigned int flex_uint32_t;
57 
58 /* Limits of integral types. */
59 #ifndef INT8_MIN
60 #define INT8_MIN (-128)
61 #endif
62 #ifndef INT16_MIN
63 #define INT16_MIN (-32767-1)
64 #endif
65 #ifndef INT32_MIN
66 #define INT32_MIN (-2147483647-1)
67 #endif
68 #ifndef INT8_MAX
69 #define INT8_MAX (127)
70 #endif
71 #ifndef INT16_MAX
72 #define INT16_MAX (32767)
73 #endif
74 #ifndef INT32_MAX
75 #define INT32_MAX (2147483647)
76 #endif
77 #ifndef UINT8_MAX
78 #define UINT8_MAX (255U)
79 #endif
80 #ifndef UINT16_MAX
81 #define UINT16_MAX (65535U)
82 #endif
83 #ifndef UINT32_MAX
84 #define UINT32_MAX (4294967295U)
85 #endif
86 
87 #endif /* ! C99 */
88 
89 #endif /* ! FLEXINT_H */
90 
91 /* TODO: this is always defined, so inline it */
92 #define yyconst const
93 
94 #if defined(__GNUC__) && __GNUC__ >= 3
95 #define yynoreturn __attribute__((__noreturn__))
96 #else
97 #define yynoreturn
98 #endif
99 
100 /* Returned upon end-of-file. */
101 #define YY_NULL 0
102 
103 /* Promotes a possibly negative, possibly signed char to an unsigned
104  * integer for use as an array index. If the signed char is negative,
105  * we want to instead treat it as an 8-bit unsigned char, hence the
106  * double cast.
107  */
108 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
109 
110 /* An opaque pointer. */
111 #ifndef YY_TYPEDEF_YY_SCANNER_T
112 #define YY_TYPEDEF_YY_SCANNER_T
113 typedef void* yyscan_t;
114 #endif
115 
116 /* For convenience, these vars (plus the bison vars far below)
117  are macros in the reentrant scanner. */
118 #define yyin yyg->yyin_r
119 #define yyout yyg->yyout_r
120 #define yyextra yyg->yyextra_r
121 #define yyleng yyg->yyleng_r
122 #define yytext yyg->yytext_r
123 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
124 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
125 #define yy_flex_debug yyg->yy_flex_debug_r
126 
127 /* Enter a start condition. This macro really ought to take a parameter,
128  * but we do it the disgusting crufty way forced on us by the ()-less
129  * definition of BEGIN.
130  */
131 #define BEGIN yyg->yy_start = 1 + 2 *
132 
133 /* Translate the current start state into a value that can be later handed
134  * to BEGIN to return to the state. The YYSTATE alias is for lex
135  * compatibility.
136  */
137 #define YY_START ((yyg->yy_start - 1) / 2)
138 #define YYSTATE YY_START
139 
140 /* Action number for EOF rule of a given start state. */
141 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
142 
143 /* Special action meaning "start processing a new file". */
144 #define YY_NEW_FILE cqasm_v1restart(yyin ,yyscanner )
145 
146 #define YY_END_OF_BUFFER_CHAR 0
147 
148 /* Size of default input buffer. */
149 #ifndef YY_BUF_SIZE
150 #ifdef __ia64__
151 /* On IA-64, the buffer size is 16k, not 8k.
152  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
153  * Ditto for the __ia64__ case accordingly.
154  */
155 #define YY_BUF_SIZE 32768
156 #else
157 #define YY_BUF_SIZE 16384
158 #endif /* __ia64__ */
159 #endif
160 
161 /* The state buf must be large enough to hold one state per character in the main buffer.
162  */
163 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
164 
165 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
166 #define YY_TYPEDEF_YY_BUFFER_STATE
168 #endif
169 
170 #ifndef YY_TYPEDEF_YY_SIZE_T
171 #define YY_TYPEDEF_YY_SIZE_T
172 typedef size_t yy_size_t;
173 #endif
174 
175 #define EOB_ACT_CONTINUE_SCAN 0
176 #define EOB_ACT_END_OF_FILE 1
177 #define EOB_ACT_LAST_MATCH 2
178 
179  /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
180  * access to the local variable yy_act. Since yyless() is a macro, it would break
181  * existing scanners that call yyless() from OUTSIDE cqasm_v1lex.
182  * One obvious solution it to make yy_act a global. I tried that, and saw
183  * a 5% performance hit in a non-yylineno scanner, because yy_act is
184  * normally declared as a register variable-- so it is not worth it.
185  */
186  #define YY_LESS_LINENO(n) \
187  do { \
188  int yyl;\
189  for ( yyl = n; yyl < yyleng; ++yyl )\
190  if ( yytext[yyl] == '\n' )\
191  --yylineno;\
192  }while(0)
193  #define YY_LINENO_REWIND_TO(dst) \
194  do {\
195  const char *p;\
196  for ( p = yy_cp-1; p >= (dst); --p)\
197  if ( *p == '\n' )\
198  --yylineno;\
199  }while(0)
200 
201 /* Return all but the first "n" matched characters back to the input stream. */
202 #define yyless(n) \
203  do \
204  { \
205  /* Undo effects of setting up yytext. */ \
206  int yyless_macro_arg = (n); \
207  YY_LESS_LINENO(yyless_macro_arg);\
208  *yy_cp = yyg->yy_hold_char; \
209  YY_RESTORE_YY_MORE_OFFSET \
210  yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
211  YY_DO_BEFORE_ACTION; /* set up yytext again */ \
212  } \
213  while ( 0 )
214 
215 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
216 
217 #ifndef YY_STRUCT_YY_BUFFER_STATE
218 #define YY_STRUCT_YY_BUFFER_STATE
220  {
222 
223  char *yy_ch_buf; /* input buffer */
224  char *yy_buf_pos; /* current position in input buffer */
225 
226  /* Size of input buffer in bytes, not including room for EOB
227  * characters.
228  */
230 
231  /* Number of characters read into yy_ch_buf, not including EOB
232  * characters.
233  */
235 
236  /* Whether we "own" the buffer - i.e., we know we created it,
237  * and can realloc() it to grow it, and should free() it to
238  * delete it.
239  */
241 
242  /* Whether this is an "interactive" input source; if so, and
243  * if we're using stdio for input, then we want to use getc()
244  * instead of fread(), to make sure we stop fetching input after
245  * each newline.
246  */
248 
249  /* Whether we're considered to be at the beginning of a line.
250  * If so, '^' rules will be active on the next match, otherwise
251  * not.
252  */
254 
258  /* Whether to try to fill the input buffer when we reach the
259  * end of it.
260  */
262 
264 
265 #define YY_BUFFER_NEW 0
266 #define YY_BUFFER_NORMAL 1
267  /* When an EOF's been seen but there's still some text to process
268  * then we mark the buffer as YY_EOF_PENDING, to indicate that we
269  * shouldn't try reading from the input source any more. We might
270  * still have a bunch of tokens to match, though, because of
271  * possible backing-up.
272  *
273  * When we actually see the EOF, we change the status to "new"
274  * (via cqasm_v1restart()), so that the user can continue scanning by
275  * just pointing yyin at a new input file.
276  */
277 #define YY_BUFFER_EOF_PENDING 2
278 
279  };
280 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
281 
282 /* We provide macros for accessing buffer states in case in the
283  * future we want to put the buffer states in a more general
284  * "scanner state".
285  *
286  * Returns the top of the stack, or NULL.
287  */
288 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
289  ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
290  : NULL)
291 
292 /* Same as previous macro, but useful when we know that the buffer stack is not
293  * NULL or when we need an lvalue. For internal use only.
294  */
295 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
296 
297 void cqasm_v1restart (FILE *input_file ,yyscan_t yyscanner );
298 void cqasm_v1_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
299 YY_BUFFER_STATE cqasm_v1_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
300 void cqasm_v1_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
301 void cqasm_v1_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
302 void cqasm_v1push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
303 void cqasm_v1pop_buffer_state (yyscan_t yyscanner );
304 
305 static void cqasm_v1ensure_buffer_stack (yyscan_t yyscanner );
306 static void cqasm_v1_load_buffer_state (yyscan_t yyscanner );
307 static void cqasm_v1_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
308 
309 #define YY_FLUSH_BUFFER cqasm_v1_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
310 
311 YY_BUFFER_STATE cqasm_v1_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
312 YY_BUFFER_STATE cqasm_v1_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
313 YY_BUFFER_STATE cqasm_v1_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
314 
315 void *cqasm_v1alloc (yy_size_t ,yyscan_t yyscanner );
316 void *cqasm_v1realloc (void *,yy_size_t ,yyscan_t yyscanner );
317 void cqasm_v1free (void * ,yyscan_t yyscanner );
318 
319 #define yy_new_buffer cqasm_v1_create_buffer
320 
321 #define yy_set_interactive(is_interactive) \
322  { \
323  if ( ! YY_CURRENT_BUFFER ){ \
324  cqasm_v1ensure_buffer_stack (yyscanner); \
325  YY_CURRENT_BUFFER_LVALUE = \
326  cqasm_v1_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
327  } \
328  YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
329  }
330 
331 #define yy_set_bol(at_bol) \
332  { \
333  if ( ! YY_CURRENT_BUFFER ){\
334  cqasm_v1ensure_buffer_stack (yyscanner); \
335  YY_CURRENT_BUFFER_LVALUE = \
336  cqasm_v1_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
337  } \
338  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
339  }
340 
341 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
342 
343 #define cqasm_v1wrap(yyscanner) (/*CONSTCOND*/1)
344 #define YY_SKIP_YYWRAP
345 
346 typedef unsigned char YY_CHAR;
347 
348 typedef int yy_state_type;
349 
350 #define yytext_ptr yytext_r
351 
352 static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
353 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
354 static int yy_get_next_buffer (yyscan_t yyscanner );
355 static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner );
356 
357 /* Done after the current pattern has been matched and before the
358  * corresponding action - sets up yytext.
359  */
360 #define YY_DO_BEFORE_ACTION \
361  yyg->yytext_ptr = yy_bp; \
362  yyleng = (int) (yy_cp - yy_bp); \
363  yyg->yy_hold_char = *yy_cp; \
364  *yy_cp = '\0'; \
365  yyg->yy_c_buf_p = yy_cp;
366 
367 #define YY_NUM_RULES 69
368 #define YY_END_OF_BUFFER 70
369 /* This struct is not used in this scanner,
370  but its presence is necessary. */
372  {
375  };
376 static yyconst flex_int16_t yy_accept[190] =
377  { 0,
378  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
379  0, 0, 0, 0, 70, 66, 9, 1, 1, 52,
380  36, 4, 52, 52, 52, 52, 52, 33, 2, 52,
381  52, 52, 51, 51, 51, 51, 51, 51, 51, 51,
382  51, 51, 51, 51, 51, 66, 52, 52, 52, 8,
383  7, 7, 8, 16, 13, 11, 11, 15, 14, 12,
384  41, 40, 40, 37, 41, 46, 45, 45, 44, 46,
385  50, 49, 49, 47, 50, 68, 67, 67, 9, 1,
386  61, 4, 56, 53, 65, 34, 5, 54, 0, 33,
387  35, 62, 59, 60, 58, 63, 51, 51, 0, 51,
388 
389  51, 51, 22, 51, 51, 51, 51, 51, 51, 51,
390  51, 3, 3, 57, 42, 55, 7, 6, 13, 11,
391  14, 40, 39, 39, 38, 45, 43, 49, 48, 67,
392  0, 33, 64, 51, 20, 51, 51, 24, 18, 51,
393  51, 51, 31, 51, 19, 51, 51, 0, 34, 51,
394  21, 51, 23, 51, 51, 51, 51, 51, 51, 51,
395  30, 51, 51, 51, 51, 51, 28, 51, 26, 51,
396  51, 17, 27, 0, 51, 51, 25, 0, 10, 29,
397  0, 0, 0, 0, 0, 0, 0, 32, 0
398  } ;
399 
400 static yyconst YY_CHAR yy_ec[256] =
401  { 0,
402  1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
403  1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
404  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
405  1, 2, 5, 6, 7, 1, 8, 9, 10, 8,
406  8, 11, 12, 8, 13, 14, 15, 16, 16, 16,
407  16, 16, 16, 16, 16, 16, 16, 8, 17, 18,
408  19, 20, 8, 8, 21, 22, 23, 24, 25, 26,
409  27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
410  37, 38, 39, 40, 41, 42, 43, 30, 30, 30,
411  8, 44, 8, 45, 30, 1, 46, 47, 48, 49,
412 
413  50, 51, 52, 53, 54, 30, 55, 56, 57, 58,
414  59, 60, 61, 62, 63, 64, 65, 66, 67, 30,
415  30, 30, 68, 69, 70, 8, 1, 1, 1, 1,
416  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
417  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
418  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
419  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
420  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
421  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
422  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
423 
424  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
425  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
426  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429  1, 1, 1, 1, 1
430  } ;
431 
432 static yyconst YY_CHAR yy_meta[71] =
433  { 0,
434  1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
435  1, 1, 1, 3, 1, 4, 1, 1, 1, 1,
436  5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
437  5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
438  5, 5, 5, 1, 1, 5, 5, 5, 5, 5,
439  5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
440  5, 5, 5, 5, 5, 5, 5, 1, 1, 1
441  } ;
442 
443 static yyconst flex_uint16_t yy_base[201] =
444  { 0,
445  0, 0, 68, 70, 73, 80, 82, 89, 95, 99,
446  103, 107, 111, 113, 348, 349, 345, 349, 343, 326,
447  349, 0, 349, 335, 332, 64, 89, 104, 349, 103,
448  323, 104, 0, 70, 99, 87, 90, 101, 107, 89,
449  106, 110, 103, 117, 112, 141, 296, 271, 270, 349,
450  349, 335, 322, 349, 331, 349, 320, 349, 274, 349,
451  349, 349, 285, 349, 166, 349, 349, 281, 349, 211,
452  349, 349, 277, 349, 0, 349, 349, 275, 274, 349,
453  349, 0, 349, 349, 349, 123, 349, 349, 259, 141,
454  349, 349, 349, 349, 349, 251, 0, 116, 0, 116,
455 
456  120, 124, 0, 135, 153, 141, 138, 139, 143, 144,
457  155, 349, 265, 349, 349, 349, 349, 349, 224, 349,
458  183, 349, 349, 182, 349, 349, 349, 349, 349, 349,
459  175, 176, 349, 168, 349, 172, 168, 169, 0, 168,
460  173, 182, 0, 179, 0, 172, 181, 130, 120, 184,
461  0, 187, 0, 196, 180, 204, 187, 196, 200, 206,
462  0, 200, 215, 201, 203, 116, 0, 210, 0, 205,
463  219, 0, 0, 227, 219, 224, 0, 213, 0, 0,
464  232, 221, 239, 234, 233, 231, 239, 349, 349, 291,
465  296, 301, 306, 311, 316, 321, 324, 326, 331, 86
466 
467  } ;
468 
469 static yyconst flex_int16_t yy_def[201] =
470  { 0,
471  189, 1, 190, 190, 191, 191, 192, 192, 193, 193,
472  194, 194, 195, 195, 189, 189, 189, 189, 189, 189,
473  189, 196, 189, 189, 189, 189, 189, 197, 189, 189,
474  189, 189, 198, 198, 198, 198, 198, 198, 198, 198,
475  198, 198, 198, 198, 198, 189, 189, 189, 189, 189,
476  189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
477  189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
478  189, 189, 189, 189, 199, 189, 189, 189, 189, 189,
479  189, 196, 189, 189, 189, 189, 189, 189, 189, 189,
480  189, 189, 189, 189, 189, 189, 198, 198, 200, 198,
481 
482  198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
483  198, 189, 189, 189, 189, 189, 189, 189, 189, 189,
484  189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
485  189, 189, 189, 198, 189, 198, 198, 198, 198, 198,
486  198, 198, 198, 198, 198, 198, 198, 189, 189, 198,
487  198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
488  198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
489  198, 198, 198, 189, 198, 198, 198, 189, 198, 198,
490  189, 189, 189, 189, 189, 189, 189, 189, 0, 189,
491  189, 189, 189, 189, 189, 189, 189, 189, 189, 189
492 
493  } ;
494 
495 static yyconst flex_uint16_t yy_nxt[420] =
496  { 0,
497  16, 17, 18, 19, 20, 21, 22, 23, 24, 16,
498  25, 23, 23, 26, 27, 28, 29, 30, 31, 32,
499  33, 34, 35, 33, 36, 37, 33, 33, 38, 33,
500  33, 33, 39, 33, 33, 33, 40, 41, 42, 33,
501  43, 44, 45, 46, 47, 33, 34, 35, 33, 36,
502  37, 33, 33, 38, 33, 33, 39, 33, 33, 33,
503  40, 41, 42, 33, 43, 44, 45, 48, 49, 23,
504  51, 52, 51, 52, 55, 56, 57, 85, 53, 86,
505  53, 55, 56, 57, 62, 63, 58, 64, 59, 60,
506  135, 62, 63, 58, 64, 59, 60, 67, 68, 87,
507 
508  69, 67, 68, 88, 69, 72, 73, 98, 74, 72,
509  73, 99, 74, 77, 78, 77, 78, 89, 101, 90,
510  92, 93, 95, 96, 102, 65, 103, 104, 174, 105,
511  106, 98, 65, 100, 107, 149, 108, 109, 86, 111,
512  134, 110, 101, 112, 113, 149, 75, 131, 102, 136,
513  75, 103, 104, 105, 89, 106, 132, 100, 137, 107,
514  108, 138, 109, 70, 111, 134, 110, 70, 123, 124,
515  139, 125, 131, 136, 140, 125, 141, 143, 144, 142,
516  145, 146, 137, 147, 123, 138, 148, 148, 150, 89,
517  149, 132, 153, 154, 139, 151, 155, 156, 121, 140,
518 
519  141, 143, 144, 142, 145, 146, 157, 158, 147, 125,
520  159, 152, 160, 150, 161, 162, 163, 153, 154, 164,
521  151, 155, 156, 125, 165, 119, 166, 167, 168, 125,
522  169, 157, 158, 170, 159, 152, 160, 171, 161, 172,
523  162, 163, 173, 164, 175, 176, 177, 178, 180, 165,
524  166, 167, 179, 168, 181, 169, 182, 170, 183, 184,
525  185, 186, 171, 172, 187, 188, 173, 112, 175, 176,
526  133, 177, 178, 180, 86, 79, 179, 130, 181, 128,
527  127, 182, 183, 126, 184, 185, 186, 122, 187, 121,
528  188, 50, 50, 50, 50, 50, 54, 54, 54, 54,
529 
530  54, 61, 61, 61, 61, 61, 66, 66, 66, 66,
531  66, 71, 71, 71, 71, 71, 76, 76, 76, 76,
532  76, 82, 120, 82, 82, 82, 91, 91, 91, 97,
533  97, 129, 119, 129, 129, 129, 118, 117, 116, 115,
534  114, 94, 84, 83, 81, 80, 79, 189, 15, 189,
535  189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
536  189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
537  189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
538  189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
539  189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
540 
541  189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
542  189, 189, 189, 189, 189, 189, 189, 189, 189
543  } ;
544 
545 static yyconst flex_int16_t yy_chk[420] =
546  { 0,
547  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
548  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
549  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
550  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
551  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
552  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
553  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
554  3, 3, 4, 4, 5, 5, 5, 26, 3, 26,
555  4, 6, 6, 6, 7, 7, 5, 7, 5, 5,
556  200, 8, 8, 6, 8, 6, 6, 9, 9, 27,
557 
558  9, 10, 10, 27, 10, 11, 11, 34, 11, 12,
559  12, 35, 12, 13, 13, 14, 14, 28, 36, 28,
560  30, 30, 32, 32, 37, 7, 38, 39, 166, 40,
561  41, 34, 8, 35, 42, 149, 43, 44, 86, 45,
562  98, 44, 36, 46, 46, 148, 11, 86, 37, 100,
563  12, 38, 39, 40, 90, 41, 90, 35, 101, 42,
564  43, 102, 44, 9, 45, 98, 44, 10, 65, 65,
565  104, 65, 86, 100, 105, 65, 106, 107, 108, 106,
566  109, 110, 101, 111, 124, 102, 131, 131, 134, 132,
567  131, 132, 137, 138, 104, 136, 140, 141, 121, 105,
568 
569  106, 107, 108, 106, 109, 110, 142, 144, 111, 65,
570  146, 136, 147, 134, 150, 152, 154, 137, 138, 155,
571  136, 140, 141, 65, 156, 119, 157, 158, 159, 65,
572  160, 142, 144, 162, 146, 136, 147, 163, 150, 164,
573  152, 154, 165, 155, 168, 170, 171, 174, 176, 156,
574  157, 158, 175, 159, 178, 160, 181, 162, 182, 183,
575  184, 185, 163, 164, 186, 187, 165, 113, 168, 170,
576  96, 171, 174, 176, 89, 79, 175, 78, 178, 73,
577  70, 181, 182, 68, 183, 184, 185, 63, 186, 59,
578  187, 190, 190, 190, 190, 190, 191, 191, 191, 191,
579 
580  191, 192, 192, 192, 192, 192, 193, 193, 193, 193,
581  193, 194, 194, 194, 194, 194, 195, 195, 195, 195,
582  195, 196, 57, 196, 196, 196, 197, 197, 197, 198,
583  198, 199, 55, 199, 199, 199, 53, 52, 49, 48,
584  47, 31, 25, 24, 20, 19, 17, 15, 189, 189,
585  189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
586  189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
587  189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
588  189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
589  189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
590 
591  189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
592  189, 189, 189, 189, 189, 189, 189, 189, 189
593  } ;
594 
595 /* Table of booleans, true if rule could match eol. */
596 static yyconst flex_int32_t yy_rule_can_match_eol[70] =
597  { 0,
598 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
599  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
600  1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
601  0, 0, 0, 0, 0, 0, 0, 1, 0, 0, };
602 
603 /* The intent behind this definition is that it'll catch
604  * any uses of REJECT which flex missed.
605  */
606 #define REJECT reject_used_but_not_detected
607 #define yymore() yymore_used_but_not_detected
608 #define YY_MORE_ADJ 0
609 #define YY_RESTORE_YY_MORE_OFFSET
610 #line 1 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
611 #define YY_NO_INPUT 1
612 #line 7 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
613 
617  #include "cqasm-v1-parser.hpp"
618 
619  //#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
620  #define DEBUG(...)
621 
622  #define YY_USER_ACTION yylloc->last_column += yyleng;
623  #define LOCATION_RESET \
624  yylloc->first_column = 1; yylloc->first_line = 1; \
625  yylloc->last_column = 1; yylloc->last_line = 1;
626  #define LOCATION_LINE \
627  yylloc->last_column = 1; yylloc->last_line += 1;
628  #define LOCATION_STEP \
629  yylloc->first_column = yylloc->last_column; \
630  yylloc->first_line = yylloc->last_line;
631  #define WITH_STR(TOKNAME) \
632  DEBUG("Pushing %s token (%s) starting at %d:%d\n", #TOKNAME, yytext, yylloc->first_line, yylloc->first_column); \
633  yylval->str = strdup(yytext); return TOKNAME
634  #define WITHOUT_STR(TOKNAME) \
635  DEBUG("Pushing %s token starting at %d:%d\n", #TOKNAME, yylloc->first_line, yylloc->first_column); \
636  return TOKNAME
637  #define OPERATOR \
638  DEBUG("Pushing '%c' token starting at %d:%d\n", yytext[0], yylloc->first_line, yylloc->first_column); \
639  return yytext[0]
640  #define DELETE LOCATION_STEP
641 
642 
643 
644 
645 
646 
647 #line 648 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/cbuild/src/cqasm/cqasm-v1-lexer.cpp"
648 
649 #define INITIAL 0
650 #define MODE_MULTILINE_COMMENT 1
651 #define MODE_VERSION 2
652 #define MODE_STRING 3
653 #define MODE_JSON 4
654 #define MODE_JSON_STRING 5
655 #define MODE_UNEXPECTED_EOF 6
656 
657 #ifndef YY_NO_UNISTD_H
658 /* Special case for "unistd.h", since it is non-ANSI. We include it way
659  * down here because we want the user's section 1 to have been scanned first.
660  * The user has a chance to override it with an option.
661  */
662 #include <unistd.h>
663 #endif
664 
665 #ifndef YY_EXTRA_TYPE
666 #define YY_EXTRA_TYPE void *
667 #endif
668 
669 /* Holds the entire state of the reentrant scanner. */
670 struct yyguts_t
671  {
672 
673  /* User-defined. Not touched by flex. */
675 
676  /* The rest are the same as the globals declared in the non-reentrant scanner. */
677  FILE *yyin_r, *yyout_r;
680  YY_BUFFER_STATE * yy_buffer_stack;
683  int yyleng_r;
684  char *yy_c_buf_p;
685  int yy_init;
686  int yy_start;
693 
696 
697  char *yytext_r;
700 
702 
704 
705  }; /* end struct yyguts_t */
706 
707 static int yy_init_globals (yyscan_t yyscanner );
708 
709  /* This must go here because YYSTYPE and YYLTYPE are included
710  * from bison output in section 1.*/
711  # define yylval yyg->yylval_r
712 
713  # define yylloc yyg->yylloc_r
714 
715 int cqasm_v1lex_init (yyscan_t* scanner);
716 
717 int cqasm_v1lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
718 
719 /* Accessor methods to globals.
720  These are made visible to non-reentrant scanners for convenience. */
721 
722 int cqasm_v1lex_destroy (yyscan_t yyscanner );
723 
724 int cqasm_v1get_debug (yyscan_t yyscanner );
725 
726 void cqasm_v1set_debug (int debug_flag ,yyscan_t yyscanner );
727 
729 
730 void cqasm_v1set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
731 
732 FILE *cqasm_v1get_in (yyscan_t yyscanner );
733 
734 void cqasm_v1set_in (FILE * _in_str ,yyscan_t yyscanner );
735 
736 FILE *cqasm_v1get_out (yyscan_t yyscanner );
737 
738 void cqasm_v1set_out (FILE * _out_str ,yyscan_t yyscanner );
739 
740  int cqasm_v1get_leng (yyscan_t yyscanner );
741 
742 char *cqasm_v1get_text (yyscan_t yyscanner );
743 
744 int cqasm_v1get_lineno (yyscan_t yyscanner );
745 
746 void cqasm_v1set_lineno (int _line_number ,yyscan_t yyscanner );
747 
748 int cqasm_v1get_column (yyscan_t yyscanner );
749 
750 void cqasm_v1set_column (int _column_no ,yyscan_t yyscanner );
751 
752 YYSTYPE * cqasm_v1get_lval (yyscan_t yyscanner );
753 
754 void cqasm_v1set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
755 
756  YYLTYPE *cqasm_v1get_lloc (yyscan_t yyscanner );
757 
758  void cqasm_v1set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
759 
760 /* Macros after this point can all be overridden by user definitions in
761  * section 1.
762  */
763 
764 #ifndef YY_SKIP_YYWRAP
765 #ifdef __cplusplus
766 extern "C" int cqasm_v1wrap (yyscan_t yyscanner );
767 #else
768 extern int cqasm_v1wrap (yyscan_t yyscanner );
769 #endif
770 #endif
771 
772 #ifndef YY_NO_UNPUT
773 
774 #endif
775 
776 #ifndef yytext_ptr
777 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
778 #endif
779 
780 #ifdef YY_NEED_STRLEN
781 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
782 #endif
783 
784 #ifndef YY_NO_INPUT
785 
786 #ifdef __cplusplus
787 static int yyinput (yyscan_t yyscanner );
788 #else
789 static int input (yyscan_t yyscanner );
790 #endif
791 
792 #endif
793 
794 /* Amount of stuff to slurp up with each read. */
795 #ifndef YY_READ_BUF_SIZE
796 #ifdef __ia64__
797 /* On IA-64, the buffer size is 16k, not 8k */
798 #define YY_READ_BUF_SIZE 16384
799 #else
800 #define YY_READ_BUF_SIZE 8192
801 #endif /* __ia64__ */
802 #endif
803 
804 /* Copy whatever the last rule matched to the standard output. */
805 #ifndef ECHO
806 /* This used to be an fputs(), but since the string might contain NUL's,
807  * we now use fwrite().
808  */
809 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
810 #endif
811 
812 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
813  * is returned in "result".
814  */
815 #ifndef YY_INPUT
816 #define YY_INPUT(buf,result,max_size) \
817  if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
818  { \
819  int c = '*'; \
820  size_t n; \
821  for ( n = 0; n < max_size && \
822  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
823  buf[n] = (char) c; \
824  if ( c == '\n' ) \
825  buf[n++] = (char) c; \
826  if ( c == EOF && ferror( yyin ) ) \
827  YY_FATAL_ERROR( "input in flex scanner failed" ); \
828  result = n; \
829  } \
830  else \
831  { \
832  errno=0; \
833  while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
834  { \
835  if( errno != EINTR) \
836  { \
837  YY_FATAL_ERROR( "input in flex scanner failed" ); \
838  break; \
839  } \
840  errno=0; \
841  clearerr(yyin); \
842  } \
843  }\
844 \
845 
846 #endif
847 
848 /* No semi-colon after return; correct usage is to write "yyterminate();" -
849  * we don't want an extra ';' after the "return" because that will cause
850  * some compilers to complain about unreachable statements.
851  */
852 #ifndef yyterminate
853 #define yyterminate() return YY_NULL
854 #endif
855 
856 /* Number of entries by which start-condition stack grows. */
857 #ifndef YY_START_STACK_INCR
858 #define YY_START_STACK_INCR 25
859 #endif
860 
861 /* Report a fatal error. */
862 #ifndef YY_FATAL_ERROR
863 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
864 #endif
865 
866 /* end tables serialization structures and prototypes */
867 
868 /* Default declaration of generated scanner - a define so the user can
869  * easily add parameters.
870  */
871 #ifndef YY_DECL
872 #define YY_DECL_IS_OURS 1
873 
874 extern int cqasm_v1lex \
875  (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
876 
877 #define YY_DECL int cqasm_v1lex \
878  (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
879 #endif /* !YY_DECL */
880 
881 /* Code executed at the beginning of each rule, after yytext and yyleng
882  * have been set up.
883  */
884 #ifndef YY_USER_ACTION
885 #define YY_USER_ACTION
886 #endif
887 
888 /* Code executed at the end of each rule. */
889 #ifndef YY_BREAK
890 #define YY_BREAK /*LINTED*/break;
891 #endif
892 
893 #define YY_RULE_SETUP \
894  YY_USER_ACTION
895 
898 YY_DECL
899 {
900  yy_state_type yy_current_state;
901  char *yy_cp, *yy_bp;
902  int yy_act;
903  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
904 
905  yylval = yylval_param;
906 
907  yylloc = yylloc_param;
908 
909  if ( !yyg->yy_init )
910  {
911  yyg->yy_init = 1;
912 
913 #ifdef YY_USER_INIT
914  YY_USER_INIT;
915 #endif
916 
917  if ( ! yyg->yy_start )
918  yyg->yy_start = 1; /* first start state */
919 
920  if ( ! yyin )
921  yyin = stdin;
922 
923  if ( ! yyout )
924  yyout = stdout;
925 
926  if ( ! YY_CURRENT_BUFFER ) {
927  cqasm_v1ensure_buffer_stack (yyscanner);
930  }
931 
932  cqasm_v1_load_buffer_state(yyscanner );
933  }
934 
935  {
936 #line 44 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
937 
938 
939 
941 
942 
943 #line 944 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/cbuild/src/cqasm/cqasm-v1-lexer.cpp"
944 
945  while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
946  {
947  yy_cp = yyg->yy_c_buf_p;
948 
949  /* Support of yytext. */
950  *yy_cp = yyg->yy_hold_char;
951 
952  /* yy_bp points to the position in yy_ch_buf of the start of
953  * the current run.
954  */
955  yy_bp = yy_cp;
956 
957  yy_current_state = yyg->yy_start;
958 yy_match:
959  do
960  {
961  YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
962  if ( yy_accept[yy_current_state] )
963  {
964  yyg->yy_last_accepting_state = yy_current_state;
966  }
967  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
968  {
969  yy_current_state = (int) yy_def[yy_current_state];
970  if ( yy_current_state >= 190 )
971  yy_c = yy_meta[(unsigned int) yy_c];
972  }
973  yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
974  ++yy_cp;
975  }
976  while ( yy_base[yy_current_state] != 349 );
977 
978 yy_find_action:
979  yy_act = yy_accept[yy_current_state];
980  if ( yy_act == 0 )
981  { /* have to back up */
982  yy_cp = yyg->yy_last_accepting_cpos;
983  yy_current_state = yyg->yy_last_accepting_state;
984  yy_act = yy_accept[yy_current_state];
985  }
986 
988 
989  if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
990  {
991  yy_size_t yyl;
992  for ( yyl = 0; yyl < yyleng; ++yyl )
993  if ( yytext[yyl] == '\n' )
994 
995  do{ yylineno++;
996  yycolumn=0;
997  }while(0)
998 ;
999  }
1000 
1001 do_action: /* This label is used only to access EOF actions. */
1002 
1003  switch ( yy_act )
1004  { /* beginning of action switch */
1005  case 0: /* must back up */
1006  /* undo the effects of YY_DO_BEFORE_ACTION */
1007  *yy_cp = yyg->yy_hold_char;
1008  yy_cp = yyg->yy_last_accepting_cpos;
1009  yy_current_state = yyg->yy_last_accepting_state;
1010  goto yy_find_action;
1011 
1012 /*=======================================================================*/
1013 /* WHITESPACE MANAGEMENT */
1014 /*=======================================================================*/
1015 /* Newline and single-line comment */
1016 case 1:
1017 /* rule 1 can match eol */
1019 #line 58 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1021  YY_BREAK
1022 /* Semicolons function exactly the same way as newlines */
1023 case 2:
1025 #line 61 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1027  YY_BREAK
1028 /* And then there's the opposite, the escaped newline */
1029 case 3:
1030 /* rule 3 can match eol */
1032 #line 64 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1034  YY_BREAK
1035 /* Gobble up comments */
1036 case 4:
1038 #line 67 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1039 DELETE;
1040  YY_BREAK
1041 case 5:
1043 #line 68 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1045  YY_BREAK
1046 
1047 
1048 case 6:
1050 #line 71 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1051 BEGIN(INITIAL); DELETE;
1052  YY_BREAK
1053 case 7:
1054 /* rule 7 can match eol */
1056 #line 72 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1058  YY_BREAK
1059 case 8:
1061 #line 73 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1062 DELETE;
1063  YY_BREAK
1065 #line 74 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1067  YY_BREAK
1068 
1069 
1070 /* Gobble up whitespace */
1071 case 9:
1073 #line 79 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1074 DELETE;
1075  YY_BREAK
1076 /*=======================================================================*/
1077 /* VERSION STATEMENT */
1078 /*=======================================================================*/
1079 /* This is treated separately to avoid conflicts with float literals */
1080 case 10:
1082 #line 87 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1084  YY_BREAK
1085 
1086 
1087 case 11:
1088 /* rule 11 can match eol */
1090 #line 90 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1092  YY_BREAK
1093 case 12:
1095 #line 91 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1097  YY_BREAK
1098 case 13:
1100 #line 92 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1101 DELETE;
1102  YY_BREAK
1103 case 14:
1105 #line 93 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1107  YY_BREAK
1108 case 15:
1110 #line 94 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1111 OPERATOR;
1112  YY_BREAK
1113 case 16:
1115 #line 95 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1117  YY_BREAK
1118 
1119 
1120 /*=======================================================================*/
1121 /* KEYWORDS */
1122 /*=======================================================================*/
1123 /* Qubit allocation */
1124 case 17:
1126 #line 105 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1128  YY_BREAK
1129 /* Qubit register naming */
1130 case 18:
1132 #line 108 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1133 WITHOUT_STR(MAP);
1134  YY_BREAK
1135 /* Variable declaration */
1136 case 19:
1138 #line 111 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1139 WITHOUT_STR(VAR);
1140  YY_BREAK
1141 /* C-dash prefix for binary-controlled gates */
1142 case 20:
1143 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
1144 yyg->yy_c_buf_p = yy_cp = yy_bp + 2;
1145 YY_DO_BEFORE_ACTION; /* set up yytext again */
1147 #line 114 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1149  YY_BREAK
1150 /* New-style binary-controlled gate syntax */
1151 case 21:
1153 #line 117 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1154 WITHOUT_STR(COND);
1155  YY_BREAK
1156 /* cQASM 1.2 statements */
1157 case 22:
1159 #line 120 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1160 WITHOUT_STR(IF);
1161  YY_BREAK
1162 case 23:
1164 #line 121 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1165 WITHOUT_STR(ELSE);
1166  YY_BREAK
1167 case 24:
1169 #line 122 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1170 WITHOUT_STR(FOR);
1171  YY_BREAK
1172 case 25:
1174 #line 123 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1176  YY_BREAK
1177 case 26:
1179 #line 124 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1181  YY_BREAK
1182 case 27:
1184 #line 125 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1186  YY_BREAK
1187 case 28:
1189 #line 126 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1191  YY_BREAK
1192 case 29:
1194 #line 127 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1196  YY_BREAK
1197 case 30:
1199 #line 128 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1201  YY_BREAK
1202 /* cQASM 1.2 special instructions */
1203 case 31:
1205 #line 131 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1206 WITHOUT_STR(SET);
1207  YY_BREAK
1208 /* Absolute nonsense for compatibility purposes: the reset-averaging */
1209 /* operation has a - in it, which is not legal in an identifier for */
1210 /* obvious reasons when expressions come along. */
1211 case 32:
1213 #line 136 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1215  YY_BREAK
1216 /*=======================================================================*/
1217 /* NUMERIC LITERALS */
1218 /*=======================================================================*/
1219 /* Integer literals */
1220 case 33:
1222 #line 144 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1224  YY_BREAK
1225 /* Float literals */
1226 case 34:
1228 #line 147 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1230  YY_BREAK
1231 /* Any digit followed by a letter not detected by the above is an invalid number */
1232 case 35:
1234 #line 150 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1236  YY_BREAK
1237 /*=======================================================================*/
1238 /* STRING LITERALS */
1239 /*=======================================================================*/
1240 case 36:
1242 #line 157 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1244  YY_BREAK
1245 
1246 
1247 case 37:
1249 #line 160 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1251  YY_BREAK
1252 case 38:
1254 #line 161 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1256  YY_BREAK
1257 case 39:
1258 /* rule 39 can match eol */
1260 #line 162 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1262  YY_BREAK
1263 case 40:
1264 /* rule 40 can match eol */
1266 #line 163 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1268  YY_BREAK
1269 case 41:
1271 #line 164 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1273  YY_BREAK
1275 #line 165 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1277  YY_BREAK
1278 
1279 
1280 /*=======================================================================*/
1281 /* JSON LITERALS */
1282 /*=======================================================================*/
1283 case 42:
1285 #line 174 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1287  YY_BREAK
1288 
1289 
1290 case 43:
1292 #line 177 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1294  YY_BREAK
1295 case 44:
1297 #line 178 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1299  YY_BREAK
1300 case 45:
1301 /* rule 45 can match eol */
1303 #line 179 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1305  YY_BREAK
1306 case 46:
1308 #line 180 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1310  YY_BREAK
1311 case YY_STATE_EOF(MODE_JSON):
1312 #line 181 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1314  YY_BREAK
1315 
1316 
1317 case 47:
1319 #line 184 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1321  YY_BREAK
1322 case 48:
1324 #line 185 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1326  YY_BREAK
1327 case 49:
1328 /* rule 49 can match eol */
1330 #line 186 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1332  YY_BREAK
1333 case 50:
1335 #line 187 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1337  YY_BREAK
1339 #line 188 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1341  YY_BREAK
1342 
1343 
1344 /*=======================================================================*/
1345 /* IDENTIFIERS */
1346 /*=======================================================================*/
1347 case 51:
1349 #line 197 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1351  YY_BREAK
1352 /*=======================================================================*/
1353 /* OPERATORS */
1354 /*=======================================================================*/
1355 case 52:
1357 #line 204 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1358 OPERATOR;
1359  YY_BREAK
1360 case 53:
1362 #line 205 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1364  YY_BREAK
1365 case 54:
1367 #line 206 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1369  YY_BREAK
1370 case 55:
1372 #line 207 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1374  YY_BREAK
1375 case 56:
1377 #line 208 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1379  YY_BREAK
1380 case 57:
1382 #line 209 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1384  YY_BREAK
1385 case 58:
1387 #line 210 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1389  YY_BREAK
1390 case 59:
1392 #line 211 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1394  YY_BREAK
1395 case 60:
1397 #line 212 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1399  YY_BREAK
1400 case 61:
1402 #line 213 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1404  YY_BREAK
1405 case 62:
1407 #line 214 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1408 WITHOUT_STR(SHL);
1409  YY_BREAK
1410 case 63:
1412 #line 215 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1414  YY_BREAK
1415 case 64:
1417 #line 216 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1419  YY_BREAK
1420 case 65:
1422 #line 217 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1424  YY_BREAK
1425 /*=======================================================================*/
1426 /* DEFAULT */
1427 /*=======================================================================*/
1428 /* Catch any other character as a single-character lexeme */
1429 case 66:
1431 #line 225 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1433  YY_BREAK
1434 
1435 
1436 case 67:
1437 /* rule 67 can match eol */
1439 #line 230 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1441  YY_BREAK
1442 case 68:
1444 #line 231 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1445 DELETE;
1446  YY_BREAK
1447 
1448 case 69:
1450 #line 233 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
1451 YY_FATAL_ERROR( "flex scanner jammed" );
1452  YY_BREAK
1453 #line 1454 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/cbuild/src/cqasm/cqasm-v1-lexer.cpp"
1454 case YY_STATE_EOF(INITIAL):
1457  yyterminate();
1458 
1459  case YY_END_OF_BUFFER:
1460  {
1461  /* Amount of text matched not including the EOB char. */
1462  int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1463 
1464  /* Undo the effects of YY_DO_BEFORE_ACTION. */
1465  *yy_cp = yyg->yy_hold_char;
1467 
1468  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1469  {
1470  /* We're scanning a new file or input source. It's
1471  * possible that this happened because the user
1472  * just pointed yyin at a new source and called
1473  * cqasm_v1lex(). If so, then we have to assure
1474  * consistency between YY_CURRENT_BUFFER and our
1475  * globals. Here is the right place to do so, because
1476  * this is the first action (other than possibly a
1477  * back-up) that will match for the new input source.
1478  */
1479  yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1480  YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1481  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1482  }
1483 
1484  /* Note that here we test for yy_c_buf_p "<=" to the position
1485  * of the first EOB in the buffer, since yy_c_buf_p will
1486  * already have been incremented past the NUL character
1487  * (since all states make transitions on EOB to the
1488  * end-of-buffer state). Contrast this with the test
1489  * in input().
1490  */
1491  if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1492  { /* This was really a NUL. */
1493  yy_state_type yy_next_state;
1494 
1495  yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1496 
1497  yy_current_state = yy_get_previous_state( yyscanner );
1498 
1499  /* Okay, we're now positioned to make the NUL
1500  * transition. We couldn't have
1501  * yy_get_previous_state() go ahead and do it
1502  * for us because it doesn't know how to deal
1503  * with the possibility of jamming (and we don't
1504  * want to build jamming into it because then it
1505  * will run more slowly).
1506  */
1507 
1508  yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1509 
1510  yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1511 
1512  if ( yy_next_state )
1513  {
1514  /* Consume the NUL. */
1515  yy_cp = ++yyg->yy_c_buf_p;
1516  yy_current_state = yy_next_state;
1517  goto yy_match;
1518  }
1519 
1520  else
1521  {
1522  yy_cp = yyg->yy_c_buf_p;
1523  goto yy_find_action;
1524  }
1525  }
1526 
1527  else switch ( yy_get_next_buffer( yyscanner ) )
1528  {
1529  case EOB_ACT_END_OF_FILE:
1530  {
1531  yyg->yy_did_buffer_switch_on_eof = 0;
1532 
1533  if ( cqasm_v1wrap(yyscanner ) )
1534  {
1535  /* Note: because we've taken care in
1536  * yy_get_next_buffer() to have set up
1537  * yytext, we can now set up
1538  * yy_c_buf_p so that if some total
1539  * hoser (like flex itself) wants to
1540  * call the scanner after we return the
1541  * YY_NULL, it'll still work - another
1542  * YY_NULL will get returned.
1543  */
1544  yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1545 
1546  yy_act = YY_STATE_EOF(YY_START);
1547  goto do_action;
1548  }
1549 
1550  else
1551  {
1552  if ( ! yyg->yy_did_buffer_switch_on_eof )
1553  YY_NEW_FILE;
1554  }
1555  break;
1556  }
1557 
1558  case EOB_ACT_CONTINUE_SCAN:
1559  yyg->yy_c_buf_p =
1560  yyg->yytext_ptr + yy_amount_of_matched_text;
1561 
1562  yy_current_state = yy_get_previous_state( yyscanner );
1563 
1564  yy_cp = yyg->yy_c_buf_p;
1565  yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1566  goto yy_match;
1567 
1568  case EOB_ACT_LAST_MATCH:
1569  yyg->yy_c_buf_p =
1570  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1571 
1572  yy_current_state = yy_get_previous_state( yyscanner );
1573 
1574  yy_cp = yyg->yy_c_buf_p;
1575  yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1576  goto yy_find_action;
1577  }
1578  break;
1579  }
1580 
1581  default:
1583  "fatal flex scanner internal error--no action found" );
1584  } /* end of action switch */
1585  } /* end of scanning one token */
1586  } /* end of user's declarations */
1587 } /* end of cqasm_v1lex */
1588 
1589 /* yy_get_next_buffer - try to read in a new buffer
1590  *
1591  * Returns a code representing an action:
1592  * EOB_ACT_LAST_MATCH -
1593  * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1594  * EOB_ACT_END_OF_FILE - end of file
1595  */
1596 static int yy_get_next_buffer (yyscan_t yyscanner)
1597 {
1598  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1599  char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1600  char *source = yyg->yytext_ptr;
1601  yy_size_t number_to_move, i;
1602  int ret_val;
1603 
1604  if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1606  "fatal flex scanner internal error--end of buffer missed" );
1607 
1608  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1609  { /* Don't try to fill the buffer, so this is an EOF. */
1610  if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1611  {
1612  /* We matched a single character, the EOB, so
1613  * treat this as a final EOF.
1614  */
1615  return EOB_ACT_END_OF_FILE;
1616  }
1617 
1618  else
1619  {
1620  /* We matched some text prior to the EOB, first
1621  * process it.
1622  */
1623  return EOB_ACT_LAST_MATCH;
1624  }
1625  }
1626 
1627  /* Try to read more data. */
1628 
1629  /* First move last chars to start of buffer. */
1630  number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
1631 
1632  for ( i = 0; i < number_to_move; ++i )
1633  *(dest++) = *(source++);
1634 
1635  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1636  /* don't do the read, it's not guaranteed to return an EOF,
1637  * just force an EOF
1638  */
1639  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1640 
1641  else
1642  {
1643  int num_to_read =
1644  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1645 
1646  while ( num_to_read <= 0 )
1647  { /* Not enough room in the buffer - grow it. */
1648 
1649  /* just a shorter name for the current buffer */
1650  YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1651 
1652  int yy_c_buf_p_offset =
1653  (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1654 
1655  if ( b->yy_is_our_buffer )
1656  {
1657  int new_size = b->yy_buf_size * 2;
1658 
1659  if ( new_size <= 0 )
1660  b->yy_buf_size += b->yy_buf_size / 8;
1661  else
1662  b->yy_buf_size *= 2;
1663 
1664  b->yy_ch_buf = (char *)
1665  /* Include room in for 2 EOB chars. */
1666  cqasm_v1realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
1667  }
1668  else
1669  /* Can't grow it, we don't own it. */
1670  b->yy_ch_buf = NULL;
1671 
1672  if ( ! b->yy_ch_buf )
1674  "fatal error - scanner input buffer overflow" );
1675 
1676  yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1677 
1678  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1679  number_to_move - 1;
1680 
1681  }
1682 
1683  if ( num_to_read > YY_READ_BUF_SIZE )
1684  num_to_read = YY_READ_BUF_SIZE;
1685 
1686  /* Read in more data. */
1687  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1688  yyg->yy_n_chars, num_to_read );
1689 
1690  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1691  }
1692 
1693  if ( yyg->yy_n_chars == 0 )
1694  {
1695  if ( number_to_move == YY_MORE_ADJ )
1696  {
1697  ret_val = EOB_ACT_END_OF_FILE;
1698  cqasm_v1restart(yyin ,yyscanner);
1699  }
1700 
1701  else
1702  {
1703  ret_val = EOB_ACT_LAST_MATCH;
1704  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1706  }
1707  }
1708 
1709  else
1710  ret_val = EOB_ACT_CONTINUE_SCAN;
1711 
1712  if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1713  /* Extend the array by 50%, plus the number we really need. */
1714  int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1715  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cqasm_v1realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1716  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1717  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1718  }
1719 
1720  yyg->yy_n_chars += number_to_move;
1723 
1724  yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1725 
1726  return ret_val;
1727 }
1728 
1729 /* yy_get_previous_state - get the state just before the EOB char was reached */
1730 
1731  static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1732 {
1733  yy_state_type yy_current_state;
1734  char *yy_cp;
1735  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1736 
1737  yy_current_state = yyg->yy_start;
1738 
1739  for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1740  {
1741  YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1742  if ( yy_accept[yy_current_state] )
1743  {
1744  yyg->yy_last_accepting_state = yy_current_state;
1746  }
1747  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1748  {
1749  yy_current_state = (int) yy_def[yy_current_state];
1750  if ( yy_current_state >= 190 )
1751  yy_c = yy_meta[(unsigned int) yy_c];
1752  }
1753  yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1754  }
1755 
1756  return yy_current_state;
1757 }
1758 
1759 /* yy_try_NUL_trans - try to make a transition on the NUL character
1760  *
1761  * synopsis
1762  * next_state = yy_try_NUL_trans( current_state );
1763  */
1764  static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
1765 {
1766  int yy_is_jam;
1767  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1768  char *yy_cp = yyg->yy_c_buf_p;
1769 
1770  YY_CHAR yy_c = 1;
1771  if ( yy_accept[yy_current_state] )
1772  {
1773  yyg->yy_last_accepting_state = yy_current_state;
1775  }
1776  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1777  {
1778  yy_current_state = (int) yy_def[yy_current_state];
1779  if ( yy_current_state >= 190 )
1780  yy_c = yy_meta[(unsigned int) yy_c];
1781  }
1782  yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1783  yy_is_jam = (yy_current_state == 189);
1784 
1785  (void)yyg;
1786  return yy_is_jam ? 0 : yy_current_state;
1787 }
1788 
1789 #ifndef YY_NO_UNPUT
1790 
1791 #endif
1792 
1793 #ifndef YY_NO_INPUT
1794 #ifdef __cplusplus
1795  static int yyinput (yyscan_t yyscanner)
1796 #else
1797  static int input (yyscan_t yyscanner)
1798 #endif
1799 
1800 {
1801  int c;
1802  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1803 
1804  *yyg->yy_c_buf_p = yyg->yy_hold_char;
1805 
1806  if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1807  {
1808  /* yy_c_buf_p now points to the character we want to return.
1809  * If this occurs *before* the EOB characters, then it's a
1810  * valid NUL; if not, then we've hit the end of the buffer.
1811  */
1812  if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1813  /* This was really a NUL. */
1814  *yyg->yy_c_buf_p = '\0';
1815 
1816  else
1817  { /* need more input */
1818  int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1819  ++yyg->yy_c_buf_p;
1820 
1821  switch ( yy_get_next_buffer( yyscanner ) )
1822  {
1823  case EOB_ACT_LAST_MATCH:
1824  /* This happens because yy_g_n_b()
1825  * sees that we've accumulated a
1826  * token and flags that we need to
1827  * try matching the token before
1828  * proceeding. But for input(),
1829  * there's no matching to consider.
1830  * So convert the EOB_ACT_LAST_MATCH
1831  * to EOB_ACT_END_OF_FILE.
1832  */
1833 
1834  /* Reset buffer status. */
1835  cqasm_v1restart(yyin ,yyscanner);
1836 
1837  /*FALLTHROUGH*/
1838 
1839  case EOB_ACT_END_OF_FILE:
1840  {
1841  if ( cqasm_v1wrap(yyscanner ) )
1842  return 0;
1843 
1844  if ( ! yyg->yy_did_buffer_switch_on_eof )
1845  YY_NEW_FILE;
1846 #ifdef __cplusplus
1847  return yyinput(yyscanner);
1848 #else
1849  return input(yyscanner);
1850 #endif
1851  }
1852 
1853  case EOB_ACT_CONTINUE_SCAN:
1854  yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1855  break;
1856  }
1857  }
1858  }
1859 
1860  c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1861  *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
1862  yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1863 
1864  if ( c == '\n' )
1865 
1866  do{ yylineno++;
1867  yycolumn=0;
1868  }while(0)
1869 ;
1870 
1871  return c;
1872 }
1873 #endif /* ifndef YY_NO_INPUT */
1874 
1880  void cqasm_v1restart (FILE * input_file , yyscan_t yyscanner)
1881 {
1882  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1883 
1884  if ( ! YY_CURRENT_BUFFER ){
1885  cqasm_v1ensure_buffer_stack (yyscanner);
1888  }
1889 
1890  cqasm_v1_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1891  cqasm_v1_load_buffer_state(yyscanner );
1892 }
1893 
1898  void cqasm_v1_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1899 {
1900  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1901 
1902  /* TODO. We should be able to replace this entire function body
1903  * with
1904  * cqasm_v1pop_buffer_state();
1905  * cqasm_v1push_buffer_state(new_buffer);
1906  */
1907  cqasm_v1ensure_buffer_stack (yyscanner);
1908  if ( YY_CURRENT_BUFFER == new_buffer )
1909  return;
1910 
1911  if ( YY_CURRENT_BUFFER )
1912  {
1913  /* Flush out information for old buffer. */
1914  *yyg->yy_c_buf_p = yyg->yy_hold_char;
1915  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1916  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1917  }
1918 
1919  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1920  cqasm_v1_load_buffer_state(yyscanner );
1921 
1922  /* We don't actually know whether we did this switch during
1923  * EOF (cqasm_v1wrap()) processing, but the only time this flag
1924  * is looked at is after cqasm_v1wrap() is called, so it's safe
1925  * to go ahead and always set it.
1926  */
1927  yyg->yy_did_buffer_switch_on_eof = 1;
1928 }
1929 
1930 static void cqasm_v1_load_buffer_state (yyscan_t yyscanner)
1931 {
1932  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1933  yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1934  yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1935  yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1936  yyg->yy_hold_char = *yyg->yy_c_buf_p;
1937 }
1938 
1945  YY_BUFFER_STATE cqasm_v1_create_buffer (FILE * file, int size , yyscan_t yyscanner)
1946 {
1947  YY_BUFFER_STATE b;
1948 
1949  b = (YY_BUFFER_STATE) cqasm_v1alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1950  if ( ! b )
1951  YY_FATAL_ERROR( "out of dynamic memory in cqasm_v1_create_buffer()" );
1952 
1953  b->yy_buf_size = (yy_size_t)size;
1954 
1955  /* yy_ch_buf has to be 2 characters longer than the size given because
1956  * we need to put in 2 end-of-buffer characters.
1957  */
1958  b->yy_ch_buf = (char *) cqasm_v1alloc(b->yy_buf_size + 2 ,yyscanner );
1959  if ( ! b->yy_ch_buf )
1960  YY_FATAL_ERROR( "out of dynamic memory in cqasm_v1_create_buffer()" );
1961 
1962  b->yy_is_our_buffer = 1;
1963 
1964  cqasm_v1_init_buffer(b,file ,yyscanner);
1965 
1966  return b;
1967 }
1968 
1973  void cqasm_v1_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1974 {
1975  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1976 
1977  if ( ! b )
1978  return;
1979 
1980  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1982 
1983  if ( b->yy_is_our_buffer )
1984  cqasm_v1free((void *) b->yy_ch_buf ,yyscanner );
1985 
1986  cqasm_v1free((void *) b ,yyscanner );
1987 }
1988 
1989 /* Initializes or reinitializes a buffer.
1990  * This function is sometimes called more than once on the same buffer,
1991  * such as during a cqasm_v1restart() or at EOF.
1992  */
1993  static void cqasm_v1_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
1994 
1995 {
1996  int oerrno = errno;
1997  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1998 
1999  cqasm_v1_flush_buffer(b ,yyscanner);
2000 
2001  b->yy_input_file = file;
2002  b->yy_fill_buffer = 1;
2003 
2004  /* If b is the current buffer, then cqasm_v1_init_buffer was _probably_
2005  * called from cqasm_v1restart() or through yy_get_next_buffer.
2006  * In that case, we don't want to reset the lineno or column.
2007  */
2008  if (b != YY_CURRENT_BUFFER){
2009  b->yy_bs_lineno = 1;
2010  b->yy_bs_column = 0;
2011  }
2012 
2013  b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2014 
2015  errno = oerrno;
2016 }
2017 
2022  void cqasm_v1_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
2023 {
2024  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2025  if ( ! b )
2026  return;
2027 
2028  b->yy_n_chars = 0;
2029 
2030  /* We always need two end-of-buffer characters. The first causes
2031  * a transition to the end-of-buffer state. The second causes
2032  * a jam in that state.
2033  */
2036 
2037  b->yy_buf_pos = &b->yy_ch_buf[0];
2038 
2039  b->yy_at_bol = 1;
2041 
2042  if ( b == YY_CURRENT_BUFFER )
2043  cqasm_v1_load_buffer_state(yyscanner );
2044 }
2045 
2052 void cqasm_v1push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
2053 {
2054  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2055  if (new_buffer == NULL)
2056  return;
2057 
2058  cqasm_v1ensure_buffer_stack(yyscanner);
2059 
2060  /* This block is copied from cqasm_v1_switch_to_buffer. */
2061  if ( YY_CURRENT_BUFFER )
2062  {
2063  /* Flush out information for old buffer. */
2064  *yyg->yy_c_buf_p = yyg->yy_hold_char;
2065  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2066  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2067  }
2068 
2069  /* Only push if top exists. Otherwise, replace top. */
2070  if (YY_CURRENT_BUFFER)
2071  yyg->yy_buffer_stack_top++;
2072  YY_CURRENT_BUFFER_LVALUE = new_buffer;
2073 
2074  /* copied from cqasm_v1_switch_to_buffer. */
2075  cqasm_v1_load_buffer_state(yyscanner );
2076  yyg->yy_did_buffer_switch_on_eof = 1;
2077 }
2078 
2084 {
2085  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2086  if (!YY_CURRENT_BUFFER)
2087  return;
2088 
2090  YY_CURRENT_BUFFER_LVALUE = NULL;
2091  if (yyg->yy_buffer_stack_top > 0)
2092  --yyg->yy_buffer_stack_top;
2093 
2094  if (YY_CURRENT_BUFFER) {
2095  cqasm_v1_load_buffer_state(yyscanner );
2096  yyg->yy_did_buffer_switch_on_eof = 1;
2097  }
2098 }
2099 
2100 /* Allocates the stack if it does not exist.
2101  * Guarantees space for at least one push.
2102  */
2103 static void cqasm_v1ensure_buffer_stack (yyscan_t yyscanner)
2104 {
2105  int num_to_alloc;
2106  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2107 
2108  if (!yyg->yy_buffer_stack) {
2109 
2110  /* First allocation is just for 2 elements, since we don't know if this
2111  * scanner will even need a stack. We use 2 instead of 1 to avoid an
2112  * immediate realloc on the next call.
2113  */
2114  num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
2116  (num_to_alloc * sizeof(struct yy_buffer_state*)
2117  , yyscanner);
2118  if ( ! yyg->yy_buffer_stack )
2119  YY_FATAL_ERROR( "out of dynamic memory in cqasm_v1ensure_buffer_stack()" );
2120 
2121  memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2122 
2123  yyg->yy_buffer_stack_max = num_to_alloc;
2124  yyg->yy_buffer_stack_top = 0;
2125  return;
2126  }
2127 
2128  if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2129 
2130  /* Increase the buffer to prepare for a possible push. */
2131  yy_size_t grow_size = 8 /* arbitrary grow size */;
2132 
2133  num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
2135  (yyg->yy_buffer_stack,
2136  num_to_alloc * sizeof(struct yy_buffer_state*)
2137  , yyscanner);
2138  if ( ! yyg->yy_buffer_stack )
2139  YY_FATAL_ERROR( "out of dynamic memory in cqasm_v1ensure_buffer_stack()" );
2140 
2141  /* zero only the new slots.*/
2142  memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
2143  yyg->yy_buffer_stack_max = num_to_alloc;
2144  }
2145 }
2146 
2153 YY_BUFFER_STATE cqasm_v1_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
2154 {
2155  YY_BUFFER_STATE b;
2156 
2157  if ( size < 2 ||
2158  base[size-2] != YY_END_OF_BUFFER_CHAR ||
2159  base[size-1] != YY_END_OF_BUFFER_CHAR )
2160  /* They forgot to leave room for the EOB's. */
2161  return NULL;
2162 
2163  b = (YY_BUFFER_STATE) cqasm_v1alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
2164  if ( ! b )
2165  YY_FATAL_ERROR( "out of dynamic memory in cqasm_v1_scan_buffer()" );
2166 
2167  b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2168  b->yy_buf_pos = b->yy_ch_buf = base;
2169  b->yy_is_our_buffer = 0;
2170  b->yy_input_file = NULL;
2171  b->yy_n_chars = b->yy_buf_size;
2172  b->yy_is_interactive = 0;
2173  b->yy_at_bol = 1;
2174  b->yy_fill_buffer = 0;
2176 
2177  cqasm_v1_switch_to_buffer(b ,yyscanner );
2178 
2179  return b;
2180 }
2181 
2190 YY_BUFFER_STATE cqasm_v1_scan_string (yyconst char * yystr , yyscan_t yyscanner)
2191 {
2192 
2193  return cqasm_v1_scan_bytes(yystr,(int) strlen(yystr) ,yyscanner);
2194 }
2195 
2203 YY_BUFFER_STATE cqasm_v1_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
2204 {
2205  YY_BUFFER_STATE b;
2206  char *buf;
2207  yy_size_t n;
2208  yy_size_t i;
2209 
2210  /* Get memory for full buffer, including space for trailing EOB's. */
2211  n = (yy_size_t) _yybytes_len + 2;
2212  buf = (char *) cqasm_v1alloc(n ,yyscanner );
2213  if ( ! buf )
2214  YY_FATAL_ERROR( "out of dynamic memory in cqasm_v1_scan_bytes()" );
2215 
2216  for ( i = 0; i < _yybytes_len; ++i )
2217  buf[i] = yybytes[i];
2218 
2219  buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2220 
2221  b = cqasm_v1_scan_buffer(buf,n ,yyscanner);
2222  if ( ! b )
2223  YY_FATAL_ERROR( "bad buffer in cqasm_v1_scan_bytes()" );
2224 
2225  /* It's okay to grow etc. this buffer, and we should throw it
2226  * away when we're done.
2227  */
2228  b->yy_is_our_buffer = 1;
2229 
2230  return b;
2231 }
2232 
2233 #ifndef YY_EXIT_FAILURE
2234 #define YY_EXIT_FAILURE 2
2235 #endif
2236 
2237 static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
2238 {
2239  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2240  (void)yyg;
2241  (void) fprintf( stderr, "%s\n", msg );
2242  exit( YY_EXIT_FAILURE );
2243 }
2244 
2245 /* Redefine yyless() so it works in section 3 code. */
2246 
2247 #undef yyless
2248 #define yyless(n) \
2249  do \
2250  { \
2251  /* Undo effects of setting up yytext. */ \
2252  int yyless_macro_arg = (n); \
2253  YY_LESS_LINENO(yyless_macro_arg);\
2254  yytext[yyleng] = yyg->yy_hold_char; \
2255  yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2256  yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2257  *yyg->yy_c_buf_p = '\0'; \
2258  yyleng = yyless_macro_arg; \
2259  } \
2260  while ( 0 )
2261 
2262 /* Accessor methods (get/set functions) to struct members. */
2263 
2268 {
2269  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2270  return yyextra;
2271 }
2272 
2277 {
2278  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2279 
2280  if (! YY_CURRENT_BUFFER)
2281  return 0;
2282 
2283  return yylineno;
2284 }
2285 
2290 {
2291  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2292 
2293  if (! YY_CURRENT_BUFFER)
2294  return 0;
2295 
2296  return yycolumn;
2297 }
2298 
2302 FILE *cqasm_v1get_in (yyscan_t yyscanner)
2303 {
2304  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2305  return yyin;
2306 }
2307 
2311 FILE *cqasm_v1get_out (yyscan_t yyscanner)
2312 {
2313  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2314  return yyout;
2315 }
2316 
2321 {
2322  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2323  return yyleng;
2324 }
2325 
2330 char *cqasm_v1get_text (yyscan_t yyscanner)
2331 {
2332  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2333  return yytext;
2334 }
2335 
2340 void cqasm_v1set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
2341 {
2342  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2343  yyextra = user_defined ;
2344 }
2345 
2350 void cqasm_v1set_lineno (int _line_number , yyscan_t yyscanner)
2351 {
2352  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2353 
2354  /* lineno is only valid if an input buffer exists. */
2355  if (! YY_CURRENT_BUFFER )
2356  YY_FATAL_ERROR( "cqasm_v1set_lineno called with no buffer" );
2357 
2358  yylineno = _line_number;
2359 }
2360 
2365 void cqasm_v1set_column (int _column_no , yyscan_t yyscanner)
2366 {
2367  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2368 
2369  /* column is only valid if an input buffer exists. */
2370  if (! YY_CURRENT_BUFFER )
2371  YY_FATAL_ERROR( "cqasm_v1set_column called with no buffer" );
2372 
2373  yycolumn = _column_no;
2374 }
2375 
2382 void cqasm_v1set_in (FILE * _in_str , yyscan_t yyscanner)
2383 {
2384  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2385  yyin = _in_str ;
2386 }
2387 
2388 void cqasm_v1set_out (FILE * _out_str , yyscan_t yyscanner)
2389 {
2390  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2391  yyout = _out_str ;
2392 }
2393 
2395 {
2396  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2397  return yy_flex_debug;
2398 }
2399 
2400 void cqasm_v1set_debug (int _bdebug , yyscan_t yyscanner)
2401 {
2402  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2403  yy_flex_debug = _bdebug ;
2404 }
2405 
2406 /* Accessor methods for yylval and yylloc */
2407 
2409 {
2410  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2411  return yylval;
2412 }
2413 
2414 void cqasm_v1set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
2415 {
2416  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2417  yylval = yylval_param;
2418 }
2419 
2421 {
2422  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2423  return yylloc;
2424 }
2425 
2426 void cqasm_v1set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
2427 {
2428  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2429  yylloc = yylloc_param;
2430 }
2431 
2432 /* User-visible API */
2433 
2434 /* cqasm_v1lex_init is special because it creates the scanner itself, so it is
2435  * the ONLY reentrant function that doesn't take the scanner as the last argument.
2436  * That's why we explicitly handle the declaration, instead of using our macros.
2437  */
2438 
2439 int cqasm_v1lex_init(yyscan_t* ptr_yy_globals)
2440 
2441 {
2442  if (ptr_yy_globals == NULL){
2443  errno = EINVAL;
2444  return 1;
2445  }
2446 
2447  *ptr_yy_globals = (yyscan_t) cqasm_v1alloc ( sizeof( struct yyguts_t ), NULL );
2448 
2449  if (*ptr_yy_globals == NULL){
2450  errno = ENOMEM;
2451  return 1;
2452  }
2453 
2454  /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2455  memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2456 
2457  return yy_init_globals ( *ptr_yy_globals );
2458 }
2459 
2460 /* cqasm_v1lex_init_extra has the same functionality as cqasm_v1lex_init, but follows the
2461  * convention of taking the scanner as the last argument. Note however, that
2462  * this is a *pointer* to a scanner, as it will be allocated by this call (and
2463  * is the reason, too, why this function also must handle its own declaration).
2464  * The user defined value in the first argument will be available to cqasm_v1alloc in
2465  * the yyextra field.
2466  */
2467 
2468 int cqasm_v1lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
2469 
2470 {
2471  struct yyguts_t dummy_yyguts;
2472 
2473  cqasm_v1set_extra (yy_user_defined, &dummy_yyguts);
2474 
2475  if (ptr_yy_globals == NULL){
2476  errno = EINVAL;
2477  return 1;
2478  }
2479 
2480  *ptr_yy_globals = (yyscan_t) cqasm_v1alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2481 
2482  if (*ptr_yy_globals == NULL){
2483  errno = ENOMEM;
2484  return 1;
2485  }
2486 
2487  /* By setting to 0xAA, we expose bugs in
2488  yy_init_globals. Leave at 0x00 for releases. */
2489  memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2490 
2491  cqasm_v1set_extra (yy_user_defined, *ptr_yy_globals);
2492 
2493  return yy_init_globals ( *ptr_yy_globals );
2494 }
2495 
2496 static int yy_init_globals (yyscan_t yyscanner)
2497 {
2498  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2499  /* Initialization is the same as for the non-reentrant scanner.
2500  * This function is called from cqasm_v1lex_destroy(), so don't allocate here.
2501  */
2502 
2503  yyg->yy_buffer_stack = NULL;
2504  yyg->yy_buffer_stack_top = 0;
2505  yyg->yy_buffer_stack_max = 0;
2506  yyg->yy_c_buf_p = NULL;
2507  yyg->yy_init = 0;
2508  yyg->yy_start = 0;
2509 
2510  yyg->yy_start_stack_ptr = 0;
2511  yyg->yy_start_stack_depth = 0;
2512  yyg->yy_start_stack = NULL;
2513 
2514 /* Defined in main.c */
2515 #ifdef YY_STDINIT
2516  yyin = stdin;
2517  yyout = stdout;
2518 #else
2519  yyin = NULL;
2520  yyout = NULL;
2521 #endif
2522 
2523  /* For future reference: Set errno on error, since we are called by
2524  * cqasm_v1lex_init()
2525  */
2526  return 0;
2527 }
2528 
2529 /* cqasm_v1lex_destroy is for both reentrant and non-reentrant scanners. */
2531 {
2532  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2533 
2534  /* Pop the buffer stack, destroying each element. */
2535  while(YY_CURRENT_BUFFER){
2537  YY_CURRENT_BUFFER_LVALUE = NULL;
2538  cqasm_v1pop_buffer_state(yyscanner);
2539  }
2540 
2541  /* Destroy the stack itself. */
2542  cqasm_v1free(yyg->yy_buffer_stack ,yyscanner);
2543  yyg->yy_buffer_stack = NULL;
2544 
2545  /* Destroy the start condition stack. */
2546  cqasm_v1free(yyg->yy_start_stack ,yyscanner );
2547  yyg->yy_start_stack = NULL;
2548 
2549  /* Reset the globals. This is important in a non-reentrant scanner so the next time
2550  * cqasm_v1lex() is called, initialization will occur. */
2551  yy_init_globals( yyscanner);
2552 
2553  /* Destroy the main struct (reentrant only). */
2554  cqasm_v1free ( yyscanner , yyscanner );
2555  yyscanner = NULL;
2556  return 0;
2557 }
2558 
2559 /*
2560  * Internal utility routines.
2561  */
2562 
2563 #ifndef yytext_ptr
2564 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2565 {
2566  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2567  (void)yyg;
2568 
2569  int i;
2570  for ( i = 0; i < n; ++i )
2571  s1[i] = s2[i];
2572 }
2573 #endif
2574 
2575 #ifdef YY_NEED_STRLEN
2576 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2577 {
2578  int n;
2579  for ( n = 0; s[n]; ++n )
2580  ;
2581 
2582  return n;
2583 }
2584 #endif
2585 
2586 void *cqasm_v1alloc (yy_size_t size , yyscan_t yyscanner)
2587 {
2588  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2589  (void)yyg;
2590  return malloc(size);
2591 }
2592 
2593 void *cqasm_v1realloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
2594 {
2595  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2596  (void)yyg;
2597 
2598  /* The cast to (char *) in the following accommodates both
2599  * implementations that use char* generic pointers, and those
2600  * that use void* generic pointers. It works with the latter
2601  * because both ANSI C and C++ allow castless assignment from
2602  * any pointer type to void*, and deal with argument conversions
2603  * as though doing an assignment.
2604  */
2605  return realloc(ptr, size);
2606 }
2607 
2608 void cqasm_v1free (void * ptr , yyscan_t yyscanner)
2609 {
2610  struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2611  (void)yyg;
2612  free( (char *) ptr ); /* see cqasm_v1realloc() for (char *) cast */
2613 }
2614 
2615 #define YYTABLES_NAME "yytables"
2616 
2617 #line 233 "/home/docs/checkouts/readthedocs.org/user_builds/libqasm/checkouts/latest/src/cqasm/src/cqasm-v1-lexer.l"
Parser, generated by Bison.
YY_BUFFER_STATE cqasm_v1_create_buffer(FILE *file, int size, yyscan_t yyscanner)
Allocate and initialize an input buffer state.
#define EOB_ACT_LAST_MATCH
void cqasm_v1_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
Switch to a different input buffer.
int cqasm_v1lex_destroy(yyscan_t yyscanner)
char * cqasm_v1get_text(yyscan_t yyscanner)
Get the current token.
#define yyextra
size_t yy_buffer_stack_top
index of top of stack.
#define YY_START
int yy_start_stack_depth
char * yy_bp
#define yytext
#define YY_READ_BUF_SIZE
unsigned int flex_uint32_t
#define YY_STATE_EOF(state)
void cqasm_v1set_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner)
Set the user-defined data.
FILE * cqasm_v1get_in(yyscan_t yyscanner)
Get the input stream.
YYLTYPE * cqasm_v1get_lloc(yyscan_t yyscanner)
void cqasm_v1free(void *, yyscan_t yyscanner)
#define YY_CURRENT_BUFFER
#define MODE_JSON
void cqasm_v1push_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
Pushes the new state onto the stack.
YY_BUFFER_STATE cqasm_v1_scan_string(yyconst char *yy_str, yyscan_t yyscanner)
Setup the input buffer state to scan a string.
void cqasm_v1set_lloc(YYLTYPE *yylloc_param, yyscan_t yyscanner)
#define yylineno
int yy_bs_lineno
The line count.
char * yytext_r
FILE * cqasm_v1get_out(yyscan_t yyscanner)
Get the output stream.
int yy_act
#define yyterminate()
size_t yy_buffer_stack_max
capacity of stack.
#define YYLTYPE
#define YY_RESTORE_YY_MORE_OFFSET
#define cqasm_v1wrap(yyscanner)
#define WITHOUT_STR(TOKNAME)
YY_EXTRA_TYPE yyextra_r
unsigned short int flex_uint16_t
YYSTYPE * cqasm_v1get_lval(yyscan_t yyscanner)
struct yyguts_t * yyg
YY_EXTRA_TYPE cqasm_v1get_extra(yyscan_t yyscanner)
Get the user-defined data for this scanner.
void cqasm_v1set_debug(int debug_flag, yyscan_t yyscanner)
int yy_state_type
char * yy_c_buf_p
#define YY_INPUT(buf, result, max_size)
#define YY_END_OF_BUFFER
void * yyscan_t
unsigned char flex_uint8_t
#define MODE_VERSION
void cqasm_v1pop_buffer_state(yyscan_t yyscanner)
Removes and deletes the top of the stack, if present.
void cqasm_v1set_lineno(int _line_number, yyscan_t yyscanner)
Set the current line number.
int yy_did_buffer_switch_on_eof
#define YY_BUFFER_NORMAL
void cqasm_v1set_out(FILE *_out_str, yyscan_t yyscanner)
int yy_bs_column
The column count.
int cqasm_v1get_debug(yyscan_t yyscanner)
#define YYSTYPE
YY_BUFFER_STATE cqasm_v1_scan_bytes(yyconst char *bytes, int len, yyscan_t yyscanner)
Setup the input buffer state to scan the given bytes.
#define YY_NEW_FILE
void * cqasm_v1alloc(yy_size_t, yyscan_t yyscanner)
void cqasm_v1set_in(FILE *_in_str, yyscan_t yyscanner)
Set the input stream.
#define yyout
#define YY_MORE_ADJ
#define MODE_UNEXPECTED_EOF
void cqasm_v1_flush_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner)
Discard all buffered characters.
if(!yyg->yy_init)
unsigned char YY_CHAR
#define yynoreturn
int yy_start_stack_ptr
#define YY_DO_BEFORE_ACTION
int * yy_start_stack
#define yylloc
void free(void *)
char * yy_cp
void cqasm_v1_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner)
Destroy the buffer.
#define MODE_JSON_STRING
YY_BUFFER_STATE cqasm_v1_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner)
Setup the input buffer state to scan directly from a user-specified character buffer.
#define EOB_ACT_END_OF_FILE
int cqasm_v1get_column(yyscan_t yyscanner)
Get the current column number.
#define yy_flex_debug
#define yylval
int cqasm_v1lex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner)
#define YY_END_OF_BUFFER_CHAR
yy_state_type yy_last_accepting_state
#define WITH_STR(TOKNAME)
short int flex_int16_t
#define EOB_ACT_CONTINUE_SCAN
#define OPERATOR
size_t yy_size_t
#define MODE_MULTILINE_COMMENT
#define YY_BUFFER_NEW
int cqasm_v1get_lineno(yyscan_t yyscanner)
Get the current line number.
#define YY_DECL
YYLTYPE * yylloc_r
#define yycolumn
flex_int32_t yy_verify
signed char flex_int8_t
#define INITIAL
#define YY_EXTRA_TYPE
#define LOCATION_LINE
void * cqasm_v1realloc(void *, yy_size_t, yyscan_t yyscanner)
#define BEGIN
#define YY_RULE_SETUP
int cqasm_v1lex_init(yyscan_t *scanner)
flex_int32_t yy_nxt
#define MODE_STRING
#define YY_BUFFER_EOF_PENDING
#define YY_EXIT_FAILURE
YYSTYPE * yylval_r
FILE * yyout_r
void cqasm_v1set_lval(YYSTYPE *yylval_param, yyscan_t yyscanner)
#define YY_FATAL_ERROR(msg)
int cqasm_v1lex_init_extra(YY_EXTRA_TYPE user_defined, yyscan_t *scanner)
int flex_int32_t
#define DELETE
#define YY_BREAK
#define YY_SC_TO_UI(c)
void * malloc(YYSIZE_T)
#define yyin
#define LOCATION_STEP
YY_BUFFER_STATE * yy_buffer_stack
Stack as an array.
char * yy_last_accepting_cpos
void cqasm_v1set_column(int _column_no, yyscan_t yyscanner)
Set the current column.
int cqasm_v1get_leng(yyscan_t yyscanner)
Get the length of the current token.
struct yy_buffer_state * YY_BUFFER_STATE
#define YY_CURRENT_BUFFER_LVALUE
#define yyconst
void cqasm_v1restart(FILE *input_file, yyscan_t yyscanner)
Immediately switch to a different input stream.
#define yyleng
#define YY_BUF_SIZE