2
#line 1 "QuantityLexer.c"
4
#line 3 "QuantityLexer.c"
6
#define YY_INT_ALIGNED short int
8
/* A lexical scanner generated by flex */
11
#define YY_FLEX_MAJOR_VERSION 2
12
#define YY_FLEX_MINOR_VERSION 6
13
#define YY_FLEX_SUBMINOR_VERSION 4
14
#if YY_FLEX_SUBMINOR_VERSION > 0
18
/* First, we deal with platform-specific or compiler-specific issues. */
20
/* begin standard C headers. */
26
/* end standard C headers. */
28
/* flex integer type definitions */
33
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
35
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
37
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
38
* if you want the limit (max/min) macros for int types.
40
#ifndef __STDC_LIMIT_MACROS
41
#define __STDC_LIMIT_MACROS 1
45
typedef int8_t flex_int8_t;
46
typedef uint8_t flex_uint8_t;
47
typedef int16_t flex_int16_t;
48
typedef uint16_t flex_uint16_t;
49
typedef int32_t flex_int32_t;
50
typedef uint32_t flex_uint32_t;
52
typedef signed char flex_int8_t;
53
typedef short int flex_int16_t;
54
typedef int flex_int32_t;
55
typedef unsigned char flex_uint8_t;
56
typedef unsigned short int flex_uint16_t;
57
typedef unsigned int flex_uint32_t;
59
/* Limits of integral types. */
61
#define INT8_MIN (-128)
64
#define INT16_MIN (-32767-1)
67
#define INT32_MIN (-2147483647-1)
73
#define INT16_MAX (32767)
76
#define INT32_MAX (2147483647)
79
#define UINT8_MAX (255U)
82
#define UINT16_MAX (65535U)
85
#define UINT32_MAX (4294967295U)
89
#define SIZE_MAX (~(size_t)0)
94
#endif /* ! FLEXINT_H */
96
/* begin standard C++ headers. */
98
/* TODO: this is always defined, so inline it */
101
#if defined(__GNUC__) && __GNUC__ >= 3
102
#define yynoreturn __attribute__((__noreturn__))
107
/* Returned upon end-of-file. */
110
/* Promotes a possibly negative, possibly signed char to an
111
* integer in range [0..255] for use as an array index.
113
#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
115
/* Enter a start condition. This macro really ought to take a parameter,
116
* but we do it the disgusting crufty way forced on us by the ()-less
117
* definition of BEGIN.
119
#define BEGIN (yy_start) = 1 + 2 *
120
/* Translate the current start state into a value that can be later handed
121
* to BEGIN to return to the state. The YYSTATE alias is for lex
124
#define YY_START (((yy_start) - 1) / 2)
125
#define YYSTATE YY_START
126
/* Action number for EOF rule of a given start state. */
127
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
128
/* Special action meaning "start processing a new file". */
129
#define YY_NEW_FILE yyrestart( yyin )
130
#define YY_END_OF_BUFFER_CHAR 0
132
/* Size of default input buffer. */
135
/* On IA-64, the buffer size is 16k, not 8k.
136
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
137
* Ditto for the __ia64__ case accordingly.
139
#define YY_BUF_SIZE 32768
141
#define YY_BUF_SIZE 16384
145
/* The state buf must be large enough to hold one state per character in the main buffer.
147
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
149
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
150
#define YY_TYPEDEF_YY_BUFFER_STATE
151
typedef struct yy_buffer_state *YY_BUFFER_STATE;
154
#ifndef YY_TYPEDEF_YY_SIZE_T
155
#define YY_TYPEDEF_YY_SIZE_T
156
typedef size_t yy_size_t;
161
extern FILE *yyin, *yyout;
163
#define EOB_ACT_CONTINUE_SCAN 0
164
#define EOB_ACT_END_OF_FILE 1
165
#define EOB_ACT_LAST_MATCH 2
167
#define YY_LESS_LINENO(n)
168
#define YY_LINENO_REWIND_TO(ptr)
170
/* Return all but the first "n" matched characters back to the input stream. */
174
/* Undo effects of setting up yytext. */ \
175
int yyless_macro_arg = (n); \
176
YY_LESS_LINENO(yyless_macro_arg);\
177
*yy_cp = (yy_hold_char); \
178
YY_RESTORE_YY_MORE_OFFSET \
179
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
180
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
183
#define unput(c) yyunput( c, (yytext_ptr) )
185
#ifndef YY_STRUCT_YY_BUFFER_STATE
186
#define YY_STRUCT_YY_BUFFER_STATE
187
struct yy_buffer_state
191
char *yy_ch_buf; /* input buffer */
192
char *yy_buf_pos; /* current position in input buffer */
194
/* Size of input buffer in bytes, not including room for EOB
199
/* Number of characters read into yy_ch_buf, not including EOB
204
/* Whether we "own" the buffer - i.e., we know we created it,
205
* and can realloc() it to grow it, and should free() it to
208
int yy_is_our_buffer;
210
/* Whether this is an "interactive" input source; if so, and
211
* if we're using stdio for input, then we want to use getc()
212
* instead of fread(), to make sure we stop fetching input after
215
int yy_is_interactive;
217
/* Whether we're considered to be at the beginning of a line.
218
* If so, '^' rules will be active on the next match, otherwise
223
int yy_bs_lineno; /**< The line count. */
224
int yy_bs_column; /**< The column count. */
226
/* Whether to try to fill the input buffer when we reach the
231
int yy_buffer_status;
233
#define YY_BUFFER_NEW 0
234
#define YY_BUFFER_NORMAL 1
235
/* When an EOF's been seen but there's still some text to process
236
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
237
* shouldn't try reading from the input source any more. We might
238
* still have a bunch of tokens to match, though, because of
239
* possible backing-up.
241
* When we actually see the EOF, we change the status to "new"
242
* (via yyrestart()), so that the user can continue scanning by
243
* just pointing yyin at a new input file.
245
#define YY_BUFFER_EOF_PENDING 2
248
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
250
/* Stack of input buffers. */
251
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
252
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
253
static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
255
/* We provide macros for accessing buffer states in case in the
256
* future we want to put the buffer states in a more general
259
* Returns the top of the stack, or NULL.
261
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
262
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
264
/* Same as previous macro, but useful when we know that the buffer stack is not
265
* NULL or when we need an lvalue. For internal use only.
267
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
269
/* yy_hold_char holds the character lost when yytext is formed. */
270
static char yy_hold_char;
271
static int yy_n_chars; /* number of characters read into yy_ch_buf */
274
/* Points to current character in buffer. */
275
static char *yy_c_buf_p = NULL;
276
static int yy_init = 0; /* whether we need to initialize */
277
static int yy_start = 0; /* start state number */
279
/* Flag which is used to allow yywrap()'s to do buffer switches
280
* instead of setting up a fresh yyin. A bit of a hack ...
282
static int yy_did_buffer_switch_on_eof;
284
void yyrestart ( FILE *input_file );
285
void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
286
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
287
void yy_delete_buffer ( YY_BUFFER_STATE b );
288
void yy_flush_buffer ( YY_BUFFER_STATE b );
289
void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
290
void yypop_buffer_state ( void );
292
static void yyensure_buffer_stack ( void );
293
static void yy_load_buffer_state ( void );
294
static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
295
#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
297
YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
298
YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
299
YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
301
void *yyalloc ( yy_size_t );
302
void *yyrealloc ( void *, yy_size_t );
303
void yyfree ( void * );
305
#define yy_new_buffer yy_create_buffer
306
#define yy_set_interactive(is_interactive) \
308
if ( ! YY_CURRENT_BUFFER ){ \
309
yyensure_buffer_stack (); \
310
YY_CURRENT_BUFFER_LVALUE = \
311
yy_create_buffer( yyin, YY_BUF_SIZE ); \
313
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
315
#define yy_set_bol(at_bol) \
317
if ( ! YY_CURRENT_BUFFER ){\
318
yyensure_buffer_stack (); \
319
YY_CURRENT_BUFFER_LVALUE = \
320
yy_create_buffer( yyin, YY_BUF_SIZE ); \
322
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
324
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
326
#define yywrap() (/*CONSTCOND*/1)
327
#define YY_SKIP_YYWRAP
328
typedef flex_uint8_t YY_CHAR;
330
FILE *yyin = NULL, *yyout = NULL;
332
typedef int yy_state_type;
341
#define yytext_ptr yytext
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 );
348
/* Done after the current pattern has been matched and before the
349
* corresponding action - sets up yytext.
351
#define YY_DO_BEFORE_ACTION \
352
(yytext_ptr) = yy_bp; \
353
yyleng = (int) (yy_cp - yy_bp); \
354
(yy_hold_char) = *yy_cp; \
356
(yy_c_buf_p) = yy_cp;
357
#define YY_NUM_RULES 154
358
#define YY_END_OF_BUFFER 155
359
/* This struct is not used in this scanner,
360
but its presence is necessary. */
363
flex_int32_t yy_verify;
366
static const flex_int16_t yy_accept[265] =
368
0, 0, 0, 0, 155, 153, 4, 5, 45, 47,
369
6, 153, 7, 153, 131, 130, 33, 94, 98, 96,
370
104, 109, 37, 126, 61, 153, 153, 87, 95, 82,
371
78, 1, 153, 153, 153, 153, 136, 153, 27, 32,
372
153, 153, 17, 15, 153, 153, 153, 153, 30, 29,
373
153, 153, 153, 153, 3, 154, 2, 5, 134, 132,
374
133, 131, 131, 0, 128, 114, 0, 0, 19, 36,
375
0, 64, 0, 0, 85, 0, 0, 112, 0, 65,
376
0, 0, 81, 97, 115, 0, 0, 0, 0, 0,
377
0, 43, 0, 13, 0, 0, 0, 14, 117, 0,
379
46, 0, 44, 35, 0, 111, 63, 0, 0, 86,
380
83, 80, 0, 0, 28, 16, 0, 55, 0, 34,
381
99, 105, 110, 38, 62, 88, 0, 84, 79, 0,
382
26, 51, 18, 12, 0, 0, 102, 108, 9, 57,
383
103, 135, 0, 0, 0, 0, 0, 58, 0, 0,
384
101, 107, 40, 90, 0, 24, 10, 50, 122, 0,
385
0, 0, 0, 0, 133, 0, 131, 0, 0, 131,
386
22, 68, 21, 0, 67, 119, 0, 91, 23, 0,
387
113, 143, 0, 0, 0, 69, 120, 54, 141, 59,
388
123, 142, 125, 20, 0, 66, 116, 0, 118, 76,
390
60, 56, 145, 0, 0, 49, 31, 0, 144, 41,
391
52, 147, 75, 124, 148, 0, 0, 150, 0, 0,
392
100, 106, 39, 89, 0, 25, 11, 127, 129, 8,
393
0, 134, 0, 132, 0, 133, 0, 131, 93, 77,
394
71, 137, 138, 139, 92, 121, 0, 0, 70, 42,
395
149, 53, 152, 151, 48, 0, 0, 140, 146, 72,
399
static const YY_CHAR yy_ec[256] =
401
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
402
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
403
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
404
1, 2, 1, 4, 1, 1, 1, 1, 5, 6,
405
6, 6, 7, 8, 9, 10, 6, 11, 12, 13,
406
14, 14, 14, 14, 14, 14, 14, 1, 1, 1,
407
6, 1, 1, 1, 15, 1, 16, 1, 17, 18,
408
19, 20, 1, 21, 22, 1, 23, 24, 25, 26,
409
1, 1, 27, 28, 1, 29, 30, 1, 1, 1,
410
31, 1, 32, 6, 1, 1, 33, 34, 35, 36,
412
37, 38, 39, 40, 41, 1, 42, 43, 44, 45,
413
46, 47, 48, 49, 50, 51, 52, 1, 53, 54,
414
55, 56, 1, 1, 1, 1, 1, 57, 1, 1,
415
1, 1, 1, 1, 1, 58, 1, 1, 1, 1,
416
1, 1, 1, 1, 1, 59, 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, 60, 1, 61, 62, 1,
420
63, 1, 1, 1, 1, 1, 1, 1, 1, 1,
421
1, 1, 1, 64, 1, 1, 1, 1, 1, 1,
423
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
425
1, 1, 1, 1, 1, 65, 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,
431
static const YY_CHAR yy_meta[66] =
433
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
434
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
435
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
436
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
437
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
438
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
442
static const flex_int16_t yy_base[266] =
444
0, 0, 63, 64, 394, 395, 395, 390, 395, 395,
445
395, 57, 395, 61, 68, 76, 365, 362, 395, 57,
446
334, 395, 395, 77, 345, 348, 354, 395, 71, 371,
447
60, 395, 65, 352, 85, 75, 78, 333, 337, 395,
448
337, 124, 74, 160, 91, 325, 116, 347, 85, 97,
449
190, 343, 62, 70, 395, 395, 395, 375, 159, 202,
450
209, 219, 230, 241, 395, 395, 321, 343, 395, 395,
451
319, 395, 334, 340, 395, 343, 321, 395, 326, 395,
452
313, 319, 317, 395, 395, 316, 319, 323, 330, 313,
453
318, 395, 309, 395, 309, 307, 272, 395, 395, 260,
455
395, 253, 395, 395, 238, 395, 395, 243, 248, 395,
456
395, 239, 245, 244, 395, 395, 230, 102, 227, 395,
457
395, 395, 395, 395, 395, 395, 219, 395, 395, 231,
458
395, 98, 395, 216, 122, 220, 395, 395, 395, 395,
459
395, 395, 205, 216, 215, 204, 118, 395, 200, 191,
460
395, 395, 395, 395, 189, 395, 395, 395, 395, 241,
461
124, 169, 263, 275, 279, 288, 292, 301, 306, 310,
462
395, 395, 395, 183, 395, 395, 184, 395, 395, 175,
463
395, 395, 161, 164, 160, 395, 395, 395, 395, 395,
464
395, 395, 395, 395, 158, 395, 395, 157, 395, 395,
466
395, 395, 186, 148, 146, 395, 395, 150, 395, 395,
467
395, 395, 395, 395, 152, 140, 132, 139, 125, 120,
468
395, 395, 395, 395, 118, 395, 395, 395, 395, 395,
469
314, 319, 323, 327, 331, 335, 339, 343, 395, 395,
470
395, 395, 395, 147, 395, 395, 144, 103, 395, 395,
471
395, 395, 395, 395, 395, 98, 93, 395, 395, 395,
472
395, 57, 395, 395, 97
475
static const flex_int16_t yy_def[266] =
477
264, 1, 265, 265, 264, 264, 264, 264, 264, 264,
478
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
479
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
480
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
481
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
482
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
483
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
484
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
485
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
486
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
488
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
489
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
490
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
491
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
492
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
493
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
494
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
495
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
496
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
497
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
499
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
500
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
501
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
502
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
503
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
504
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
505
264, 264, 264, 0, 264
508
static const flex_int16_t yy_nxt[461] =
510
6, 7, 8, 9, 10, 11, 11, 12, 13, 14,
511
15, 16, 15, 15, 17, 18, 6, 19, 20, 21,
512
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
513
32, 6, 33, 34, 35, 36, 37, 38, 39, 40,
514
41, 42, 43, 44, 45, 46, 47, 6, 48, 49,
515
50, 51, 6, 6, 52, 6, 6, 6, 6, 6,
516
6, 6, 6, 53, 54, 56, 56, 59, 59, 59,
517
59, 60, 60, 60, 60, 61, 67, 62, 63, 63,
518
63, 63, 68, 61, 64, 62, 63, 63, 63, 63,
519
81, 70, 64, 84, 57, 57, 71, 55, 86, 87,
521
72, 73, 74, 75, 64, 263, 99, 118, 137, 85,
522
138, 97, 64, 76, 88, 89, 82, 91, 98, 119,
523
92, 159, 93, 77, 160, 146, 161, 162, 94, 149,
524
95, 100, 147, 141, 139, 148, 150, 96, 104, 201,
525
206, 262, 207, 105, 106, 202, 261, 107, 108, 109,
526
110, 260, 111, 112, 259, 216, 142, 209, 113, 258,
527
114, 143, 115, 257, 210, 144, 217, 116, 256, 59,
528
59, 59, 59, 117, 120, 163, 255, 121, 254, 122,
529
123, 124, 253, 125, 228, 229, 126, 127, 128, 129,
530
252, 251, 250, 130, 249, 163, 248, 247, 131, 246,
532
132, 245, 133, 134, 244, 135, 136, 151, 243, 152,
533
242, 153, 60, 60, 60, 60, 154, 155, 164, 165,
534
165, 165, 165, 241, 240, 166, 239, 230, 156, 167,
535
167, 167, 167, 157, 220, 168, 219, 61, 164, 62,
536
63, 63, 63, 63, 218, 166, 64, 169, 215, 169,
537
214, 170, 170, 170, 170, 168, 213, 212, 221, 211,
538
222, 208, 223, 205, 204, 203, 64, 224, 225, 231,
539
200, 231, 199, 232, 232, 232, 232, 198, 197, 226,
540
196, 233, 195, 233, 227, 234, 234, 234, 234, 165,
541
165, 165, 165, 194, 235, 166, 235, 193, 236, 236,
543
236, 236, 167, 167, 167, 167, 192, 237, 168, 237,
544
191, 238, 238, 238, 238, 166, 170, 170, 170, 170,
545
170, 170, 170, 170, 232, 232, 232, 232, 168, 232,
546
232, 232, 232, 234, 234, 234, 234, 234, 234, 234,
547
234, 236, 236, 236, 236, 236, 236, 236, 236, 238,
548
238, 238, 238, 238, 238, 238, 238, 190, 189, 188,
549
187, 186, 185, 184, 183, 182, 181, 180, 179, 178,
550
177, 176, 175, 174, 173, 172, 171, 58, 158, 145,
551
140, 103, 102, 101, 90, 83, 80, 79, 78, 69,
552
66, 65, 58, 264, 5, 264, 264, 264, 264, 264,
554
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
555
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
556
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
557
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
558
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
559
264, 264, 264, 264, 264, 264, 264, 264, 264, 264
562
static const flex_int16_t yy_chk[461] =
564
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
565
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
566
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
567
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
568
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
569
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
570
1, 1, 1, 1, 1, 3, 4, 12, 12, 12,
571
12, 14, 14, 14, 14, 15, 20, 15, 15, 15,
572
15, 15, 20, 16, 15, 16, 16, 16, 16, 16,
573
29, 24, 16, 31, 3, 4, 24, 265, 33, 33,
575
24, 24, 24, 24, 15, 262, 37, 43, 45, 31,
576
45, 36, 16, 24, 33, 33, 29, 35, 36, 43,
577
35, 53, 35, 24, 53, 49, 54, 54, 35, 50,
578
35, 37, 49, 47, 45, 49, 50, 35, 42, 118,
579
132, 257, 132, 42, 42, 118, 256, 42, 42, 42,
580
42, 248, 42, 42, 247, 147, 47, 135, 42, 244,
581
42, 47, 42, 225, 135, 47, 147, 42, 220, 59,
582
59, 59, 59, 42, 44, 59, 219, 44, 218, 44,
583
44, 44, 217, 44, 161, 161, 44, 44, 44, 44,
584
216, 215, 208, 44, 205, 59, 204, 203, 44, 198,
586
44, 195, 44, 44, 185, 44, 44, 51, 184, 51,
587
183, 51, 60, 60, 60, 60, 51, 51, 60, 61,
588
61, 61, 61, 180, 177, 61, 174, 162, 51, 62,
589
62, 62, 62, 51, 155, 62, 150, 63, 60, 63,
590
63, 63, 63, 63, 149, 61, 63, 64, 146, 64,
591
145, 64, 64, 64, 64, 62, 144, 143, 160, 136,
592
160, 134, 160, 130, 127, 119, 63, 160, 160, 163,
593
117, 163, 114, 163, 163, 163, 163, 113, 112, 160,
594
109, 164, 108, 164, 160, 164, 164, 164, 164, 165,
595
165, 165, 165, 105, 166, 165, 166, 102, 166, 166,
597
166, 166, 167, 167, 167, 167, 100, 168, 167, 168,
598
97, 168, 168, 168, 168, 165, 169, 169, 169, 169,
599
170, 170, 170, 170, 231, 231, 231, 231, 167, 232,
600
232, 232, 232, 233, 233, 233, 233, 234, 234, 234,
601
234, 235, 235, 235, 235, 236, 236, 236, 236, 237,
602
237, 237, 237, 238, 238, 238, 238, 96, 95, 93,
603
91, 90, 89, 88, 87, 86, 83, 82, 81, 79,
604
77, 76, 74, 73, 71, 68, 67, 58, 52, 48,
605
46, 41, 39, 38, 34, 30, 27, 26, 25, 21,
606
18, 17, 8, 5, 264, 264, 264, 264, 264, 264,
608
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
609
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
610
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
611
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
612
264, 264, 264, 264, 264, 264, 264, 264, 264, 264,
613
264, 264, 264, 264, 264, 264, 264, 264, 264, 264
616
static yy_state_type yy_last_accepting_state;
617
static char *yy_last_accepting_cpos;
619
extern int yy_flex_debug;
620
int yy_flex_debug = 0;
622
/* The intent behind this definition is that it'll catch
623
* any uses of REJECT which flex missed.
625
#define REJECT reject_used_but_not_detected
626
#define yymore() yymore_used_but_not_detected
628
#define YY_RESTORE_YY_MORE_OFFSET
630
#line 1 "QuantityParser.l"
631
#line 2 "QuantityParser.l"
632
/***************************************************************************
633
* Copyright (c) 2013 Jürgen Riegel <juergen.riegel@web.de> *
635
* This library is free software; you can redistribute it and/or *
636
* modify it under the terms of the GNU Library General Public *
637
* License as published by the Free Software Foundation; either *
638
* version 2 of the License, or (at your option) any later version. *
640
* This library is distributed in the hope that it will be useful, *
641
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
642
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
643
* GNU Library General Public License for more details. *
645
* You should have received a copy of the GNU Library General Public *
646
* License along with this library; see the file COPYING.LIB. If not, *
647
* write to the Free Software Foundation, Inc., 59 Temple Place, *
648
* Suite 330, Boston, MA 02111-1307, USA *
650
***************************************************************************/
652
/* Lexer for the FreeCAD Units language */
654
/* use this file to generate the file 'QuantityLexer.c' using the program flex
655
* the command for this operation is:
656
* flex --outfile=QuantityLexer.c QuantityParser.l
657
* (flex for Windows is available here:
658
* https://sourceforge.net/projects/winflexbison/
659
* (you must then change 'flex' to 'win_flex' in the command)) */
661
/* This disables inclusion of unistd.h, which is not available under Visual C++
662
* on Win32. The C++ scanner uses STL streams instead. */
663
#define YY_NO_UNISTD_H
665
#line 664 "QuantityLexer.c"
666
/*** Flex Declarations and Options ***/
667
/* the manual says "somewhat more optimized" */
668
/* no support for include files is planned */
670
#line 669 "QuantityLexer.c"
675
#ifndef YY_NO_UNISTD_H
676
/* Special case for "unistd.h", since it is non-ANSI. We include it way
677
* down here because we want the user's section 1 to have been scanned first.
678
* The user has a chance to override it with an option.
684
#define YY_EXTRA_TYPE void *
687
static int yy_init_globals ( void );
689
/* Accessor methods to globals.
690
These are made visible to non-reentrant scanners for convenience. */
692
int yylex_destroy ( void );
694
int yyget_debug ( void );
696
void yyset_debug ( int debug_flag );
698
YY_EXTRA_TYPE yyget_extra ( void );
700
void yyset_extra ( YY_EXTRA_TYPE user_defined );
702
FILE *yyget_in ( void );
704
void yyset_in ( FILE * _in_str );
706
FILE *yyget_out ( void );
708
void yyset_out ( FILE * _out_str );
710
int yyget_leng ( void );
712
char *yyget_text ( void );
714
int yyget_lineno ( void );
716
void yyset_lineno ( int _line_number );
718
/* Macros after this point can all be overridden by user definitions in
722
#ifndef YY_SKIP_YYWRAP
724
extern "C" int yywrap ( void );
726
extern int yywrap ( void );
735
static void yy_flex_strncpy ( char *, const char *, int );
739
static int yy_flex_strlen ( const char * );
744
static int yyinput ( void );
746
static int input ( void );
751
/* Amount of stuff to slurp up with each read. */
752
#ifndef YY_READ_BUF_SIZE
754
/* On IA-64, the buffer size is 16k, not 8k */
755
#define YY_READ_BUF_SIZE 16384
757
#define YY_READ_BUF_SIZE 8192
761
/* Copy whatever the last rule matched to the standard output. */
763
/* This used to be an fputs(), but since the string might contain NUL's,
764
* we now use fwrite().
766
#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
769
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
770
* is returned in "result".
773
#define YY_INPUT(buf,result,max_size) \
774
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
778
for ( n = 0; n < max_size && \
779
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
782
buf[n++] = (char) c; \
783
if ( c == EOF && ferror( yyin ) ) \
784
YY_FATAL_ERROR( "input in flex scanner failed" ); \
790
while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
792
if( errno != EINTR) \
794
YY_FATAL_ERROR( "input in flex scanner failed" ); \
805
/* No semi-colon after return; correct usage is to write "yyterminate();" -
806
* we don't want an extra ';' after the "return" because that will cause
807
* some compilers to complain about unreachable statements.
810
#define yyterminate() return YY_NULL
813
/* Number of entries by which start-condition stack grows. */
814
#ifndef YY_START_STACK_INCR
815
#define YY_START_STACK_INCR 25
818
/* Report a fatal error. */
819
#ifndef YY_FATAL_ERROR
820
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
823
/* end tables serialization structures and prototypes */
825
/* Default declaration of generated scanner - a define so the user can
826
* easily add parameters.
829
#define YY_DECL_IS_OURS 1
831
extern int yylex (void);
833
#define YY_DECL int yylex (void)
836
/* Code executed at the beginning of each rule, after yytext and yyleng
839
#ifndef YY_USER_ACTION
840
#define YY_USER_ACTION
843
/* Code executed at the end of each rule. */
845
#define YY_BREAK /*LINTED*/break;
848
#define YY_RULE_SETUP \
851
/** The main scanner function which does all the work.
855
yy_state_type yy_current_state;
868
(yy_start) = 1; /* first start state */
876
if ( ! YY_CURRENT_BUFFER ) {
877
yyensure_buffer_stack ();
878
YY_CURRENT_BUFFER_LVALUE =
879
yy_create_buffer( yyin, YY_BUF_SIZE );
882
yy_load_buffer_state( );
886
#line 56 "QuantityParser.l"
889
#line 888 "QuantityLexer.c"
891
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
893
yy_cp = (yy_c_buf_p);
895
/* Support of yytext. */
896
*yy_cp = (yy_hold_char);
898
/* yy_bp points to the position in yy_ch_buf of the start of
903
yy_current_state = (yy_start);
907
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
908
if ( yy_accept[yy_current_state] )
910
(yy_last_accepting_state) = yy_current_state;
911
(yy_last_accepting_cpos) = yy_cp;
913
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
915
yy_current_state = (int) yy_def[yy_current_state];
916
if ( yy_current_state >= 265 )
917
yy_c = yy_meta[yy_c];
919
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
922
while ( yy_current_state != 264 );
923
yy_cp = (yy_last_accepting_cpos);
924
yy_current_state = (yy_last_accepting_state);
927
yy_act = yy_accept[yy_current_state];
931
do_action: /* This label is used only to access EOF actions. */
934
{ /* beginning of action switch */
935
case 0: /* must back up */
936
/* undo the effects of YY_DO_BEFORE_ACTION */
937
*yy_cp = (yy_hold_char);
938
yy_cp = (yy_last_accepting_cpos);
939
yy_current_state = (yy_last_accepting_state);
944
#line 58 "QuantityParser.l"
949
#line 59 "QuantityParser.l"
954
#line 60 "QuantityParser.l"
959
#line 63 "QuantityParser.l"
963
/* rule 5 can match eol */
965
#line 64 "QuantityParser.l"
970
#line 66 "QuantityParser.l"
975
#line 68 "QuantityParser.l"
980
#line 69 "QuantityParser.l"
985
#line 71 "QuantityParser.l"
986
yylval = Quantity::NanoMetre; return UNIT; // nano meter
990
#line 72 "QuantityParser.l"
991
yylval = Quantity::MicroMetre; return UNIT; // micro meter
995
#line 73 "QuantityParser.l"
996
yylval = Quantity::MicroMetre; return UNIT; // micro meter (greek micro in UTF8)
1000
#line 74 "QuantityParser.l"
1001
yylval = Quantity::MilliMetre; return UNIT; // milli meter (internal standard length)
1005
#line 75 "QuantityParser.l"
1006
yylval = Quantity::CentiMetre; return UNIT; // centi meter
1010
#line 76 "QuantityParser.l"
1011
yylval = Quantity::DeciMetre; return UNIT; // deci meter
1015
#line 77 "QuantityParser.l"
1016
yylval = Quantity::Metre; return UNIT; // Metre
1020
#line 78 "QuantityParser.l"
1021
yylval = Quantity::KiloMetre; return UNIT; // kilo meter
1025
#line 80 "QuantityParser.l"
1026
yylval = Quantity::Liter; return UNIT; // Liter (dm^3)
1030
#line 81 "QuantityParser.l"
1031
yylval = Quantity::MilliLiter; return UNIT; // milli Liter
1035
#line 83 "QuantityParser.l"
1036
yylval = Quantity::Hertz; return UNIT; // Hertz
1040
#line 84 "QuantityParser.l"
1041
yylval = Quantity::KiloHertz; return UNIT; // kilo Hertz
1045
#line 85 "QuantityParser.l"
1046
yylval = Quantity::MegaHertz; return UNIT; // mega Hertz
1050
#line 86 "QuantityParser.l"
1051
yylval = Quantity::GigaHertz; return UNIT; // giga Hertz
1055
#line 87 "QuantityParser.l"
1056
yylval = Quantity::TeraHertz; return UNIT; // tera Hertz
1060
#line 89 "QuantityParser.l"
1061
yylval = Quantity::MicroGram; return UNIT; // micro gram
1065
#line 90 "QuantityParser.l"
1066
yylval = Quantity::MicroGram; return UNIT; // micro gram
1070
#line 91 "QuantityParser.l"
1071
yylval = Quantity::MilliGram; return UNIT; // milli gram
1075
#line 92 "QuantityParser.l"
1076
yylval = Quantity::Gram; return UNIT; // gram
1080
#line 93 "QuantityParser.l"
1081
yylval = Quantity::KiloGram; return UNIT; // kilo gram (internal standard for mass)
1085
#line 94 "QuantityParser.l"
1086
yylval = Quantity::Ton; return UNIT; // Metric Tonne
1090
#line 96 "QuantityParser.l"
1091
yylval = Quantity::Second; return UNIT; // second (internal standard time)
1095
#line 97 "QuantityParser.l"
1096
yylval = Quantity::Minute; return UNIT; // minute
1100
#line 98 "QuantityParser.l"
1101
yylval = Quantity::Hour; return UNIT; // hour
1105
#line 100 "QuantityParser.l"
1106
yylval = Quantity::Ampere; return UNIT; // Ampere (internal standard electric current)
1110
#line 101 "QuantityParser.l"
1111
yylval = Quantity::MilliAmpere; return UNIT; // milli Ampere
1115
#line 102 "QuantityParser.l"
1116
yylval = Quantity::KiloAmpere; return UNIT; // kilo Ampere
1120
#line 103 "QuantityParser.l"
1121
yylval = Quantity::MegaAmpere; return UNIT; // mega Ampere
1125
#line 105 "QuantityParser.l"
1126
yylval = Quantity::Kelvin; return UNIT; // Kelvin (internal standard thermodynamic temperature)
1130
#line 106 "QuantityParser.l"
1131
yylval = Quantity::MilliKelvin; return UNIT; // milli Kelvin
1135
#line 107 "QuantityParser.l"
1136
yylval = Quantity::MicroKelvin; return UNIT; // micro Kelvin
1140
#line 108 "QuantityParser.l"
1141
yylval = Quantity::MicroKelvin; return UNIT; // micro Kelvin
1145
#line 110 "QuantityParser.l"
1146
yylval = Quantity::Mole; return UNIT; // Mole (internal standard amount of substance)
1150
#line 111 "QuantityParser.l"
1151
yylval = Quantity::MilliMole; return UNIT; // Milli Mole
1155
#line 113 "QuantityParser.l"
1156
yylval = Quantity::Candela; return UNIT; // Candela (internal standard luminous intensity)
1160
#line 115 "QuantityParser.l"
1161
yylval = Quantity::Inch; return UNIT; // inch
1165
#line 116 "QuantityParser.l"
1166
yylval = Quantity::Inch; return UNIT; // inch
1170
#line 117 "QuantityParser.l"
1171
yylval = Quantity::Foot; return UNIT; // foot
1175
#line 118 "QuantityParser.l"
1176
yylval = Quantity::Foot; return UNIT; // foot
1180
#line 119 "QuantityParser.l"
1181
yylval = Quantity::Thou; return UNIT; // thou (in/1000)
1185
#line 120 "QuantityParser.l"
1186
yylval = Quantity::Thou; return UNIT; // mil (the thou in US)
1190
#line 121 "QuantityParser.l"
1191
yylval = Quantity::Yard; return UNIT; // yard
1195
#line 122 "QuantityParser.l"
1196
yylval = Quantity::Mile; return UNIT; // mile
1200
#line 124 "QuantityParser.l"
1201
yylval = Quantity::MilePerHour; return UNIT; // mile per hour
1205
#line 125 "QuantityParser.l"
1206
yylval = Quantity::SquareFoot; return UNIT; // square foot
1210
#line 126 "QuantityParser.l"
1211
yylval = Quantity::CubicFoot; return UNIT; // cubic foot
1215
#line 128 "QuantityParser.l"
1216
yylval = Quantity::Pound; return UNIT; // pound
1220
#line 129 "QuantityParser.l"
1221
yylval = Quantity::Pound; return UNIT; // pound
1225
#line 130 "QuantityParser.l"
1226
yylval = Quantity::Ounce; return UNIT; // ounce
1230
#line 131 "QuantityParser.l"
1231
yylval = Quantity::Stone; return UNIT; // Stone
1235
#line 132 "QuantityParser.l"
1236
yylval = Quantity::Hundredweights; return UNIT; // hundredweights
1240
#line 134 "QuantityParser.l"
1241
yylval = Quantity::PoundForce; return UNIT; // pound
1245
#line 136 "QuantityParser.l"
1246
yylval = Quantity::Newton; return UNIT; // Newton (kg*m/s^2)
1250
#line 137 "QuantityParser.l"
1251
yylval = Quantity::MilliNewton; return UNIT; // milli Newton
1255
#line 138 "QuantityParser.l"
1256
yylval = Quantity::KiloNewton; return UNIT; // kilo Newton
1260
#line 139 "QuantityParser.l"
1261
yylval = Quantity::MegaNewton; return UNIT; // mega Newton
1265
#line 141 "QuantityParser.l"
1266
yylval = Quantity::Pascal; return UNIT; // Pascal (kg/m/s^2 or N/m^2)
1270
#line 142 "QuantityParser.l"
1271
yylval = Quantity::KiloPascal; return UNIT; // kilo Pascal
1275
#line 143 "QuantityParser.l"
1276
yylval = Quantity::MegaPascal; return UNIT; // mega Pascal
1280
#line 144 "QuantityParser.l"
1281
yylval = Quantity::GigaPascal; return UNIT; // giga Pascal
1285
#line 146 "QuantityParser.l"
1286
yylval = Quantity::Bar; return UNIT; // 1 bar = 100 kPa
1290
#line 147 "QuantityParser.l"
1291
yylval = Quantity::MilliBar; return UNIT; // milli Bar
1295
#line 149 "QuantityParser.l"
1296
yylval = Quantity::Torr; return UNIT; // portion of Pascal ( 101325/760 )
1300
#line 150 "QuantityParser.l"
1301
yylval = Quantity::mTorr; return UNIT; //
1305
#line 151 "QuantityParser.l"
1306
yylval = Quantity::yTorr; return UNIT; //
1310
#line 152 "QuantityParser.l"
1311
yylval = Quantity::yTorr; return UNIT; //
1315
#line 154 "QuantityParser.l"
1316
yylval = Quantity::PSI; return UNIT; // pounds/in^2
1320
#line 155 "QuantityParser.l"
1321
yylval = Quantity::KSI; return UNIT; // 1000 x pounds/in^2
1325
#line 156 "QuantityParser.l"
1326
yylval = Quantity::MPSI; return UNIT; // 1000 ksi
1330
#line 158 "QuantityParser.l"
1331
yylval = Quantity::Watt; return UNIT; // Watt (kg*m^2/s^3)
1335
#line 159 "QuantityParser.l"
1336
yylval = Quantity::MilliWatt; return UNIT; // milli Watt
1340
#line 160 "QuantityParser.l"
1341
yylval = Quantity::KiloWatt; return UNIT; // kilo Watt
1345
#line 161 "QuantityParser.l"
1346
yylval = Quantity::VoltAmpere; return UNIT; // VoltAmpere (kg*m^2/s^3)
1350
#line 163 "QuantityParser.l"
1351
yylval = Quantity::Volt; return UNIT; // Volt (kg*m^2/A/s^3)
1355
#line 164 "QuantityParser.l"
1356
yylval = Quantity::KiloVolt; return UNIT; // kilo Volt
1360
#line 165 "QuantityParser.l"
1361
yylval = Quantity::MilliVolt; return UNIT; // milli Volt
1365
#line 167 "QuantityParser.l"
1366
yylval = Quantity::MegaSiemens; return UNIT; // mega Siemens
1370
#line 168 "QuantityParser.l"
1371
yylval = Quantity::KiloSiemens; return UNIT; // kilo Siemens
1375
#line 169 "QuantityParser.l"
1376
yylval = Quantity::Siemens; return UNIT; // Siemens (A^2*s^3/kg/m^2)
1380
#line 170 "QuantityParser.l"
1381
yylval = Quantity::MilliSiemens; return UNIT; // milli Siemens
1385
#line 171 "QuantityParser.l"
1386
yylval = Quantity::MicroSiemens; return UNIT; // micro Siemens
1390
#line 172 "QuantityParser.l"
1391
yylval = Quantity::MicroSiemens; return UNIT; // micro Siemens
1395
#line 174 "QuantityParser.l"
1396
yylval = Quantity::Ohm; return UNIT; // Ohm (kg*m^2/A^2/s^3)
1400
#line 175 "QuantityParser.l"
1401
yylval = Quantity::KiloOhm; return UNIT; // kilo Ohm
1405
#line 176 "QuantityParser.l"
1406
yylval = Quantity::MegaOhm; return UNIT; // mega Ohm
1410
#line 178 "QuantityParser.l"
1411
yylval = Quantity::Coulomb; return UNIT; // Coulomb (A*s)
1415
#line 180 "QuantityParser.l"
1416
yylval = Quantity::Tesla; return UNIT; // Tesla (kg/s^2/A)
1420
#line 181 "QuantityParser.l"
1421
yylval = Quantity::Gauss; return UNIT; // Gauss (1 G = 1e-4 T)
1425
#line 183 "QuantityParser.l"
1426
yylval = Quantity::Weber; return UNIT; // Weber (kg*m^2/s^2/A)
1430
#line 185 "QuantityParser.l"
1431
yylval = Quantity::Farad; return UNIT; // Farad (s^4*A^2/m^2/kg)
1435
#line 186 "QuantityParser.l"
1436
yylval = Quantity::MilliFarad; return UNIT; // milli Farad
1440
#line 187 "QuantityParser.l"
1441
yylval = Quantity::MicroFarad; return UNIT; // micro Farad
1445
#line 188 "QuantityParser.l"
1446
yylval = Quantity::MicroFarad; return UNIT; // micro Farad
1450
#line 189 "QuantityParser.l"
1451
yylval = Quantity::NanoFarad; return UNIT; // nano Farad
1455
#line 190 "QuantityParser.l"
1456
yylval = Quantity::PicoFarad; return UNIT; // pico Farad
1460
#line 192 "QuantityParser.l"
1461
yylval = Quantity::Henry; return UNIT; // Henry (kg*m^2/s^2/A^2)
1465
#line 193 "QuantityParser.l"
1466
yylval = Quantity::MilliHenry; return UNIT; // milli Henry
1470
#line 194 "QuantityParser.l"
1471
yylval = Quantity::MicroHenry; return UNIT; // micro Henry
1475
#line 195 "QuantityParser.l"
1476
yylval = Quantity::MicroHenry; return UNIT; // micro Henry
1480
#line 196 "QuantityParser.l"
1481
yylval = Quantity::NanoHenry; return UNIT; // nano Henry
1485
#line 198 "QuantityParser.l"
1486
yylval = Quantity::Joule; return UNIT; // Joule (kg*m^2/s^2)
1490
#line 199 "QuantityParser.l"
1491
yylval = Quantity::MilliJoule; return UNIT; // milli Joule
1495
#line 200 "QuantityParser.l"
1496
yylval = Quantity::KiloJoule; return UNIT; // kilo Joule
1500
#line 201 "QuantityParser.l"
1501
yylval = Quantity::NewtonMeter; return UNIT; // N*m = Joule
1505
#line 202 "QuantityParser.l"
1506
yylval = Quantity::VoltAmpereSecond; return UNIT; // V*A*s = Joule
1510
#line 203 "QuantityParser.l"
1511
yylval = Quantity::WattSecond; return UNIT; //
1515
#line 204 "QuantityParser.l"
1516
yylval = Quantity::WattSecond; return UNIT; // W*s = Joule
1520
#line 205 "QuantityParser.l"
1521
yylval = Quantity::KiloWattHour; return UNIT; // 1 kWh = 3.6e6 J
1525
#line 206 "QuantityParser.l"
1526
yylval = Quantity::ElectronVolt; return UNIT; // 1 eV = 1.602176634e-19 J
1530
#line 207 "QuantityParser.l"
1531
yylval = Quantity::KiloElectronVolt; return UNIT;
1535
#line 208 "QuantityParser.l"
1536
yylval = Quantity::MegaElectronVolt; return UNIT;
1540
#line 209 "QuantityParser.l"
1541
yylval = Quantity::Calorie; return UNIT; // 1 cal = 4.1868 J
1545
#line 210 "QuantityParser.l"
1546
yylval = Quantity::KiloCalorie; return UNIT;
1550
#line 212 "QuantityParser.l"
1551
yylval = Quantity::Degree; return UNIT; // degree (internal standard angle)
1555
#line 213 "QuantityParser.l"
1556
yylval = Quantity::Degree; return UNIT; // degree (internal standard angle)
1560
#line 214 "QuantityParser.l"
1561
yylval = Quantity::Radian; return UNIT; // radian
1565
#line 215 "QuantityParser.l"
1566
yylval = Quantity::Gon; return UNIT; // gon
1570
#line 216 "QuantityParser.l"
1571
yylval = Quantity::AngMinute; return UNIT; // minute(Angular)
1575
#line 217 "QuantityParser.l"
1576
yylval = Quantity::AngMinute; return UNIT; // minute(Angular)
1580
#line 218 "QuantityParser.l"
1581
yylval = Quantity::AngSecond; return UNIT; // second(Angular)
1585
#line 219 "QuantityParser.l"
1586
yylval = Quantity::AngSecond; return UNIT; // second(Angular)
1590
#line 221 "QuantityParser.l"
1591
yylval = Quantity(1.0); return ONE;
1595
#line 222 "QuantityParser.l"
1596
{ yylval = Quantity(num_change(yytext,'.',','));return NUM; }
1600
#line 223 "QuantityParser.l"
1601
{ yylval = Quantity(num_change(yytext,'.',','));return NUM; }
1605
#line 224 "QuantityParser.l"
1606
{ yylval = Quantity(num_change(yytext,',','.'));return NUM; }
1610
#line 225 "QuantityParser.l"
1611
{ yylval = Quantity(num_change(yytext,',','.'));return NUM; }
1615
#line 228 "QuantityParser.l"
1616
{yylval = Quantity(M_PI) ; return NUM;} // constant pi
1620
#line 229 "QuantityParser.l"
1621
{yylval = Quantity(M_E) ; return NUM;} // constant e
1625
#line 231 "QuantityParser.l"
1630
#line 232 "QuantityParser.l"
1635
#line 233 "QuantityParser.l"
1640
#line 234 "QuantityParser.l"
1645
#line 235 "QuantityParser.l"
1650
#line 236 "QuantityParser.l"
1655
#line 237 "QuantityParser.l"
1660
#line 238 "QuantityParser.l"
1665
#line 239 "QuantityParser.l"
1670
#line 240 "QuantityParser.l"
1675
#line 241 "QuantityParser.l"
1680
#line 242 "QuantityParser.l"
1685
#line 243 "QuantityParser.l"
1690
#line 244 "QuantityParser.l"
1695
#line 245 "QuantityParser.l"
1700
#line 246 "QuantityParser.l"
1705
#line 248 "QuantityParser.l"
1710
#line 249 "QuantityParser.l"
1713
#line 1712 "QuantityLexer.c"
1714
case YY_STATE_EOF(INITIAL):
1715
case YY_STATE_EOF(C_COMMENT):
1718
case YY_END_OF_BUFFER:
1720
/* Amount of text matched not including the EOB char. */
1721
int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1723
/* Undo the effects of YY_DO_BEFORE_ACTION. */
1724
*yy_cp = (yy_hold_char);
1725
YY_RESTORE_YY_MORE_OFFSET
1727
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1729
/* We're scanning a new file or input source. It's
1730
* possible that this happened because the user
1731
* just pointed yyin at a new source and called
1732
* yylex(). If so, then we have to assure
1733
* consistency between YY_CURRENT_BUFFER and our
1734
* globals. Here is the right place to do so, because
1735
* this is the first action (other than possibly a
1736
* back-up) that will match for the new input source.
1738
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1739
YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1740
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1743
/* Note that here we test for yy_c_buf_p "<=" to the position
1744
* of the first EOB in the buffer, since yy_c_buf_p will
1745
* already have been incremented past the NUL character
1746
* (since all states make transitions on EOB to the
1747
* end-of-buffer state). Contrast this with the test
1750
if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1751
{ /* This was really a NUL. */
1752
yy_state_type yy_next_state;
1754
(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1756
yy_current_state = yy_get_previous_state( );
1758
/* Okay, we're now positioned to make the NUL
1759
* transition. We couldn't have
1760
* yy_get_previous_state() go ahead and do it
1761
* for us because it doesn't know how to deal
1762
* with the possibility of jamming (and we don't
1763
* want to build jamming into it because then it
1764
* will run more slowly).
1767
yy_next_state = yy_try_NUL_trans( yy_current_state );
1769
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1771
if ( yy_next_state )
1773
/* Consume the NUL. */
1774
yy_cp = ++(yy_c_buf_p);
1775
yy_current_state = yy_next_state;
1781
yy_cp = (yy_last_accepting_cpos);
1782
yy_current_state = (yy_last_accepting_state);
1783
goto yy_find_action;
1787
else switch ( yy_get_next_buffer( ) )
1789
case EOB_ACT_END_OF_FILE:
1791
(yy_did_buffer_switch_on_eof) = 0;
1795
/* Note: because we've taken care in
1796
* yy_get_next_buffer() to have set up
1797
* yytext, we can now set up
1798
* yy_c_buf_p so that if some total
1799
* hoser (like flex itself) wants to
1800
* call the scanner after we return the
1801
* YY_NULL, it'll still work - another
1802
* YY_NULL will get returned.
1804
(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1806
yy_act = YY_STATE_EOF(YY_START);
1812
if ( ! (yy_did_buffer_switch_on_eof) )
1818
case EOB_ACT_CONTINUE_SCAN:
1820
(yytext_ptr) + yy_amount_of_matched_text;
1822
yy_current_state = yy_get_previous_state( );
1824
yy_cp = (yy_c_buf_p);
1825
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1828
case EOB_ACT_LAST_MATCH:
1830
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1832
yy_current_state = yy_get_previous_state( );
1834
yy_cp = (yy_c_buf_p);
1835
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1836
goto yy_find_action;
1843
"fatal flex scanner internal error--no action found" );
1844
} /* end of action switch */
1845
} /* end of scanning one token */
1846
} /* end of user's declarations */
1849
/* yy_get_next_buffer - try to read in a new buffer
1851
* Returns a code representing an action:
1852
* EOB_ACT_LAST_MATCH -
1853
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1854
* EOB_ACT_END_OF_FILE - end of file
1856
static int yy_get_next_buffer (void)
1858
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1859
char *source = (yytext_ptr);
1860
int number_to_move, i;
1863
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1865
"fatal flex scanner internal error--end of buffer missed" );
1867
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1868
{ /* Don't try to fill the buffer, so this is an EOF. */
1869
if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1871
/* We matched a single character, the EOB, so
1872
* treat this as a final EOF.
1874
return EOB_ACT_END_OF_FILE;
1879
/* We matched some text prior to the EOB, first
1882
return EOB_ACT_LAST_MATCH;
1886
/* Try to read more data. */
1888
/* First move last chars to start of buffer. */
1889
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
1891
for ( i = 0; i < number_to_move; ++i )
1892
*(dest++) = *(source++);
1894
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1895
/* don't do the read, it's not guaranteed to return an EOF,
1898
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1903
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1905
while ( num_to_read <= 0 )
1906
{ /* Not enough room in the buffer - grow it. */
1908
/* just a shorter name for the current buffer */
1909
YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1911
int yy_c_buf_p_offset =
1912
(int) ((yy_c_buf_p) - b->yy_ch_buf);
1914
if ( b->yy_is_our_buffer )
1916
int new_size = b->yy_buf_size * 2;
1918
if ( new_size <= 0 )
1919
b->yy_buf_size += b->yy_buf_size / 8;
1921
b->yy_buf_size *= 2;
1923
b->yy_ch_buf = (char *)
1924
/* Include room in for 2 EOB chars. */
1925
yyrealloc( (void *) b->yy_ch_buf,
1926
(yy_size_t) (b->yy_buf_size + 2) );
1929
/* Can't grow it, we don't own it. */
1930
b->yy_ch_buf = NULL;
1932
if ( ! b->yy_ch_buf )
1934
"fatal error - scanner input buffer overflow" );
1936
(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1938
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1943
if ( num_to_read > YY_READ_BUF_SIZE )
1944
num_to_read = YY_READ_BUF_SIZE;
1946
/* Read in more data. */
1947
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1948
(yy_n_chars), num_to_read );
1950
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1953
if ( (yy_n_chars) == 0 )
1955
if ( number_to_move == YY_MORE_ADJ )
1957
ret_val = EOB_ACT_END_OF_FILE;
1963
ret_val = EOB_ACT_LAST_MATCH;
1964
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1965
YY_BUFFER_EOF_PENDING;
1970
ret_val = EOB_ACT_CONTINUE_SCAN;
1972
if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1973
/* Extend the array by 50%, plus the number we really need. */
1974
int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1975
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1976
(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
1977
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1978
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1979
/* "- 2" to take care of EOB's */
1980
YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1983
(yy_n_chars) += number_to_move;
1984
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1985
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1987
(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1992
/* yy_get_previous_state - get the state just before the EOB char was reached */
1994
static yy_state_type yy_get_previous_state (void)
1996
yy_state_type yy_current_state;
1999
yy_current_state = (yy_start);
2001
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
2003
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2004
if ( yy_accept[yy_current_state] )
2006
(yy_last_accepting_state) = yy_current_state;
2007
(yy_last_accepting_cpos) = yy_cp;
2009
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2011
yy_current_state = (int) yy_def[yy_current_state];
2012
if ( yy_current_state >= 265 )
2013
yy_c = yy_meta[yy_c];
2015
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
2018
return yy_current_state;
2021
/* yy_try_NUL_trans - try to make a transition on the NUL character
2024
* next_state = yy_try_NUL_trans( current_state );
2026
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
2029
char *yy_cp = (yy_c_buf_p);
2032
if ( yy_accept[yy_current_state] )
2034
(yy_last_accepting_state) = yy_current_state;
2035
(yy_last_accepting_cpos) = yy_cp;
2037
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2039
yy_current_state = (int) yy_def[yy_current_state];
2040
if ( yy_current_state >= 265 )
2041
yy_c = yy_meta[yy_c];
2043
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
2044
yy_is_jam = (yy_current_state == 264);
2046
return yy_is_jam ? 0 : yy_current_state;
2055
static int yyinput (void)
2057
static int input (void)
2063
*(yy_c_buf_p) = (yy_hold_char);
2065
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
2067
/* yy_c_buf_p now points to the character we want to return.
2068
* If this occurs *before* the EOB characters, then it's a
2069
* valid NUL; if not, then we've hit the end of the buffer.
2071
if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2072
/* This was really a NUL. */
2073
*(yy_c_buf_p) = '\0';
2076
{ /* need more input */
2077
int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
2080
switch ( yy_get_next_buffer( ) )
2082
case EOB_ACT_LAST_MATCH:
2083
/* This happens because yy_g_n_b()
2084
* sees that we've accumulated a
2085
* token and flags that we need to
2086
* try matching the token before
2087
* proceeding. But for input(),
2088
* there's no matching to consider.
2089
* So convert the EOB_ACT_LAST_MATCH
2090
* to EOB_ACT_END_OF_FILE.
2093
/* Reset buffer status. */
2098
case EOB_ACT_END_OF_FILE:
2103
if ( ! (yy_did_buffer_switch_on_eof) )
2112
case EOB_ACT_CONTINUE_SCAN:
2113
(yy_c_buf_p) = (yytext_ptr) + offset;
2119
c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
2120
*(yy_c_buf_p) = '\0'; /* preserve yytext */
2121
(yy_hold_char) = *++(yy_c_buf_p);
2125
#endif /* ifndef YY_NO_INPUT */
2127
/** Immediately switch to a different input stream.
2128
* @param input_file A readable stream.
2130
* @note This function does not reset the start condition to @c INITIAL .
2132
void yyrestart (FILE * input_file )
2135
if ( ! YY_CURRENT_BUFFER ){
2136
yyensure_buffer_stack ();
2137
YY_CURRENT_BUFFER_LVALUE =
2138
yy_create_buffer( yyin, YY_BUF_SIZE );
2141
yy_init_buffer( YY_CURRENT_BUFFER, input_file );
2142
yy_load_buffer_state( );
2145
/** Switch to a different input buffer.
2146
* @param new_buffer The new input buffer.
2149
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
2152
/* TODO: We should be able to replace this entire function body
2154
* yypop_buffer_state();
2155
* yypush_buffer_state(new_buffer);
2157
yyensure_buffer_stack ();
2158
if ( YY_CURRENT_BUFFER == new_buffer )
2161
if ( YY_CURRENT_BUFFER )
2163
/* Flush out information for old buffer. */
2164
*(yy_c_buf_p) = (yy_hold_char);
2165
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2166
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2169
YY_CURRENT_BUFFER_LVALUE = new_buffer;
2170
yy_load_buffer_state( );
2172
/* We don't actually know whether we did this switch during
2173
* EOF (yywrap()) processing, but the only time this flag
2174
* is looked at is after yywrap() is called, so it's safe
2175
* to go ahead and always set it.
2177
(yy_did_buffer_switch_on_eof) = 1;
2180
static void yy_load_buffer_state (void)
2182
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2183
(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2184
yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2185
(yy_hold_char) = *(yy_c_buf_p);
2188
/** Allocate and initialize an input buffer state.
2189
* @param file A readable stream.
2190
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2192
* @return the allocated buffer state.
2194
YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
2198
b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
2200
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2202
b->yy_buf_size = size;
2204
/* yy_ch_buf has to be 2 characters longer than the size given because
2205
* we need to put in 2 end-of-buffer characters.
2207
b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
2208
if ( ! b->yy_ch_buf )
2209
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2211
b->yy_is_our_buffer = 1;
2213
yy_init_buffer( b, file );
2218
/** Destroy the buffer.
2219
* @param b a buffer created with yy_create_buffer()
2222
void yy_delete_buffer (YY_BUFFER_STATE b )
2228
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2229
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2231
if ( b->yy_is_our_buffer )
2232
yyfree( (void *) b->yy_ch_buf );
2234
yyfree( (void *) b );
2237
/* Initializes or reinitializes a buffer.
2238
* This function is sometimes called more than once on the same buffer,
2239
* such as during a yyrestart() or at EOF.
2241
static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
2246
yy_flush_buffer( b );
2248
b->yy_input_file = file;
2249
b->yy_fill_buffer = 1;
2251
/* If b is the current buffer, then yy_init_buffer was _probably_
2252
* called from yyrestart() or through yy_get_next_buffer.
2253
* In that case, we don't want to reset the lineno or column.
2255
if (b != YY_CURRENT_BUFFER){
2256
b->yy_bs_lineno = 1;
2257
b->yy_bs_column = 0;
2260
b->yy_is_interactive = 0;
2265
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2266
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2269
void yy_flush_buffer (YY_BUFFER_STATE b )
2276
/* We always need two end-of-buffer characters. The first causes
2277
* a transition to the end-of-buffer state. The second causes
2278
* a jam in that state.
2280
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2281
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2283
b->yy_buf_pos = &b->yy_ch_buf[0];
2286
b->yy_buffer_status = YY_BUFFER_NEW;
2288
if ( b == YY_CURRENT_BUFFER )
2289
yy_load_buffer_state( );
2292
/** Pushes the new state onto the stack. The new state becomes
2293
* the current state. This function will allocate the stack
2295
* @param new_buffer The new state.
2298
void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
2300
if (new_buffer == NULL)
2303
yyensure_buffer_stack();
2305
/* This block is copied from yy_switch_to_buffer. */
2306
if ( YY_CURRENT_BUFFER )
2308
/* Flush out information for old buffer. */
2309
*(yy_c_buf_p) = (yy_hold_char);
2310
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2311
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2314
/* Only push if top exists. Otherwise, replace top. */
2315
if (YY_CURRENT_BUFFER)
2316
(yy_buffer_stack_top)++;
2317
YY_CURRENT_BUFFER_LVALUE = new_buffer;
2319
/* copied from yy_switch_to_buffer. */
2320
yy_load_buffer_state( );
2321
(yy_did_buffer_switch_on_eof) = 1;
2324
/** Removes and deletes the top of the stack, if present.
2325
* The next element becomes the new top.
2328
void yypop_buffer_state (void)
2330
if (!YY_CURRENT_BUFFER)
2333
yy_delete_buffer(YY_CURRENT_BUFFER );
2334
YY_CURRENT_BUFFER_LVALUE = NULL;
2335
if ((yy_buffer_stack_top) > 0)
2336
--(yy_buffer_stack_top);
2338
if (YY_CURRENT_BUFFER) {
2339
yy_load_buffer_state( );
2340
(yy_did_buffer_switch_on_eof) = 1;
2344
/* Allocates the stack if it does not exist.
2345
* Guarantees space for at least one push.
2347
static void yyensure_buffer_stack (void)
2349
yy_size_t num_to_alloc;
2351
if (!(yy_buffer_stack)) {
2353
/* First allocation is just for 2 elements, since we don't know if this
2354
* scanner will even need a stack. We use 2 instead of 1 to avoid an
2355
* immediate realloc on the next call.
2357
num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
2358
(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2359
(num_to_alloc * sizeof(struct yy_buffer_state*)
2361
if ( ! (yy_buffer_stack) )
2362
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2364
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2366
(yy_buffer_stack_max) = num_to_alloc;
2367
(yy_buffer_stack_top) = 0;
2371
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2373
/* Increase the buffer to prepare for a possible push. */
2374
yy_size_t grow_size = 8 /* arbitrary grow size */;
2376
num_to_alloc = (yy_buffer_stack_max) + grow_size;
2377
(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2379
num_to_alloc * sizeof(struct yy_buffer_state*)
2381
if ( ! (yy_buffer_stack) )
2382
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2384
/* zero only the new slots.*/
2385
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2386
(yy_buffer_stack_max) = num_to_alloc;
2390
/** Setup the input buffer state to scan directly from a user-specified character buffer.
2391
* @param base the character buffer
2392
* @param size the size in bytes of the character buffer
2394
* @return the newly allocated buffer state object.
2396
YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
2401
base[size-2] != YY_END_OF_BUFFER_CHAR ||
2402
base[size-1] != YY_END_OF_BUFFER_CHAR )
2403
/* They forgot to leave room for the EOB's. */
2406
b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
2408
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2410
b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
2411
b->yy_buf_pos = b->yy_ch_buf = base;
2412
b->yy_is_our_buffer = 0;
2413
b->yy_input_file = NULL;
2414
b->yy_n_chars = b->yy_buf_size;
2415
b->yy_is_interactive = 0;
2417
b->yy_fill_buffer = 0;
2418
b->yy_buffer_status = YY_BUFFER_NEW;
2420
yy_switch_to_buffer( b );
2425
/** Setup the input buffer state to scan a string. The next call to yylex() will
2426
* scan from a @e copy of @a str.
2427
* @param yystr a NUL-terminated string to scan
2429
* @return the newly allocated buffer state object.
2430
* @note If you want to scan bytes that may contain NUL values, then use
2431
* yy_scan_bytes() instead.
2433
YY_BUFFER_STATE yy_scan_string (const char * yystr )
2436
return yy_scan_bytes( yystr, (int) strlen(yystr) );
2439
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2440
* scan from a @e copy of @a bytes.
2441
* @param yybytes the byte buffer to scan
2442
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2444
* @return the newly allocated buffer state object.
2446
YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
2453
/* Get memory for full buffer, including space for trailing EOB's. */
2454
n = (yy_size_t) (_yybytes_len + 2);
2455
buf = (char *) yyalloc( n );
2457
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2459
for ( i = 0; i < _yybytes_len; ++i )
2460
buf[i] = yybytes[i];
2462
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2464
b = yy_scan_buffer( buf, n );
2466
YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2468
/* It's okay to grow etc. this buffer, and we should throw it
2469
* away when we're done.
2471
b->yy_is_our_buffer = 1;
2476
#ifndef YY_EXIT_FAILURE
2477
#define YY_EXIT_FAILURE 2
2480
static void yynoreturn yy_fatal_error (const char* msg )
2482
fprintf( stderr, "%s\n", msg );
2483
exit( YY_EXIT_FAILURE );
2486
/* Redefine yyless() so it works in section 3 code. */
2492
/* Undo effects of setting up yytext. */ \
2493
int yyless_macro_arg = (n); \
2494
YY_LESS_LINENO(yyless_macro_arg);\
2495
yytext[yyleng] = (yy_hold_char); \
2496
(yy_c_buf_p) = yytext + yyless_macro_arg; \
2497
(yy_hold_char) = *(yy_c_buf_p); \
2498
*(yy_c_buf_p) = '\0'; \
2499
yyleng = yyless_macro_arg; \
2503
/* Accessor methods (get/set functions) to struct members. */
2505
/** Get the current line number.
2508
int yyget_lineno (void)
2514
/** Get the input stream.
2517
FILE *yyget_in (void)
2522
/** Get the output stream.
2525
FILE *yyget_out (void)
2530
/** Get the length of the current token.
2533
int yyget_leng (void)
2538
/** Get the current token.
2542
char *yyget_text (void)
2547
/** Set the current line number.
2548
* @param _line_number line number
2551
void yyset_lineno (int _line_number )
2554
yylineno = _line_number;
2557
/** Set the input stream. This does not discard the current
2559
* @param _in_str A readable stream.
2561
* @see yy_switch_to_buffer
2563
void yyset_in (FILE * _in_str )
2568
void yyset_out (FILE * _out_str )
2573
int yyget_debug (void)
2575
return yy_flex_debug;
2578
void yyset_debug (int _bdebug )
2580
yy_flex_debug = _bdebug ;
2583
static int yy_init_globals (void)
2585
/* Initialization is the same as for the non-reentrant scanner.
2586
* This function is called from yylex_destroy(), so don't allocate here.
2589
(yy_buffer_stack) = NULL;
2590
(yy_buffer_stack_top) = 0;
2591
(yy_buffer_stack_max) = 0;
2592
(yy_c_buf_p) = NULL;
2596
/* Defined in main.c */
2605
/* For future reference: Set errno on error, since we are called by
2611
/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2612
int yylex_destroy (void)
2615
/* Pop the buffer stack, destroying each element. */
2616
while(YY_CURRENT_BUFFER){
2617
yy_delete_buffer( YY_CURRENT_BUFFER );
2618
YY_CURRENT_BUFFER_LVALUE = NULL;
2619
yypop_buffer_state();
2622
/* Destroy the stack itself. */
2623
yyfree((yy_buffer_stack) );
2624
(yy_buffer_stack) = NULL;
2626
/* Reset the globals. This is important in a non-reentrant scanner so the next time
2627
* yylex() is called, initialization will occur. */
2634
* Internal utility routines.
2638
static void yy_flex_strncpy (char* s1, const char * s2, int n )
2642
for ( i = 0; i < n; ++i )
2647
#ifdef YY_NEED_STRLEN
2648
static int yy_flex_strlen (const char * s )
2651
for ( n = 0; s[n]; ++n )
2658
void *yyalloc (yy_size_t size )
2660
return malloc(size);
2663
void *yyrealloc (void * ptr, yy_size_t size )
2666
/* The cast to (char *) in the following accommodates both
2667
* implementations that use char* generic pointers, and those
2668
* that use void* generic pointers. It works with the latter
2669
* because both ANSI C and C++ allow castless assignment from
2670
* any pointer type to void*, and deal with argument conversions
2671
* as though doing an assignment.
2673
return realloc(ptr, size);
2676
void yyfree (void * ptr )
2678
free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2681
#define YYTABLES_NAME "yytables"
2683
#line 249 "QuantityParser.l"