From 6ff95b9043e7d2bf4501a0aeee3b884780290578 Mon Sep 17 00:00:00 2001 From: "Wolfgang E. Sanyer" Date: Sat, 7 May 2016 13:40:35 -0400 Subject: [PATCH] Bug fix for ID#0002453 Note that the version of Bison and Flex used to generate the two .c files are newer than in the last commit from 2010. Also,for anyine working on tbis in the future, dont forget to run flex and bison on the .l and .y files respectively. --- src/Base/QuantityLexer.c | 422 ++++++++-------- src/Base/QuantityParser.c | 978 ++++++++++++++++---------------------- src/Base/QuantityParser.h | 83 ++++ src/Base/QuantityParser.l | 2 + 4 files changed, 725 insertions(+), 760 deletions(-) create mode 100644 src/Base/QuantityParser.h diff --git a/src/Base/QuantityLexer.c b/src/Base/QuantityLexer.c index 49473e26619d..298e2faf5e23 100644 --- a/src/Base/QuantityLexer.c +++ b/src/Base/QuantityLexer.c @@ -9,7 +9,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_SUBMINOR_VERSION 39 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -54,7 +54,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -85,6 +84,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -109,10 +110,7 @@ typedef unsigned int flex_uint32_t; #endif /* Returned upon end-of-file. */ -# ifdef YY_NULL -# undef YY_NULL -# define YY_NULL 0 -# endif +#define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, @@ -156,7 +154,12 @@ typedef unsigned int flex_uint32_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif -extern int yyleng; +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern yy_size_t yyleng; extern FILE *yyin, *yyout; @@ -165,6 +168,7 @@ extern FILE *yyin, *yyout; #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -182,11 +186,6 @@ extern FILE *yyin, *yyout; #define unput(c) yyunput( c, (yytext_ptr) ) -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -204,7 +203,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - int yy_n_chars; + yy_size_t yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -274,8 +273,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int yyleng; +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +yy_size_t yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; @@ -303,7 +302,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); void *yyalloc (yy_size_t ); void *yyrealloc (void *,yy_size_t ); @@ -333,7 +332,7 @@ void yyfree (void * ); #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) -#define yywrap(n) 1 +#define yywrap() 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -364,8 +363,8 @@ static void yy_fatal_error (yyconst char msg[] ); *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 97 -#define YY_END_OF_BUFFER 98 +#define YY_NUM_RULES 99 +#define YY_END_OF_BUFFER 100 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -373,27 +372,28 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[179] = +static yyconst flex_int16_t yy_accept[189] = { 0, - 0, 0, 0, 0, 98, 96, 4, 5, 38, 40, - 6, 7, 76, 27, 96, 96, 67, 31, 96, 51, - 96, 96, 96, 65, 1, 96, 96, 96, 79, 96, - 21, 26, 96, 96, 17, 15, 96, 96, 96, 96, - 24, 23, 96, 96, 96, 96, 3, 97, 2, 5, - 77, 76, 76, 0, 70, 0, 30, 53, 0, 68, - 55, 0, 66, 71, 0, 0, 0, 0, 36, 13, - 0, 0, 0, 14, 0, 39, 0, 37, 29, 52, - 0, 22, 16, 0, 45, 0, 28, 32, 54, 0, - 20, 44, 12, 0, 9, 47, 78, 0, 0, 0, - - 0, 0, 48, 0, 0, 34, 0, 18, 10, 43, - 72, 0, 0, 77, 0, 76, 0, 0, 76, 58, - 57, 0, 69, 86, 0, 0, 0, 84, 49, 73, - 85, 75, 56, 64, 50, 46, 88, 0, 42, 25, - 87, 35, 90, 63, 74, 91, 0, 93, 0, 0, - 33, 0, 19, 11, 8, 0, 77, 0, 76, 59, - 80, 81, 82, 0, 0, 92, 95, 94, 41, 0, - 0, 83, 89, 60, 61, 0, 62, 0 + 0, 0, 0, 0, 100, 98, 4, 5, 38, 40, + 6, 98, 7, 98, 76, 27, 98, 98, 67, 31, + 98, 51, 98, 98, 98, 65, 1, 98, 98, 98, + 81, 98, 21, 26, 98, 98, 17, 15, 98, 98, + 98, 98, 24, 23, 98, 98, 98, 98, 3, 99, + 2, 5, 79, 77, 78, 76, 76, 0, 70, 0, + 30, 53, 0, 68, 55, 0, 66, 71, 0, 0, + 0, 0, 36, 13, 0, 0, 0, 14, 0, 39, + 0, 37, 29, 52, 0, 22, 16, 0, 45, 0, + 28, 32, 54, 0, 20, 44, 12, 0, 9, 47, + + 80, 0, 0, 0, 0, 0, 48, 0, 0, 34, + 0, 18, 10, 43, 72, 0, 0, 0, 0, 78, + 0, 76, 0, 0, 76, 58, 57, 0, 69, 88, + 0, 0, 0, 86, 49, 73, 87, 75, 56, 64, + 50, 46, 90, 0, 42, 25, 89, 35, 92, 63, + 74, 93, 0, 95, 0, 0, 33, 0, 19, 11, + 8, 0, 79, 0, 77, 0, 78, 0, 76, 59, + 82, 83, 84, 0, 0, 94, 97, 96, 41, 0, + 0, 85, 91, 60, 61, 0, 62, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -438,92 +438,99 @@ static yyconst flex_int32_t yy_meta[59] = 1, 1, 1, 1, 1, 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[180] = +static yyconst flex_int16_t yy_base[190] = { 0, - 0, 0, 56, 57, 261, 262, 262, 257, 262, 262, - 262, 262, 53, 262, 234, 235, 262, 262, 53, 217, - 227, 213, 239, 207, 262, 41, 41, 29, 202, 204, - 208, 262, 208, 74, 49, 84, 208, 195, 56, 217, - 63, 65, 92, 213, 22, 191, 262, 262, 262, 240, - 117, 124, 132, 147, 262, 213, 262, 262, 212, 262, - 262, 195, 193, 262, 192, 195, 199, 206, 262, 262, - 188, 186, 197, 262, 188, 262, 189, 262, 262, 262, - 200, 262, 262, 191, 40, 192, 262, 262, 262, 184, - 262, 64, 262, 79, 262, 262, 262, 176, 187, 170, - - 160, 147, 262, 147, 144, 262, 143, 262, 262, 262, - 262, 127, 122, 157, 166, 170, 182, 186, 193, 262, - 262, 127, 262, 262, 120, 123, 122, 262, 262, 262, - 262, 262, 262, 262, 262, 262, 143, 108, 262, 262, - 262, 262, 262, 262, 262, 116, 101, 103, 85, 80, - 262, 81, 262, 262, 262, 197, 201, 205, 209, 262, - 262, 262, 109, 106, 70, 262, 262, 262, 262, 68, - 50, 262, 262, 262, 262, 47, 262, 262, 81 + 0, 0, 56, 57, 309, 310, 310, 305, 310, 310, + 310, 50, 310, 54, 61, 310, 282, 283, 310, 310, + 64, 265, 275, 261, 287, 255, 310, 46, 48, 49, + 250, 252, 256, 310, 256, 76, 53, 86, 256, 243, + 63, 265, 70, 67, 95, 261, 57, 239, 310, 310, + 310, 288, 120, 127, 134, 144, 158, 167, 310, 261, + 310, 310, 260, 310, 310, 243, 241, 310, 240, 243, + 247, 254, 310, 310, 236, 234, 245, 310, 236, 310, + 237, 310, 310, 310, 248, 310, 310, 239, 84, 240, + 310, 310, 310, 232, 310, 63, 310, 88, 310, 310, + + 310, 224, 235, 239, 196, 191, 310, 186, 181, 310, + 179, 310, 310, 310, 310, 162, 166, 176, 187, 192, + 201, 205, 217, 151, 221, 310, 310, 166, 310, 310, + 161, 154, 152, 310, 310, 310, 310, 310, 310, 310, + 310, 310, 180, 139, 310, 310, 310, 310, 310, 310, + 310, 137, 112, 118, 104, 105, 310, 107, 310, 310, + 310, 228, 232, 236, 240, 244, 248, 252, 256, 310, + 310, 310, 130, 131, 91, 310, 310, 310, 310, 84, + 80, 310, 310, 310, 310, 36, 310, 310, 69 } ; -static yyconst flex_int16_t yy_def[180] = +static yyconst flex_int16_t yy_def[190] = { 0, - 178, 1, 179, 179, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 0, 178 + 188, 1, 189, 189, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 0, 188 } ; -static yyconst flex_int16_t yy_nxt[321] = +static yyconst flex_int16_t yy_nxt[369] = { 0, - 6, 7, 8, 9, 10, 11, 11, 6, 12, 6, - 13, 13, 13, 13, 14, 15, 6, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 6, 26, 6, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 6, 40, 41, 42, 43, 6, 6, - 44, 6, 6, 6, 6, 6, 45, 46, 48, 48, - 51, 73, 52, 53, 53, 53, 53, 57, 74, 54, - 65, 66, 69, 135, 58, 59, 111, 112, 85, 136, - 70, 47, 71, 49, 49, 54, 67, 68, 79, 72, - 86, 177, 97, 104, 176, 80, 81, 98, 87, 101, - - 105, 99, 139, 88, 140, 89, 102, 90, 82, 103, - 141, 106, 175, 83, 174, 107, 173, 142, 91, 84, - 92, 172, 171, 93, 170, 94, 108, 114, 114, 114, - 114, 109, 169, 115, 116, 116, 116, 116, 168, 51, - 117, 52, 53, 53, 53, 53, 151, 167, 54, 115, - 152, 166, 165, 118, 164, 118, 117, 119, 119, 119, - 119, 153, 163, 162, 54, 161, 154, 114, 114, 114, - 114, 160, 156, 115, 156, 155, 157, 157, 157, 157, - 116, 116, 116, 116, 150, 149, 117, 148, 158, 115, - 158, 147, 159, 159, 159, 159, 119, 119, 119, 119, - - 146, 145, 117, 119, 119, 119, 119, 157, 157, 157, - 157, 157, 157, 157, 157, 159, 159, 159, 159, 159, - 159, 159, 159, 144, 143, 138, 137, 134, 133, 132, - 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, - 121, 120, 50, 113, 110, 100, 96, 95, 78, 77, - 76, 75, 64, 63, 62, 61, 60, 56, 55, 50, - 178, 5, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178 + 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, + 15, 15, 15, 15, 16, 17, 6, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 6, 28, 6, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 6, 42, 43, 44, 45, 6, 6, + 46, 6, 6, 6, 6, 6, 47, 48, 50, 50, + 53, 53, 53, 53, 54, 54, 54, 54, 55, 49, + 56, 57, 57, 57, 57, 69, 70, 58, 61, 73, + 187, 77, 89, 51, 51, 62, 63, 74, 78, 75, + 83, 71, 72, 58, 90, 108, 76, 84, 85, 101, + + 91, 145, 109, 146, 102, 92, 105, 93, 103, 94, + 86, 115, 116, 106, 110, 87, 107, 141, 111, 147, + 95, 88, 96, 142, 186, 97, 148, 98, 185, 112, + 53, 53, 53, 53, 113, 184, 118, 54, 54, 54, + 54, 183, 182, 119, 120, 120, 120, 120, 181, 180, + 121, 179, 118, 178, 122, 122, 122, 122, 177, 119, + 123, 125, 125, 125, 125, 55, 121, 56, 57, 57, + 57, 57, 176, 124, 58, 124, 123, 125, 125, 125, + 125, 157, 162, 175, 162, 158, 163, 163, 163, 163, + 58, 174, 173, 164, 172, 164, 159, 165, 165, 165, + + 165, 160, 120, 120, 120, 120, 171, 166, 121, 166, + 170, 167, 167, 167, 167, 122, 122, 122, 122, 161, + 156, 123, 155, 168, 121, 168, 154, 169, 169, 169, + 169, 125, 125, 125, 125, 153, 152, 123, 163, 163, + 163, 163, 163, 163, 163, 163, 165, 165, 165, 165, + 165, 165, 165, 165, 167, 167, 167, 167, 167, 167, + 167, 167, 169, 169, 169, 169, 169, 169, 169, 169, + 151, 150, 149, 144, 143, 140, 139, 138, 137, 136, + 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, + 52, 117, 114, 104, 100, 99, 82, 81, 80, 79, + + 68, 67, 66, 65, 64, 60, 59, 52, 188, 5, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188 } ; -static yyconst flex_int16_t yy_chk[321] = +static yyconst flex_int16_t yy_chk[369] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -531,35 +538,40 @@ static yyconst flex_int16_t yy_chk[321] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, - 13, 28, 13, 13, 13, 13, 13, 19, 28, 13, - 26, 26, 27, 85, 19, 19, 45, 45, 35, 85, - 27, 179, 27, 3, 4, 13, 26, 26, 34, 27, - 35, 176, 39, 42, 171, 34, 34, 39, 36, 41, - - 42, 39, 92, 36, 92, 36, 41, 36, 34, 41, - 94, 43, 170, 34, 165, 43, 164, 94, 36, 34, - 36, 163, 152, 36, 150, 36, 43, 51, 51, 51, - 51, 43, 149, 51, 52, 52, 52, 52, 148, 53, - 52, 53, 53, 53, 53, 53, 112, 147, 53, 51, - 112, 146, 138, 54, 137, 54, 52, 54, 54, 54, - 54, 112, 127, 126, 53, 125, 112, 114, 114, 114, - 114, 122, 115, 114, 115, 113, 115, 115, 115, 115, - 116, 116, 116, 116, 107, 105, 116, 104, 117, 114, - 117, 102, 117, 117, 117, 117, 118, 118, 118, 118, - - 101, 100, 116, 119, 119, 119, 119, 156, 156, 156, - 156, 157, 157, 157, 157, 158, 158, 158, 158, 159, - 159, 159, 159, 99, 98, 90, 86, 84, 81, 77, - 75, 73, 72, 71, 68, 67, 66, 65, 63, 62, - 59, 56, 50, 46, 44, 40, 38, 37, 33, 31, - 30, 29, 24, 23, 22, 21, 20, 16, 15, 8, - 5, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178 + 12, 12, 12, 12, 14, 14, 14, 14, 15, 189, + 15, 15, 15, 15, 15, 28, 28, 15, 21, 29, + 186, 30, 37, 3, 4, 21, 21, 29, 30, 29, + 36, 28, 28, 15, 37, 44, 29, 36, 36, 41, + + 38, 96, 44, 96, 41, 38, 43, 38, 41, 38, + 36, 47, 47, 43, 45, 36, 43, 89, 45, 98, + 38, 36, 38, 89, 181, 38, 98, 38, 180, 45, + 53, 53, 53, 53, 45, 175, 53, 54, 54, 54, + 54, 174, 173, 54, 55, 55, 55, 55, 158, 156, + 55, 155, 53, 154, 56, 56, 56, 56, 153, 54, + 56, 124, 124, 124, 124, 57, 55, 57, 57, 57, + 57, 57, 152, 58, 57, 58, 56, 58, 58, 58, + 58, 116, 118, 144, 118, 116, 118, 118, 118, 118, + 57, 143, 133, 119, 132, 119, 116, 119, 119, 119, + + 119, 116, 120, 120, 120, 120, 131, 121, 120, 121, + 128, 121, 121, 121, 121, 122, 122, 122, 122, 117, + 111, 122, 109, 123, 120, 123, 108, 123, 123, 123, + 123, 125, 125, 125, 125, 106, 105, 122, 162, 162, + 162, 162, 163, 163, 163, 163, 164, 164, 164, 164, + 165, 165, 165, 165, 166, 166, 166, 166, 167, 167, + 167, 167, 168, 168, 168, 168, 169, 169, 169, 169, + 104, 103, 102, 94, 90, 88, 85, 81, 79, 77, + 76, 75, 72, 71, 70, 69, 67, 66, 63, 60, + 52, 48, 46, 42, 40, 39, 35, 33, 32, 31, + + 26, 25, 24, 23, 22, 18, 17, 8, 5, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188 } ; static yy_state_type yy_last_accepting_state; @@ -590,7 +602,7 @@ char *yytext; /* the manual says "somewhat more optimized" */ /* no support for include files is planned */ -#line 591 "QuantityLexer.c" +#line 606 "QuantityLexer.c" #define INITIAL 0 #define C_COMMENT 1 @@ -630,7 +642,7 @@ FILE *yyget_out (void ); void yyset_out (FILE * out_str ); -int yyget_leng (void ); +yy_size_t yyget_leng (void ); char *yyget_text (void ); @@ -678,7 +690,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -689,7 +701,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - unsigned int n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -771,11 +783,6 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 31 "QuantityParser.l" - - -#line 775 "QuantityLexer.c" - if ( !(yy_init) ) { (yy_init) = 1; @@ -802,6 +809,12 @@ YY_DECL yy_load_buffer_state( ); } + { +#line 31 "QuantityParser.l" + + +#line 817 "QuantityLexer.c" + while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); @@ -818,7 +831,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -827,13 +840,13 @@ YY_DECL while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 179 ) + if ( yy_current_state >= 189 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_current_state != 178 ); + while ( yy_current_state != 188 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); @@ -1237,109 +1250,119 @@ YY_RULE_SETUP case 77: YY_RULE_SETUP #line 134 "QuantityParser.l" -{ yylval = num_change(yytext,',','.');return NUM; } +{ yylval = num_change(yytext,'.',',');return NUM; } YY_BREAK case 78: YY_RULE_SETUP -#line 137 "QuantityParser.l" -{yylval = M_PI ; return NUM;} // constant pi +#line 135 "QuantityParser.l" +{ yylval = num_change(yytext,',','.');return NUM; } YY_BREAK case 79: YY_RULE_SETUP -#line 138 "QuantityParser.l" -{yylval = M_E ; return NUM;} // constant e +#line 136 "QuantityParser.l" +{ yylval = num_change(yytext,',','.');return NUM; } YY_BREAK case 80: YY_RULE_SETUP -#line 140 "QuantityParser.l" -return ACOS; +#line 139 "QuantityParser.l" +{yylval = M_PI ; return NUM;} // constant pi YY_BREAK case 81: YY_RULE_SETUP -#line 141 "QuantityParser.l" -return ASIN; +#line 140 "QuantityParser.l" +{yylval = M_E ; return NUM;} // constant e YY_BREAK case 82: YY_RULE_SETUP #line 142 "QuantityParser.l" -return ATAN; +return ACOS; YY_BREAK case 83: YY_RULE_SETUP #line 143 "QuantityParser.l" -return ATAN2; +return ASIN; YY_BREAK case 84: YY_RULE_SETUP #line 144 "QuantityParser.l" -return COS; +return ATAN; YY_BREAK case 85: YY_RULE_SETUP #line 145 "QuantityParser.l" -return EXP; +return ATAN2; YY_BREAK case 86: YY_RULE_SETUP #line 146 "QuantityParser.l" -return ABS; +return COS; YY_BREAK case 87: YY_RULE_SETUP #line 147 "QuantityParser.l" -return MOD; +return EXP; YY_BREAK case 88: YY_RULE_SETUP #line 148 "QuantityParser.l" -return LOG; +return ABS; YY_BREAK case 89: YY_RULE_SETUP #line 149 "QuantityParser.l" -return LOG10; +return MOD; YY_BREAK case 90: YY_RULE_SETUP #line 150 "QuantityParser.l" -return POW; +return LOG; YY_BREAK case 91: YY_RULE_SETUP #line 151 "QuantityParser.l" -return SIN; +return LOG10; YY_BREAK case 92: YY_RULE_SETUP #line 152 "QuantityParser.l" -return SINH; +return POW; YY_BREAK case 93: YY_RULE_SETUP #line 153 "QuantityParser.l" -return TAN; +return SIN; YY_BREAK case 94: YY_RULE_SETUP #line 154 "QuantityParser.l" -return TANH; +return SINH; YY_BREAK case 95: YY_RULE_SETUP #line 155 "QuantityParser.l" -return SQRT; +return TAN; YY_BREAK case 96: YY_RULE_SETUP +#line 156 "QuantityParser.l" +return TANH; + YY_BREAK +case 97: +YY_RULE_SETUP #line 157 "QuantityParser.l" +return SQRT; + YY_BREAK +case 98: +YY_RULE_SETUP +#line 159 "QuantityParser.l" return *yytext; YY_BREAK -case 97: +case 99: YY_RULE_SETUP -#line 158 "QuantityParser.l" +#line 160 "QuantityParser.l" ECHO; YY_BREAK -#line 1340 "QuantityLexer.c" +#line 1366 "QuantityLexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(C_COMMENT): yyterminate(); @@ -1472,6 +1495,7 @@ case YY_STATE_EOF(C_COMMENT): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1527,21 +1551,21 @@ static int yy_get_next_buffer (void) else { - int num_to_read = + yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { - int new_size = b->yy_buf_size * 2; + yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1572,7 +1596,7 @@ static int yy_get_next_buffer (void) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (size_t) num_to_read ); + (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } @@ -1633,7 +1657,7 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 179 ) + if ( yy_current_state >= 189 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1661,13 +1685,13 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 179 ) + if ( yy_current_state >= 189 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 178); + yy_is_jam = (yy_current_state == 188); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_INPUT @@ -1694,7 +1718,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1966,7 +1990,7 @@ void yypop_buffer_state (void) */ static void yyensure_buffer_stack (void) { - int num_to_alloc; + yy_size_t num_to_alloc; if (!(yy_buffer_stack)) { @@ -2058,17 +2082,17 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - int i; + yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -2150,7 +2174,7 @@ FILE *yyget_out (void) /** Get the length of the current token. * */ -int yyget_leng (void) +yy_size_t yyget_leng (void) { return yyleng; } @@ -2298,4 +2322,4 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 158 "QuantityParser.l" +#line 160 "QuantityParser.l" diff --git a/src/Base/QuantityParser.c b/src/Base/QuantityParser.c index 5198db10f114..fa454a3328ca 100644 --- a/src/Base/QuantityParser.c +++ b/src/Base/QuantityParser.c @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.7.12-4996. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,7 +26,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.7.12-4996" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -62,8 +62,7 @@ /* Copy the first part of user declarations. */ -/* Line 371 of yacc.c */ -#line 6 "QuantityParser.y" +#line 6 "QuantityParser.y" /* yacc.c:339 */ #define YYSTYPE Quantity #define yyparse Quantity_yyparse @@ -76,14 +75,13 @@ #endif -/* Line 371 of yacc.c */ -#line 81 "QuantityParser.c" +#line 79 "QuantityParser.c" /* yacc.c:339 */ -# ifndef YY_NULL +# ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr +# define YY_NULLPTR nullptr # else -# define YY_NULL 0 +# define YY_NULLPTR 0 # endif # endif @@ -95,8 +93,11 @@ # define YYERROR_VERBOSE 0 #endif - -/* Enabling traces. */ +/* In a future release of Bison, this section will be replaced + by #include "QuantityParser.h". */ +#ifndef YY_YY_QUANTITYPARSER_H_INCLUDED +# define YY_YY_QUANTITYPARSER_H_INCLUDED +/* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif @@ -104,65 +105,51 @@ extern int yydebug; #endif -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - UNIT = 258, - NUM = 259, - MINUSSIGN = 260, - ACOS = 261, - ASIN = 262, - ATAN = 263, - ATAN2 = 264, - COS = 265, - EXP = 266, - ABS = 267, - MOD = 268, - LOG = 269, - LOG10 = 270, - POW = 271, - SIN = 272, - SINH = 273, - TAN = 274, - TANH = 275, - SQRT = 276, - NEG = 277 - }; + enum yytokentype + { + UNIT = 258, + NUM = 259, + MINUSSIGN = 260, + ACOS = 261, + ASIN = 262, + ATAN = 263, + ATAN2 = 264, + COS = 265, + EXP = 266, + ABS = 267, + MOD = 268, + LOG = 269, + LOG10 = 270, + POW = 271, + SIN = 272, + SINH = 273, + TAN = 274, + TANH = 275, + SQRT = 276, + NEG = 277 + }; #endif - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif + extern YYSTYPE yylval; -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - +#endif /* !YY_YY_QUANTITYPARSER_H_INCLUDED */ /* Copy the second part of user declarations. */ -/* Line 390 of yacc.c */ -#line 166 "QuantityParser.c" +#line 153 "QuantityParser.c" /* yacc.c:358 */ #ifdef short # undef short @@ -176,11 +163,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -200,8 +184,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -223,11 +206,30 @@ typedef short int yytype_int16; # endif #endif -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if (! defined __GNUC__ || __GNUC__ < 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) -# define __attribute__(Spec) /* empty */ +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif @@ -238,25 +240,26 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(N) (N) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") #else -static int -YYID (yyi) - int yyi; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return yyi; -} +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif + #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -274,8 +277,7 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS @@ -287,8 +289,8 @@ YYID (yyi) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -304,7 +306,7 @@ YYID (yyi) # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 @@ -312,15 +314,13 @@ YYID (yyi) # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -330,7 +330,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -355,16 +355,16 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) #endif @@ -383,7 +383,7 @@ union yyalloc for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ - while (YYID (0)) + while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -399,17 +399,19 @@ union yyalloc #define YYNNTS 5 /* YYNRULES -- Number of rules. */ #define YYNRULES 33 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 88 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 277 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -443,35 +445,7 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 4, 6, 8, 10, 13, 15, 19, - 23, 27, 31, 34, 38, 42, 47, 52, 57, 62, - 67, 72, 77, 82, 87, 92, 97, 102, 107, 109, - 113, 117, 121, 125 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 30, 0, -1, -1, 31, -1, 32, -1, 33, -1, - 33, 33, -1, 4, -1, 31, 22, 31, -1, 31, - 5, 31, -1, 31, 23, 31, -1, 31, 24, 31, - -1, 5, 31, -1, 31, 26, 31, -1, 27, 31, - 28, -1, 6, 27, 31, 28, -1, 7, 27, 31, - 28, -1, 8, 27, 31, 28, -1, 12, 27, 31, - 28, -1, 11, 27, 31, 28, -1, 14, 27, 31, - 28, -1, 15, 27, 31, 28, -1, 17, 27, 31, - 28, -1, 18, 27, 31, 28, -1, 19, 27, 31, - 28, -1, 20, 27, 31, 28, -1, 21, 27, 31, - 28, -1, 10, 27, 31, 28, -1, 3, -1, 32, - 23, 32, -1, 32, 24, 32, -1, 32, 26, 31, - -1, 27, 32, 28, -1, 31, 32, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { 0, 33, 33, 34, 35, 36, 37, 39, 40, 41, @@ -489,13 +463,13 @@ static const char *const yytname[] = "$end", "error", "$undefined", "UNIT", "NUM", "MINUSSIGN", "ACOS", "ASIN", "ATAN", "ATAN2", "COS", "EXP", "ABS", "MOD", "LOG", "LOG10", "POW", "SIN", "SINH", "TAN", "TANH", "SQRT", "'+'", "'*'", "'/'", "NEG", - "'^'", "'('", "')'", "$accept", "input", "num", "unit", "quantity", YY_NULL + "'^'", "'('", "')'", "$accept", "input", "num", "unit", "quantity", YY_NULLPTR }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, @@ -504,27 +478,34 @@ static const yytype_uint16 yytoknum[] = }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 29, 30, 30, 30, 30, 30, 31, 31, 31, - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, - 31, 31, 31, 31, 31, 31, 31, 31, 32, 32, - 32, 32, 32, 33 -}; +#define YYPACT_NINF -19 -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-19))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = { - 0, 2, 0, 1, 1, 1, 2, 1, 3, 3, - 3, 3, 2, 3, 3, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 1, 3, - 3, 3, 3, 2 + 49, -19, -19, 67, -15, -9, 13, 14, 22, 31, + 35, 38, 56, 63, 64, 73, 78, 49, 10, -2, + -10, 67, 67, 76, 67, 67, 67, 67, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 75, -17, -19, + 67, 67, 67, 67, 67, 12, -10, 12, 12, 67, + -2, -19, 84, 91, 99, 106, 113, 121, 128, 135, + 143, 150, 157, 165, 172, -19, -19, 69, 69, 76, + 76, 76, 83, 83, -18, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19 }; -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ static const yytype_uint8 yydefact[] = { 2, 28, 7, 0, 0, 0, 0, 0, 0, 0, @@ -538,38 +519,21 @@ static const yytype_uint8 yydefact[] = 18, 20, 21, 22, 23, 24, 25, 26 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 18, 37, 38, 21 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -19 -static const yytype_int16 yypact[] = + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = { - 49, -19, -19, 67, -15, -9, 13, 14, 22, 31, - 35, 38, 56, 63, 64, 73, 78, 49, 10, -2, - -10, 67, 67, 76, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 75, -17, -19, - 67, 67, 67, 67, 67, 12, -10, 12, 12, 67, - -2, -19, 84, 91, 99, 106, 113, 121, 128, 135, - 143, 150, 157, 165, 172, -19, -19, 69, 69, 76, - 76, 76, 83, 83, -18, -19, -19, -19, -19, -19, - -19, -19, -19, -19, -19, -19, -19, -19 + -19, -19, 2, 0, -4 }; -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = { - -19, -19, 2, 0, -4 + -1, 18, 37, 38, 21 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { 20, 1, 19, 40, 41, 23, 47, 48, 44, 49, @@ -595,12 +559,6 @@ static const yytype_uint8 yytable[] = 87 }; -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-19))) - -#define yytable_value_is_error(Yytable_value) \ - YYID (0) - static const yytype_int8 yycheck[] = { 0, 3, 0, 5, 22, 3, 23, 24, 26, 26, @@ -626,8 +584,8 @@ static const yytype_int8 yycheck[] = 28 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 3, 4, 5, 6, 7, 8, 10, 11, 12, @@ -641,30 +599,34 @@ static const yytype_uint8 yystos[] = 28, 28, 28, 28, 28, 28, 28, 28 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ - -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 29, 30, 30, 30, 30, 30, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 32, 32, + 32, 32, 32, 33 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 1, 1, 1, 2, 1, 3, 3, + 3, 3, 2, 3, 3, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 1, 3, + 3, 3, 3, 2 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + #define YYRECOVERING() (!!yyerrstatus) @@ -681,27 +643,15 @@ do \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) + YYERROR; \ + } \ +while (0) /* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif +#define YYTERROR 1 +#define YYERRCODE 256 -/* YYLEX -- calling `yylex' with the right arguments. */ -#ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) -#else -# define YYLEX yylex () -#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -711,40 +661,36 @@ while (YYID (0)) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif { FILE *yyo = yyoutput; YYUSE (yyo); @@ -753,8 +699,6 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); # endif YYUSE (yytype); } @@ -764,22 +708,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); @@ -790,16 +723,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -810,49 +735,42 @@ yy_stack_print (yybottom, yytop) YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -866,7 +784,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -889,15 +807,8 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -913,16 +824,8 @@ yystrlen (yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif { char *yyd = yydest; const char *yys = yysrc; @@ -952,27 +855,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -995,11 +898,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1007,10 +910,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, int yycount = 0; /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - - for details. YYERROR is fine as it does not invoke this - function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected @@ -1060,7 +959,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; @@ -1127,26 +1026,17 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif { YYUSE (yyvaluep); - if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } @@ -1155,18 +1045,8 @@ yydestruct (yymsg, yytype, yyvaluep) /* The lookahead symbol. */ int yychar; - -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); - +YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; @@ -1175,35 +1055,16 @@ int yynerrs; | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) int yyparse (void) -#else -int -yyparse () - -#endif -#endif { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. + 'yyss': related to states. + 'yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ @@ -1271,23 +1132,23 @@ yyparse () #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -1295,22 +1156,22 @@ yyparse () # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -1319,10 +1180,10 @@ yyparse () yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); @@ -1351,7 +1212,7 @@ yyparse () if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (); } if (yychar <= YYEOF) @@ -1416,7 +1277,7 @@ yyparse () yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1430,200 +1291,199 @@ yyparse () switch (yyn) { case 2: -/* Line 1787 of yacc.c */ -#line 33 "QuantityParser.y" +#line 33 "QuantityParser.y" /* yacc.c:1646 */ { QuantResult = Quantity(DOUBLE_MIN); /* empty input */ } +#line 1297 "QuantityParser.c" /* yacc.c:1646 */ break; case 3: -/* Line 1787 of yacc.c */ -#line 34 "QuantityParser.y" - { QuantResult = (yyvsp[(1) - (1)]) ; } +#line 34 "QuantityParser.y" /* yacc.c:1646 */ + { QuantResult = (yyvsp[0]) ; } +#line 1303 "QuantityParser.c" /* yacc.c:1646 */ break; case 4: -/* Line 1787 of yacc.c */ -#line 35 "QuantityParser.y" - { QuantResult = (yyvsp[(1) - (1)]) ; } +#line 35 "QuantityParser.y" /* yacc.c:1646 */ + { QuantResult = (yyvsp[0]) ; } +#line 1309 "QuantityParser.c" /* yacc.c:1646 */ break; case 5: -/* Line 1787 of yacc.c */ -#line 36 "QuantityParser.y" - { QuantResult = (yyvsp[(1) - (1)]) ; } +#line 36 "QuantityParser.y" /* yacc.c:1646 */ + { QuantResult = (yyvsp[0]) ; } +#line 1315 "QuantityParser.c" /* yacc.c:1646 */ break; case 6: -/* Line 1787 of yacc.c */ -#line 37 "QuantityParser.y" - { QuantResult = (yyvsp[(1) - (2)]) + (yyvsp[(2) - (2)]); } +#line 37 "QuantityParser.y" /* yacc.c:1646 */ + { QuantResult = (yyvsp[-1]) + (yyvsp[0]); } +#line 1321 "QuantityParser.c" /* yacc.c:1646 */ break; case 7: -/* Line 1787 of yacc.c */ -#line 39 "QuantityParser.y" - { (yyval) = (yyvsp[(1) - (1)]); } +#line 39 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]); } +#line 1327 "QuantityParser.c" /* yacc.c:1646 */ break; case 8: -/* Line 1787 of yacc.c */ -#line 40 "QuantityParser.y" - { (yyval) = (yyvsp[(1) - (3)]).getValue() + (yyvsp[(3) - (3)]).getValue(); } +#line 40 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[-2]).getValue() + (yyvsp[0]).getValue(); } +#line 1333 "QuantityParser.c" /* yacc.c:1646 */ break; case 9: -/* Line 1787 of yacc.c */ -#line 41 "QuantityParser.y" - { (yyval) = (yyvsp[(1) - (3)]).getValue() - (yyvsp[(3) - (3)]).getValue(); } +#line 41 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[-2]).getValue() - (yyvsp[0]).getValue(); } +#line 1339 "QuantityParser.c" /* yacc.c:1646 */ break; case 10: -/* Line 1787 of yacc.c */ -#line 42 "QuantityParser.y" - { (yyval) = (yyvsp[(1) - (3)]).getValue() * (yyvsp[(3) - (3)]).getValue(); } +#line 42 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[-2]).getValue() * (yyvsp[0]).getValue(); } +#line 1345 "QuantityParser.c" /* yacc.c:1646 */ break; case 11: -/* Line 1787 of yacc.c */ -#line 43 "QuantityParser.y" - { (yyval) = (yyvsp[(1) - (3)]).getValue() / (yyvsp[(3) - (3)]).getValue(); } +#line 43 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[-2]).getValue() / (yyvsp[0]).getValue(); } +#line 1351 "QuantityParser.c" /* yacc.c:1646 */ break; case 12: -/* Line 1787 of yacc.c */ -#line 44 "QuantityParser.y" - { (yyval) = -(yyvsp[(2) - (2)]).getValue(); } +#line 44 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = -(yyvsp[0]).getValue(); } +#line 1357 "QuantityParser.c" /* yacc.c:1646 */ break; case 13: -/* Line 1787 of yacc.c */ -#line 45 "QuantityParser.y" - { (yyval) = pow ((yyvsp[(1) - (3)]).getValue(), (yyvsp[(3) - (3)]).getValue());} +#line 45 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = pow ((yyvsp[-2]).getValue(), (yyvsp[0]).getValue());} +#line 1363 "QuantityParser.c" /* yacc.c:1646 */ break; case 14: -/* Line 1787 of yacc.c */ -#line 46 "QuantityParser.y" - { (yyval) = (yyvsp[(2) - (3)]); } +#line 46 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[-1]); } +#line 1369 "QuantityParser.c" /* yacc.c:1646 */ break; case 15: -/* Line 1787 of yacc.c */ -#line 47 "QuantityParser.y" - { (yyval) = acos((yyvsp[(3) - (4)]).getValue()); } +#line 47 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = acos((yyvsp[-1]).getValue()); } +#line 1375 "QuantityParser.c" /* yacc.c:1646 */ break; case 16: -/* Line 1787 of yacc.c */ -#line 48 "QuantityParser.y" - { (yyval) = asin((yyvsp[(3) - (4)]).getValue()); } +#line 48 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = asin((yyvsp[-1]).getValue()); } +#line 1381 "QuantityParser.c" /* yacc.c:1646 */ break; case 17: -/* Line 1787 of yacc.c */ -#line 49 "QuantityParser.y" - { (yyval) = atan((yyvsp[(3) - (4)]).getValue()); } +#line 49 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = atan((yyvsp[-1]).getValue()); } +#line 1387 "QuantityParser.c" /* yacc.c:1646 */ break; case 18: -/* Line 1787 of yacc.c */ -#line 50 "QuantityParser.y" - { (yyval) = fabs((yyvsp[(3) - (4)]).getValue()); } +#line 50 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = fabs((yyvsp[-1]).getValue()); } +#line 1393 "QuantityParser.c" /* yacc.c:1646 */ break; case 19: -/* Line 1787 of yacc.c */ -#line 51 "QuantityParser.y" - { (yyval) = exp((yyvsp[(3) - (4)]).getValue()); } +#line 51 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = exp((yyvsp[-1]).getValue()); } +#line 1399 "QuantityParser.c" /* yacc.c:1646 */ break; case 20: -/* Line 1787 of yacc.c */ -#line 52 "QuantityParser.y" - { (yyval) = log((yyvsp[(3) - (4)]).getValue()); } +#line 52 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = log((yyvsp[-1]).getValue()); } +#line 1405 "QuantityParser.c" /* yacc.c:1646 */ break; case 21: -/* Line 1787 of yacc.c */ -#line 53 "QuantityParser.y" - { (yyval) = log10((yyvsp[(3) - (4)]).getValue()); } +#line 53 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = log10((yyvsp[-1]).getValue()); } +#line 1411 "QuantityParser.c" /* yacc.c:1646 */ break; case 22: -/* Line 1787 of yacc.c */ -#line 54 "QuantityParser.y" - { (yyval) = sin((yyvsp[(3) - (4)]).getValue()); } +#line 54 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = sin((yyvsp[-1]).getValue()); } +#line 1417 "QuantityParser.c" /* yacc.c:1646 */ break; case 23: -/* Line 1787 of yacc.c */ -#line 55 "QuantityParser.y" - { (yyval) = sinh((yyvsp[(3) - (4)]).getValue()); } +#line 55 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = sinh((yyvsp[-1]).getValue()); } +#line 1423 "QuantityParser.c" /* yacc.c:1646 */ break; case 24: -/* Line 1787 of yacc.c */ -#line 56 "QuantityParser.y" - { (yyval) = tan((yyvsp[(3) - (4)]).getValue()); } +#line 56 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = tan((yyvsp[-1]).getValue()); } +#line 1429 "QuantityParser.c" /* yacc.c:1646 */ break; case 25: -/* Line 1787 of yacc.c */ -#line 57 "QuantityParser.y" - { (yyval) = tanh((yyvsp[(3) - (4)]).getValue()); } +#line 57 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = tanh((yyvsp[-1]).getValue()); } +#line 1435 "QuantityParser.c" /* yacc.c:1646 */ break; case 26: -/* Line 1787 of yacc.c */ -#line 58 "QuantityParser.y" - { (yyval) = sqrt((yyvsp[(3) - (4)]).getValue()); } +#line 58 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = sqrt((yyvsp[-1]).getValue()); } +#line 1441 "QuantityParser.c" /* yacc.c:1646 */ break; case 27: -/* Line 1787 of yacc.c */ -#line 59 "QuantityParser.y" - { (yyval) = cos((yyvsp[(3) - (4)]).getValue()); } +#line 59 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = cos((yyvsp[-1]).getValue()); } +#line 1447 "QuantityParser.c" /* yacc.c:1646 */ break; case 28: -/* Line 1787 of yacc.c */ -#line 62 "QuantityParser.y" - { (yyval) = (yyvsp[(1) - (1)]); } +#line 62 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[0]); } +#line 1453 "QuantityParser.c" /* yacc.c:1646 */ break; case 29: -/* Line 1787 of yacc.c */ -#line 63 "QuantityParser.y" - { (yyval) = (yyvsp[(1) - (3)]) * (yyvsp[(3) - (3)]); } +#line 63 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[-2]) * (yyvsp[0]); } +#line 1459 "QuantityParser.c" /* yacc.c:1646 */ break; case 30: -/* Line 1787 of yacc.c */ -#line 64 "QuantityParser.y" - { (yyval) = (yyvsp[(1) - (3)]) / (yyvsp[(3) - (3)]); } +#line 64 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[-2]) / (yyvsp[0]); } +#line 1465 "QuantityParser.c" /* yacc.c:1646 */ break; case 31: -/* Line 1787 of yacc.c */ -#line 65 "QuantityParser.y" - { (yyval) = (yyvsp[(1) - (3)]).pow ((yyvsp[(3) - (3)])); } +#line 65 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[-2]).pow ((yyvsp[0])); } +#line 1471 "QuantityParser.c" /* yacc.c:1646 */ break; case 32: -/* Line 1787 of yacc.c */ -#line 66 "QuantityParser.y" - { (yyval) = (yyvsp[(2) - (3)]); } +#line 66 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[-1]); } +#line 1477 "QuantityParser.c" /* yacc.c:1646 */ break; case 33: -/* Line 1787 of yacc.c */ -#line 68 "QuantityParser.y" - { (yyval) = (yyvsp[(1) - (2)])*(yyvsp[(2) - (2)]); } +#line 68 "QuantityParser.y" /* yacc.c:1646 */ + { (yyval) = (yyvsp[-1])*(yyvsp[0]); } +#line 1483 "QuantityParser.c" /* yacc.c:1646 */ break; -/* Line 1787 of yacc.c */ -#line 1627 "QuantityParser.c" +#line 1487 "QuantityParser.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1645,7 +1505,7 @@ yyparse () *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1660,9 +1520,9 @@ yyparse () goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ @@ -1713,20 +1573,20 @@ yyparse () if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } } /* Else will try to reuse lookahead token after shifting the error @@ -1745,7 +1605,7 @@ yyparse () if (/*CONSTCOND*/ 0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -1758,29 +1618,29 @@ yyparse () | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yydestruct ("Error: popping", - yystos[yystate], yyvsp); + yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -1831,14 +1691,14 @@ yyparse () yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); } - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -1849,11 +1709,7 @@ yyparse () if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - -/* Line 2050 of yacc.c */ -#line 72 "QuantityParser.y" +#line 72 "QuantityParser.y" /* yacc.c:1906 */ diff --git a/src/Base/QuantityParser.h b/src/Base/QuantityParser.h new file mode 100644 index 000000000000..0475775fd985 --- /dev/null +++ b/src/Base/QuantityParser.h @@ -0,0 +1,83 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +#ifndef YY_YY_QUANTITYPARSER_H_INCLUDED +# define YY_YY_QUANTITYPARSER_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + UNIT = 258, + NUM = 259, + MINUSSIGN = 260, + ACOS = 261, + ASIN = 262, + ATAN = 263, + ATAN2 = 264, + COS = 265, + EXP = 266, + ABS = 267, + MOD = 268, + LOG = 269, + LOG10 = 270, + POW = 271, + SIN = 272, + SINH = 273, + TAN = 274, + TANH = 275, + SQRT = 276, + NEG = 277 + }; +#endif + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE yylval; + +int yyparse (void); + +#endif /* !YY_YY_QUANTITYPARSER_H_INCLUDED */ diff --git a/src/Base/QuantityParser.l b/src/Base/QuantityParser.l index 2146f4f4856d..8b47d18446ae 100644 --- a/src/Base/QuantityParser.l +++ b/src/Base/QuantityParser.l @@ -131,7 +131,9 @@ CGRP '\,'[0-9][0-9][0-9] "gon" yylval = Quantity::Gon; return UNIT; // gon {DIGIT}+"."?{DIGIT}*{EXPO}? { yylval = num_change(yytext,'.',',');return NUM; } +"."?{DIGIT}+{EXPO}? { yylval = num_change(yytext,'.',',');return NUM; } {DIGIT}+","?{DIGIT}*{EXPO}? { yylval = num_change(yytext,',','.');return NUM; } +","?{DIGIT}+{EXPO}? { yylval = num_change(yytext,',','.');return NUM; } "pi" {yylval = M_PI ; return NUM;} // constant pi