diff --git a/src/Base/QuantityLexer.c b/src/Base/QuantityLexer.c index 39ff67c2d3..f7ed1c9189 100644 --- a/src/Base/QuantityLexer.c +++ b/src/Base/QuantityLexer.c @@ -361,8 +361,8 @@ static void yy_fatal_error (yyconst char msg[] ); *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 96 -#define YY_END_OF_BUFFER 97 +#define YY_NUM_RULES 98 +#define YY_END_OF_BUFFER 99 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -370,26 +370,27 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[168] = +static yyconst flex_int16_t yy_accept[172] = { 0, - 0, 0, 0, 0, 97, 95, 4, 5, 36, 38, - 6, 75, 76, 25, 95, 95, 65, 29, 95, 49, - 95, 95, 95, 63, 1, 95, 95, 95, 78, 95, - 19, 24, 95, 95, 15, 13, 95, 95, 95, 95, - 22, 21, 95, 95, 95, 3, 96, 2, 5, 75, - 0, 75, 76, 68, 0, 28, 51, 0, 66, 53, - 0, 64, 69, 0, 0, 0, 0, 34, 11, 0, - 0, 0, 12, 0, 37, 0, 35, 27, 50, 0, - 20, 14, 0, 43, 0, 26, 30, 52, 0, 18, - 42, 10, 0, 7, 45, 77, 0, 0, 0, 0, + 0, 0, 0, 0, 99, 97, 4, 5, 38, 40, + 6, 77, 7, 78, 27, 97, 97, 67, 31, 97, + 51, 97, 97, 97, 65, 1, 97, 97, 97, 80, + 97, 21, 26, 97, 97, 17, 15, 97, 97, 97, + 97, 24, 23, 97, 97, 97, 97, 3, 98, 2, + 5, 77, 0, 77, 78, 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, 79, 0, 0, - 0, 46, 0, 0, 32, 0, 16, 8, 41, 70, - 0, 0, 74, 56, 55, 0, 67, 85, 0, 0, - 0, 83, 47, 71, 84, 73, 54, 62, 48, 44, - 87, 0, 40, 23, 86, 33, 89, 61, 72, 90, - 0, 92, 0, 0, 31, 0, 17, 9, 57, 79, - 80, 81, 0, 0, 91, 94, 93, 39, 0, 0, - 82, 88, 58, 59, 0, 60, 0 + 0, 0, 0, 48, 0, 0, 34, 0, 18, 10, + 43, 72, 0, 0, 0, 76, 58, 57, 0, 69, + 87, 0, 0, 0, 85, 49, 73, 86, 75, 56, + 64, 50, 46, 89, 0, 42, 25, 88, 35, 91, + 63, 74, 92, 0, 94, 0, 0, 33, 0, 19, + 11, 8, 59, 81, 82, 83, 0, 0, 93, 96, + 95, 41, 0, 0, 84, 90, 60, 61, 0, 62, + 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -398,152 +399,156 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 4, 1, 1, 1, 1, 5, 6, - 6, 6, 7, 8, 7, 8, 6, 9, 10, 11, - 12, 12, 12, 12, 12, 12, 12, 1, 1, 1, - 6, 1, 1, 1, 13, 1, 14, 1, 15, 1, - 16, 1, 1, 17, 18, 1, 19, 20, 1, 21, - 1, 1, 1, 22, 1, 23, 24, 1, 1, 1, - 25, 1, 26, 6, 1, 1, 27, 28, 29, 30, + 6, 6, 7, 8, 9, 8, 6, 10, 11, 12, + 13, 13, 13, 13, 13, 13, 13, 1, 1, 1, + 6, 1, 1, 1, 14, 1, 15, 1, 16, 1, + 17, 1, 1, 18, 19, 1, 20, 21, 1, 22, + 1, 1, 1, 23, 1, 24, 25, 1, 1, 1, + 26, 1, 27, 6, 1, 1, 28, 29, 30, 31, - 31, 32, 33, 34, 35, 1, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 1, 47, 48, - 49, 50, 1, 1, 1, 1, 1, 1, 1, 1, + 32, 33, 34, 35, 36, 1, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 1, 48, 49, + 50, 51, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 52, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 53, 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, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 51, 1, 1, 1, 1, - 52, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 53, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 54, 1, 1, 1, 1, + 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 56, 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, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 57, 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, 1 } ; -static yyconst flex_int32_t yy_meta[54] = +static yyconst flex_int32_t yy_meta[58] = { 0, 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, 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, 1, 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[169] = +static yyconst flex_int16_t yy_base[173] = { 0, - 0, 0, 51, 52, 221, 222, 222, 217, 48, 222, - 222, 55, 64, 222, 196, 197, 222, 222, 67, 179, - 189, 175, 201, 169, 222, 53, 53, 31, 164, 166, - 170, 222, 170, 81, 56, 113, 170, 157, 55, 179, - 68, 58, 89, 175, 53, 222, 222, 222, 201, 106, - 129, 145, 154, 222, 176, 222, 222, 175, 222, 222, - 158, 156, 222, 155, 158, 162, 169, 222, 222, 151, - 149, 160, 222, 151, 222, 152, 222, 222, 222, 163, - 222, 222, 154, 74, 155, 222, 222, 222, 146, 222, - 91, 222, 112, 222, 222, 222, 138, 149, 153, 142, + 0, 0, 55, 56, 228, 229, 229, 224, 52, 229, + 229, 59, 229, 77, 229, 202, 203, 229, 229, 52, + 185, 195, 181, 207, 175, 229, 31, 55, 60, 170, + 172, 176, 229, 176, 79, 38, 91, 176, 163, 61, + 185, 73, 76, 103, 181, 53, 159, 229, 229, 229, + 207, 123, 134, 138, 148, 229, 181, 229, 229, 180, + 229, 229, 163, 161, 229, 160, 163, 167, 174, 229, + 229, 156, 154, 165, 229, 156, 229, 157, 229, 229, + 229, 168, 229, 229, 159, 82, 160, 229, 229, 229, + 152, 229, 40, 229, 100, 229, 229, 229, 144, 155, - 127, 222, 130, 128, 222, 121, 222, 222, 222, 222, - 149, 163, 168, 222, 222, 116, 222, 222, 108, 111, - 108, 222, 222, 222, 222, 222, 222, 222, 222, 222, - 135, 101, 222, 222, 222, 222, 222, 222, 222, 109, - 89, 98, 83, 81, 222, 83, 222, 222, 222, 222, - 222, 109, 100, 65, 222, 222, 222, 222, 46, 28, - 222, 222, 222, 222, 18, 222, 222, 55 + 159, 149, 144, 229, 147, 145, 229, 144, 229, 229, + 229, 229, 134, 131, 152, 164, 229, 229, 139, 229, + 229, 137, 141, 140, 229, 229, 229, 229, 229, 229, + 229, 229, 229, 168, 134, 229, 229, 229, 229, 229, + 229, 229, 137, 125, 134, 120, 122, 229, 99, 229, + 229, 229, 229, 229, 229, 117, 118, 79, 229, 229, + 229, 229, 76, 73, 229, 229, 229, 229, 54, 229, + 229, 94 } ; -static yyconst flex_int16_t yy_def[169] = +static yyconst flex_int16_t yy_def[173] = { 0, - 167, 1, 168, 168, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, + 171, 1, 172, 172, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 0, 167 + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 0, 171 } ; -static yyconst flex_int16_t yy_nxt[276] = +static yyconst flex_int16_t yy_nxt[287] = { 0, - 6, 7, 8, 9, 10, 11, 11, 12, 13, 13, - 13, 13, 14, 15, 6, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 6, 26, 6, 27, 28, + 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, + 14, 14, 14, 15, 16, 6, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 6, 27, 6, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 6, 40, 41, 42, 43, 6, 6, 44, 6, - 6, 6, 45, 47, 47, 46, 50, 50, 50, 50, - 166, 72, 51, 50, 50, 50, 50, 52, 73, 51, - 165, 52, 53, 53, 53, 53, 48, 48, 51, 56, - 64, 65, 68, 84, 103, 51, 57, 58, 164, 96, - 69, 104, 70, 78, 97, 85, 66, 67, 98, 71, + 39, 40, 6, 41, 42, 43, 44, 6, 6, 45, + 6, 6, 6, 6, 6, 46, 47, 49, 49, 66, + 67, 52, 52, 52, 52, 58, 86, 53, 52, 52, + 52, 52, 59, 60, 53, 68, 69, 136, 87, 137, + 54, 50, 50, 53, 54, 70, 55, 55, 55, 55, + 53, 74, 80, 71, 48, 72, 98, 170, 75, 81, - 79, 80, 100, 110, 111, 129, 105, 163, 162, 101, - 106, 130, 102, 81, 50, 50, 50, 50, 82, 161, - 51, 107, 160, 159, 83, 86, 108, 133, 158, 134, - 87, 157, 88, 156, 89, 112, 51, 113, 113, 113, - 113, 135, 155, 154, 153, 90, 152, 91, 136, 151, - 92, 150, 93, 50, 50, 50, 50, 52, 149, 51, - 144, 52, 53, 53, 53, 53, 145, 143, 142, 141, - 146, 113, 113, 113, 113, 51, 113, 113, 113, 113, - 140, 147, 139, 138, 137, 132, 148, 131, 128, 127, - 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, + 82, 99, 73, 105, 88, 100, 112, 113, 102, 89, + 106, 90, 83, 91, 132, 103, 169, 84, 104, 168, + 133, 107, 167, 85, 92, 108, 93, 166, 165, 94, + 138, 95, 52, 52, 52, 52, 109, 139, 53, 164, + 115, 110, 115, 116, 116, 116, 116, 52, 52, 52, + 52, 54, 148, 53, 53, 54, 149, 55, 55, 55, + 55, 116, 116, 116, 116, 163, 162, 150, 161, 53, + 160, 159, 151, 116, 116, 116, 116, 158, 157, 156, + 155, 154, 153, 152, 147, 146, 145, 144, 143, 142, + 141, 140, 135, 134, 131, 130, 129, 128, 127, 126, - 116, 115, 114, 49, 109, 99, 95, 94, 77, 76, - 75, 74, 63, 62, 61, 60, 59, 55, 54, 49, - 167, 5, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167 + 125, 124, 123, 122, 121, 120, 119, 118, 117, 51, + 114, 111, 101, 97, 96, 79, 78, 77, 76, 65, + 64, 63, 62, 61, 57, 56, 51, 171, 5, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171 } ; -static yyconst flex_int16_t yy_chk[276] = +static yyconst flex_int16_t yy_chk[287] = { 0, 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, 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, 168, 9, 9, 9, 9, - 165, 28, 9, 12, 12, 12, 12, 13, 28, 12, - 160, 13, 13, 13, 13, 13, 3, 4, 9, 19, - 26, 26, 27, 35, 42, 12, 19, 19, 159, 39, - 27, 42, 27, 34, 39, 35, 26, 26, 39, 27, + 1, 1, 1, 1, 1, 1, 1, 3, 4, 27, + 27, 9, 9, 9, 9, 20, 36, 9, 12, 12, + 12, 12, 20, 20, 12, 27, 27, 93, 36, 93, + 14, 3, 4, 9, 14, 28, 14, 14, 14, 14, + 12, 29, 35, 28, 172, 28, 40, 169, 29, 35, - 34, 34, 41, 45, 45, 84, 43, 154, 153, 41, - 43, 84, 41, 34, 50, 50, 50, 50, 34, 152, - 50, 43, 146, 144, 34, 36, 43, 91, 143, 91, - 36, 142, 36, 141, 36, 51, 50, 51, 51, 51, - 51, 93, 140, 132, 131, 36, 121, 36, 93, 120, - 36, 119, 36, 52, 52, 52, 52, 53, 116, 52, - 106, 53, 53, 53, 53, 53, 111, 104, 103, 101, - 111, 112, 112, 112, 112, 52, 113, 113, 113, 113, - 100, 111, 99, 98, 97, 89, 111, 85, 83, 80, - 76, 74, 72, 71, 70, 67, 66, 65, 64, 62, + 35, 40, 28, 43, 37, 40, 46, 46, 42, 37, + 43, 37, 35, 37, 86, 42, 164, 35, 42, 163, + 86, 44, 158, 35, 37, 44, 37, 157, 156, 37, + 95, 37, 52, 52, 52, 52, 44, 95, 52, 149, + 53, 44, 53, 53, 53, 53, 53, 54, 54, 54, + 54, 55, 113, 54, 52, 55, 113, 55, 55, 55, + 55, 115, 115, 115, 115, 147, 146, 113, 145, 54, + 144, 143, 113, 116, 116, 116, 116, 135, 134, 124, + 123, 122, 119, 114, 108, 106, 105, 103, 102, 101, + 100, 99, 91, 87, 85, 82, 78, 76, 74, 73, - 61, 58, 55, 49, 44, 40, 38, 37, 33, 31, - 30, 29, 24, 23, 22, 21, 20, 16, 15, 8, - 5, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167 + 72, 69, 68, 67, 66, 64, 63, 60, 57, 51, + 47, 45, 41, 39, 38, 34, 32, 31, 30, 25, + 24, 23, 22, 21, 17, 16, 8, 5, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 171, 171 } ; static yy_state_type yy_last_accepting_state; @@ -560,8 +565,8 @@ int yy_flex_debug = 0; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "QuantityParser.l" -#line 2 "QuantityParser.l" +#line 1 "" +#line 2 "" /* Lexer for the FreeCAD Units language */ /* (c) 2013 Juergen Riegel LGPL */ @@ -574,7 +579,7 @@ char *yytext; /* the manual says "somewhat more optimized" */ /* no support for include files is planned */ -#line 578 "QuantityLexer.c" +#line 583 "QuantityLexer.c" #define INITIAL 0 #define C_COMMENT 1 @@ -755,10 +760,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 28 "QuantityParser.l" +#line 28 "" -#line 762 "QuantityLexer.c" +#line 767 "QuantityLexer.c" if ( !(yy_init) ) { @@ -811,13 +816,13 @@ yy_match: 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 >= 168 ) + if ( yy_current_state >= 172 ) 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 != 167 ); + while ( yy_current_state != 171 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); @@ -839,486 +844,496 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 30 "QuantityParser.l" +#line 30 "" { BEGIN(C_COMMENT); } YY_BREAK case 2: YY_RULE_SETUP -#line 31 "QuantityParser.l" +#line 31 "" { BEGIN(INITIAL); } YY_BREAK case 3: YY_RULE_SETUP -#line 32 "QuantityParser.l" +#line 32 "" { ;} YY_BREAK case 4: YY_RULE_SETUP -#line 35 "QuantityParser.l" +#line 35 "" ; YY_BREAK case 5: /* rule 5 can match eol */ YY_RULE_SETUP -#line 36 "QuantityParser.l" +#line 36 "" ; YY_BREAK case 6: YY_RULE_SETUP -#line 38 "QuantityParser.l" +#line 38 "" { return *yytext; } YY_BREAK case 7: YY_RULE_SETUP -#line 40 "QuantityParser.l" -yylval = Quantity::NanoMetre; return UNIT; // nano meter +#line 40 "" +return MINUSSIGN; YY_BREAK case 8: YY_RULE_SETUP -#line 41 "QuantityParser.l" -yylval = Quantity::MicroMetre; return UNIT; // micro meter +#line 41 "" +return MINUSSIGN; YY_BREAK case 9: YY_RULE_SETUP -#line 42 "QuantityParser.l" -yylval = Quantity::MicroMetre; return UNIT; // micro meter (greek micro in UTF8) +#line 43 "" +yylval = Quantity::NanoMetre; return UNIT; // nano meter YY_BREAK case 10: YY_RULE_SETUP -#line 43 "QuantityParser.l" -yylval = Quantity::MilliMetre; return UNIT; // milli meter (internal standard length) +#line 44 "" +yylval = Quantity::MicroMetre; return UNIT; // micro meter YY_BREAK case 11: YY_RULE_SETUP -#line 44 "QuantityParser.l" -yylval = Quantity::CentiMetre; return UNIT; // centi meter +#line 45 "" +yylval = Quantity::MicroMetre; return UNIT; // micro meter (greek micro in UTF8) YY_BREAK case 12: YY_RULE_SETUP -#line 45 "QuantityParser.l" -yylval = Quantity::DeciMetre; return UNIT; // deci meter +#line 46 "" +yylval = Quantity::MilliMetre; return UNIT; // milli meter (internal standard length) YY_BREAK case 13: YY_RULE_SETUP -#line 46 "QuantityParser.l" -yylval = Quantity::Metre; return UNIT; // metre +#line 47 "" +yylval = Quantity::CentiMetre; return UNIT; // centi meter YY_BREAK case 14: YY_RULE_SETUP -#line 47 "QuantityParser.l" -yylval = Quantity::KiloMetre; return UNIT; // kilo meter +#line 48 "" +yylval = Quantity::DeciMetre; return UNIT; // deci meter YY_BREAK case 15: YY_RULE_SETUP -#line 49 "QuantityParser.l" -yylval = Quantity::Liter; return UNIT; // Liter dm^3 +#line 49 "" +yylval = Quantity::Metre; return UNIT; // metre YY_BREAK case 16: YY_RULE_SETUP -#line 51 "QuantityParser.l" -yylval = Quantity::MicroGram; return UNIT; // micro gram +#line 50 "" +yylval = Quantity::KiloMetre; return UNIT; // kilo meter YY_BREAK case 17: YY_RULE_SETUP -#line 52 "QuantityParser.l" -yylval = Quantity::MicroGram; return UNIT; // micro gram +#line 52 "" +yylval = Quantity::Liter; return UNIT; // Liter dm^3 YY_BREAK case 18: YY_RULE_SETUP -#line 53 "QuantityParser.l" -yylval = Quantity::MilliGram; return UNIT; // milli gram +#line 54 "" +yylval = Quantity::MicroGram; return UNIT; // micro gram YY_BREAK case 19: YY_RULE_SETUP -#line 54 "QuantityParser.l" -yylval = Quantity::Gram; return UNIT; // gram +#line 55 "" +yylval = Quantity::MicroGram; return UNIT; // micro gram YY_BREAK case 20: YY_RULE_SETUP -#line 55 "QuantityParser.l" -yylval = Quantity::KiloGram; return UNIT; // kilo gram (internal standard for mass) +#line 56 "" +yylval = Quantity::MilliGram; return UNIT; // milli gram YY_BREAK case 21: YY_RULE_SETUP -#line 56 "QuantityParser.l" -yylval = Quantity::Ton; return UNIT; // Metric Tonne +#line 57 "" +yylval = Quantity::Gram; return UNIT; // gram YY_BREAK case 22: YY_RULE_SETUP -#line 58 "QuantityParser.l" -yylval = Quantity::Second; return UNIT; // second (internal standard time) +#line 58 "" +yylval = Quantity::KiloGram; return UNIT; // kilo gram (internal standard for mass) YY_BREAK case 23: YY_RULE_SETUP -#line 59 "QuantityParser.l" -yylval = Quantity::Minute; return UNIT; // minute +#line 59 "" +yylval = Quantity::Ton; return UNIT; // Metric Tonne YY_BREAK case 24: YY_RULE_SETUP -#line 60 "QuantityParser.l" -yylval = Quantity::Hour; return UNIT; // hour +#line 61 "" +yylval = Quantity::Second; return UNIT; // second (internal standard time) YY_BREAK case 25: YY_RULE_SETUP -#line 62 "QuantityParser.l" -yylval = Quantity::Ampere; return UNIT; // Ampere (internal standard electric current) +#line 62 "" +yylval = Quantity::Minute; return UNIT; // minute YY_BREAK case 26: YY_RULE_SETUP -#line 63 "QuantityParser.l" -yylval = Quantity::MilliAmpere; return UNIT; // milli Ampere +#line 63 "" +yylval = Quantity::Hour; return UNIT; // hour YY_BREAK case 27: YY_RULE_SETUP -#line 64 "QuantityParser.l" -yylval = Quantity::KiloAmpere; return UNIT; // kilo Ampere +#line 65 "" +yylval = Quantity::Ampere; return UNIT; // Ampere (internal standard electric current) YY_BREAK case 28: YY_RULE_SETUP -#line 65 "QuantityParser.l" -yylval = Quantity::MegaAmpere; return UNIT; // Mega Ampere +#line 66 "" +yylval = Quantity::MilliAmpere; return UNIT; // milli Ampere YY_BREAK case 29: YY_RULE_SETUP -#line 67 "QuantityParser.l" -yylval = Quantity::Kelvin; return UNIT; // Kelvin (internal standard thermodynamic temperature) +#line 67 "" +yylval = Quantity::KiloAmpere; return UNIT; // kilo Ampere YY_BREAK case 30: YY_RULE_SETUP -#line 68 "QuantityParser.l" -yylval = Quantity::MilliKelvin; return UNIT; // Kelvin +#line 68 "" +yylval = Quantity::MegaAmpere; return UNIT; // Mega Ampere YY_BREAK case 31: YY_RULE_SETUP -#line 69 "QuantityParser.l" -yylval = Quantity::MicroKelvin; return UNIT; // Kelvin +#line 70 "" +yylval = Quantity::Kelvin; return UNIT; // Kelvin (internal standard thermodynamic temperature) YY_BREAK case 32: YY_RULE_SETUP -#line 70 "QuantityParser.l" -yylval = Quantity::MicroKelvin; return UNIT; // Kelvin +#line 71 "" +yylval = Quantity::MilliKelvin; return UNIT; // Kelvin YY_BREAK case 33: YY_RULE_SETUP -#line 72 "QuantityParser.l" -yylval = Quantity::Mole; return UNIT; // Mole (internal standard amount of substance) +#line 72 "" +yylval = Quantity::MicroKelvin; return UNIT; // Kelvin YY_BREAK case 34: YY_RULE_SETUP -#line 74 "QuantityParser.l" -yylval = Quantity::Candela; return UNIT; // Candela (internal standard luminous intensity) +#line 73 "" +yylval = Quantity::MicroKelvin; return UNIT; // Kelvin YY_BREAK case 35: YY_RULE_SETUP -#line 76 "QuantityParser.l" -yylval = Quantity::Inch; return UNIT; // inch +#line 75 "" +yylval = Quantity::Mole; return UNIT; // Mole (internal standard amount of substance) YY_BREAK case 36: YY_RULE_SETUP -#line 77 "QuantityParser.l" -yylval = Quantity::Inch; return UNIT; // inch +#line 77 "" +yylval = Quantity::Candela; return UNIT; // Candela (internal standard luminous intensity) YY_BREAK case 37: YY_RULE_SETUP -#line 78 "QuantityParser.l" -yylval = Quantity::Foot; return UNIT; // foot +#line 79 "" +yylval = Quantity::Inch; return UNIT; // inch YY_BREAK case 38: YY_RULE_SETUP -#line 79 "QuantityParser.l" -yylval = Quantity::Foot; return UNIT; // foot +#line 80 "" +yylval = Quantity::Inch; return UNIT; // inch YY_BREAK case 39: YY_RULE_SETUP -#line 80 "QuantityParser.l" -yylval = Quantity::Thou; return UNIT; // thou (in/1000) +#line 81 "" +yylval = Quantity::Foot; return UNIT; // foot YY_BREAK case 40: YY_RULE_SETUP -#line 81 "QuantityParser.l" -yylval = Quantity::Thou; return UNIT; // mil (the thou in US) +#line 82 "" +yylval = Quantity::Foot; return UNIT; // foot YY_BREAK case 41: YY_RULE_SETUP -#line 82 "QuantityParser.l" -yylval = Quantity::Yard; return UNIT; // yard +#line 83 "" +yylval = Quantity::Thou; return UNIT; // thou (in/1000) YY_BREAK case 42: YY_RULE_SETUP -#line 83 "QuantityParser.l" -yylval = Quantity::Mile; return UNIT; // mile +#line 84 "" +yylval = Quantity::Thou; return UNIT; // mil (the thou in US) YY_BREAK case 43: YY_RULE_SETUP -#line 87 "QuantityParser.l" -yylval = Quantity::Pound; return UNIT; // pound +#line 85 "" +yylval = Quantity::Yard; return UNIT; // yard YY_BREAK case 44: YY_RULE_SETUP -#line 88 "QuantityParser.l" -yylval = Quantity::Pound; return UNIT; // pound +#line 86 "" +yylval = Quantity::Mile; return UNIT; // mile YY_BREAK case 45: YY_RULE_SETUP -#line 89 "QuantityParser.l" -yylval = Quantity::Ounce; return UNIT; // ounce +#line 90 "" +yylval = Quantity::Pound; return UNIT; // pound YY_BREAK case 46: YY_RULE_SETUP -#line 90 "QuantityParser.l" -yylval = Quantity::Stone; return UNIT; // Stone +#line 91 "" +yylval = Quantity::Pound; return UNIT; // pound YY_BREAK case 47: YY_RULE_SETUP -#line 91 "QuantityParser.l" -yylval = Quantity::Hundredweights; return UNIT; // hundredweights +#line 92 "" +yylval = Quantity::Ounce; return UNIT; // ounce YY_BREAK case 48: YY_RULE_SETUP -#line 93 "QuantityParser.l" -yylval = Quantity::PoundForce; return UNIT; // pound +#line 93 "" +yylval = Quantity::Stone; return UNIT; // Stone YY_BREAK case 49: YY_RULE_SETUP -#line 95 "QuantityParser.l" -yylval = Quantity::Newton; return UNIT; // Newton (kg*m/s^2) +#line 94 "" +yylval = Quantity::Hundredweights; return UNIT; // hundredweights YY_BREAK case 50: YY_RULE_SETUP -#line 96 "QuantityParser.l" -yylval = Quantity::KiloNewton; return UNIT; // Newton +#line 96 "" +yylval = Quantity::PoundForce; return UNIT; // pound YY_BREAK case 51: YY_RULE_SETUP -#line 97 "QuantityParser.l" -yylval = Quantity::MegaNewton; return UNIT; // Newton +#line 98 "" +yylval = Quantity::Newton; return UNIT; // Newton (kg*m/s^2) YY_BREAK case 52: YY_RULE_SETUP -#line 98 "QuantityParser.l" -yylval = Quantity::MilliNewton; return UNIT; // Newton +#line 99 "" +yylval = Quantity::KiloNewton; return UNIT; // Newton YY_BREAK case 53: YY_RULE_SETUP -#line 100 "QuantityParser.l" -yylval = Quantity::Pascal; return UNIT; // Pascal (kg/m*s^2 or N/m^2) +#line 100 "" +yylval = Quantity::MegaNewton; return UNIT; // Newton YY_BREAK case 54: YY_RULE_SETUP -#line 101 "QuantityParser.l" -yylval = Quantity::KiloPascal; return UNIT; // Pascal +#line 101 "" +yylval = Quantity::MilliNewton; return UNIT; // Newton YY_BREAK case 55: YY_RULE_SETUP -#line 102 "QuantityParser.l" -yylval = Quantity::MegaPascal; return UNIT; // Pascal +#line 103 "" +yylval = Quantity::Pascal; return UNIT; // Pascal (kg/m*s^2 or N/m^2) YY_BREAK case 56: YY_RULE_SETUP -#line 103 "QuantityParser.l" -yylval = Quantity::GigaPascal; return UNIT; // Pascal +#line 104 "" +yylval = Quantity::KiloPascal; return UNIT; // Pascal YY_BREAK case 57: YY_RULE_SETUP -#line 105 "QuantityParser.l" -yylval = Quantity::Torr; return UNIT; // portion of Pascal ( 101325/760 ) +#line 105 "" +yylval = Quantity::MegaPascal; return UNIT; // Pascal YY_BREAK case 58: YY_RULE_SETUP -#line 106 "QuantityParser.l" -yylval = Quantity::mTorr; return UNIT; // +#line 106 "" +yylval = Quantity::GigaPascal; return UNIT; // Pascal YY_BREAK case 59: YY_RULE_SETUP -#line 107 "QuantityParser.l" -yylval = Quantity::yTorr; return UNIT; // +#line 108 "" +yylval = Quantity::Torr; return UNIT; // portion of Pascal ( 101325/760 ) YY_BREAK case 60: YY_RULE_SETUP -#line 108 "QuantityParser.l" -yylval = Quantity::yTorr; return UNIT; // +#line 109 "" +yylval = Quantity::mTorr; return UNIT; // YY_BREAK case 61: YY_RULE_SETUP -#line 110 "QuantityParser.l" -yylval = Quantity::PSI; return UNIT; // pounds/in^2 +#line 110 "" +yylval = Quantity::yTorr; return UNIT; // YY_BREAK case 62: YY_RULE_SETUP -#line 111 "QuantityParser.l" -yylval = Quantity::KSI; return UNIT; // 1000 x pounds/in^2 +#line 111 "" +yylval = Quantity::yTorr; return UNIT; // YY_BREAK case 63: YY_RULE_SETUP -#line 113 "QuantityParser.l" -yylval = Quantity::Watt; return UNIT; // Watt (kg*m^2/s^3) +#line 113 "" +yylval = Quantity::PSI; return UNIT; // pounds/in^2 YY_BREAK case 64: YY_RULE_SETUP -#line 114 "QuantityParser.l" -yylval = Quantity::VoltAmpere; return UNIT; // VoltAmpere (kg*m^2/s^3) +#line 114 "" +yylval = Quantity::KSI; return UNIT; // 1000 x pounds/in^2 YY_BREAK case 65: YY_RULE_SETUP -#line 116 "QuantityParser.l" -yylval = Quantity::Joule; return UNIT; // Joule (kg*m^2/s^2) +#line 116 "" +yylval = Quantity::Watt; return UNIT; // Watt (kg*m^2/s^3) YY_BREAK case 66: YY_RULE_SETUP -#line 117 "QuantityParser.l" -yylval = Quantity::NewtonMeter; return UNIT; // N*m = Joule +#line 117 "" +yylval = Quantity::VoltAmpere; return UNIT; // VoltAmpere (kg*m^2/s^3) YY_BREAK case 67: YY_RULE_SETUP -#line 118 "QuantityParser.l" -yylval = Quantity::VoltAmpereSecond; return UNIT; // V*A*s = Joule +#line 119 "" +yylval = Quantity::Joule; return UNIT; // Joule (kg*m^2/s^2) YY_BREAK case 68: YY_RULE_SETUP -#line 119 "QuantityParser.l" -yylval = Quantity::WattSecond; return UNIT; // +#line 120 "" +yylval = Quantity::NewtonMeter; return UNIT; // N*m = Joule YY_BREAK case 69: YY_RULE_SETUP -#line 120 "QuantityParser.l" -yylval = Quantity::WattSecond; return UNIT; // W*s = Joule +#line 121 "" +yylval = Quantity::VoltAmpereSecond; return UNIT; // V*A*s = Joule YY_BREAK case 70: YY_RULE_SETUP -#line 122 "QuantityParser.l" -yylval = Quantity::Degree; return UNIT; // degree (internal standard angle) +#line 122 "" +yylval = Quantity::WattSecond; return UNIT; // YY_BREAK case 71: YY_RULE_SETUP -#line 123 "QuantityParser.l" -yylval = Quantity::Degree; return UNIT; // degree (internal standard angle) +#line 123 "" +yylval = Quantity::WattSecond; return UNIT; // W*s = Joule YY_BREAK case 72: YY_RULE_SETUP -#line 124 "QuantityParser.l" -yylval = Quantity::Radian; return UNIT; // radian +#line 125 "" +yylval = Quantity::Degree; return UNIT; // degree (internal standard angle) YY_BREAK case 73: YY_RULE_SETUP -#line 125 "QuantityParser.l" -yylval = Quantity::Gon; return UNIT; // gon +#line 126 "" +yylval = Quantity::Degree; return UNIT; // degree (internal standard angle) YY_BREAK case 74: YY_RULE_SETUP -#line 127 "QuantityParser.l" -{for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;} +#line 127 "" +yylval = Quantity::Radian; return UNIT; // radian YY_BREAK case 75: YY_RULE_SETUP -#line 128 "QuantityParser.l" -{for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;} +#line 128 "" +yylval = Quantity::Gon; return UNIT; // gon YY_BREAK case 76: YY_RULE_SETUP -#line 129 "QuantityParser.l" -{yylval = atof( yytext ); return NUM;} +#line 131 "" +{ for(char* c=yytext;*c!='\0';c++) if(*c==',') *c='.'; yylval = atof( yytext ); return NUM; } YY_BREAK case 77: YY_RULE_SETUP -#line 131 "QuantityParser.l" -{yylval = M_PI ; return NUM;} // constant pi +#line 132 "" +{ for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM; } YY_BREAK case 78: YY_RULE_SETUP -#line 132 "QuantityParser.l" -{yylval = M_E ; return NUM;} // constant e +#line 133 "" +{ yylval = atof( yytext ); return NUM;} YY_BREAK case 79: YY_RULE_SETUP -#line 134 "QuantityParser.l" -return ACOS; +#line 136 "" +{yylval = M_PI ; return NUM;} // constant pi YY_BREAK case 80: YY_RULE_SETUP -#line 135 "QuantityParser.l" -return ASIN; +#line 137 "" +{yylval = M_E ; return NUM;} // constant e YY_BREAK case 81: YY_RULE_SETUP -#line 136 "QuantityParser.l" -return ATAN; +#line 139 "" +return ACOS; YY_BREAK case 82: YY_RULE_SETUP -#line 137 "QuantityParser.l" -return ATAN2; +#line 140 "" +return ASIN; YY_BREAK case 83: YY_RULE_SETUP -#line 138 "QuantityParser.l" -return COS; +#line 141 "" +return ATAN; YY_BREAK case 84: YY_RULE_SETUP -#line 139 "QuantityParser.l" -return EXP; +#line 142 "" +return ATAN2; YY_BREAK case 85: YY_RULE_SETUP -#line 140 "QuantityParser.l" -return ABS; +#line 143 "" +return COS; YY_BREAK case 86: YY_RULE_SETUP -#line 141 "QuantityParser.l" -return MOD; +#line 144 "" +return EXP; YY_BREAK case 87: YY_RULE_SETUP -#line 142 "QuantityParser.l" -return LOG; +#line 145 "" +return ABS; YY_BREAK case 88: YY_RULE_SETUP -#line 143 "QuantityParser.l" -return LOG10; +#line 146 "" +return MOD; YY_BREAK case 89: YY_RULE_SETUP -#line 144 "QuantityParser.l" -return POW; +#line 147 "" +return LOG; YY_BREAK case 90: YY_RULE_SETUP -#line 145 "QuantityParser.l" -return SIN; +#line 148 "" +return LOG10; YY_BREAK case 91: YY_RULE_SETUP -#line 146 "QuantityParser.l" -return SINH; +#line 149 "" +return POW; YY_BREAK case 92: YY_RULE_SETUP -#line 147 "QuantityParser.l" -return TAN; +#line 150 "" +return SIN; YY_BREAK case 93: YY_RULE_SETUP -#line 148 "QuantityParser.l" -return TANH; +#line 151 "" +return SINH; YY_BREAK case 94: YY_RULE_SETUP -#line 149 "QuantityParser.l" -return SQRT; +#line 152 "" +return TAN; YY_BREAK case 95: YY_RULE_SETUP -#line 151 "QuantityParser.l" -return *yytext; +#line 153 "" +return TANH; YY_BREAK case 96: YY_RULE_SETUP -#line 152 "QuantityParser.l" +#line 154 "" +return SQRT; + YY_BREAK +case 97: +YY_RULE_SETUP +#line 156 "" +return *yytext; + YY_BREAK +case 98: +YY_RULE_SETUP +#line 157 "" ECHO; YY_BREAK -#line 1322 "QuantityLexer.c" +#line 1337 "QuantityLexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(C_COMMENT): yyterminate(); @@ -1612,7 +1627,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 >= 168 ) + if ( yy_current_state >= 172 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1640,11 +1655,11 @@ 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 >= 168 ) + if ( yy_current_state >= 172 ) 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 == 167); + yy_is_jam = (yy_current_state == 171); return yy_is_jam ? 0 : yy_current_state; } @@ -2277,4 +2292,4 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 152 "QuantityParser.l" +#line 157 "" diff --git a/src/Base/QuantityParser.c b/src/Base/QuantityParser.c index eab9ae9b72..e9ef6f4be1 100644 --- a/src/Base/QuantityParser.c +++ b/src/Base/QuantityParser.c @@ -112,23 +112,24 @@ extern int yydebug; enum yytokentype { UNIT = 258, NUM = 259, - ACOS = 260, - ASIN = 261, - ATAN = 262, - ATAN2 = 263, - COS = 264, - EXP = 265, - ABS = 266, - MOD = 267, - LOG = 268, - LOG10 = 269, - POW = 270, - SIN = 271, - SINH = 272, - TAN = 273, - TANH = 274, - SQRT = 275, - NEG = 276 + 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 @@ -161,7 +162,7 @@ int yyparse (); /* Copy the second part of user declarations. */ /* Line 390 of yacc.c */ -#line 165 "QuantityParser.c" +#line 166 "QuantityParser.c" #ifdef short # undef short @@ -390,7 +391,7 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 45 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 262 +#define YYLAST 279 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 30 @@ -403,7 +404,7 @@ union yyalloc /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 276 +#define YYMAXUTOK 277 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -415,7 +416,7 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 27, 28, 23, 22, 29, 21, 2, 24, 2, 2, + 27, 28, 23, 22, 29, 2, 2, 24, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -438,7 +439,7 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 25 + 15, 16, 17, 18, 19, 20, 21, 25 }; #if YYDEBUG @@ -457,17 +458,17 @@ static const yytype_int8 yyrhs[] = { 31, 0, -1, -1, 32, -1, 33, -1, 34, -1, 34, 34, -1, 4, -1, 32, 22, 32, -1, 32, - 21, 32, -1, 32, 23, 32, -1, 32, 24, 32, - -1, 21, 32, -1, 32, 26, 32, -1, 27, 32, - 28, -1, 5, 27, 32, 28, -1, 6, 27, 32, - 28, -1, 7, 27, 32, 28, -1, 8, 27, 32, - 29, 32, 28, -1, 11, 27, 32, 28, -1, 10, - 27, 32, 28, -1, 12, 27, 32, 29, 32, 28, - -1, 13, 27, 32, 28, -1, 14, 27, 32, 28, - -1, 15, 27, 32, 29, 32, 28, -1, 16, 27, - 32, 28, -1, 17, 27, 32, 28, -1, 18, 27, - 32, 28, -1, 19, 27, 32, 28, -1, 20, 27, - 32, 28, -1, 9, 27, 32, 28, -1, 3, -1, + 5, 32, -1, 32, 23, 32, -1, 32, 24, 32, + -1, 5, 32, -1, 32, 26, 32, -1, 27, 32, + 28, -1, 6, 27, 32, 28, -1, 7, 27, 32, + 28, -1, 8, 27, 32, 28, -1, 9, 27, 32, + 29, 32, 28, -1, 12, 27, 32, 28, -1, 11, + 27, 32, 28, -1, 13, 27, 32, 29, 32, 28, + -1, 14, 27, 32, 28, -1, 15, 27, 32, 28, + -1, 16, 27, 32, 29, 32, 28, -1, 17, 27, + 32, 28, -1, 18, 27, 32, 28, -1, 19, 27, + 32, 28, -1, 20, 27, 32, 28, -1, 21, 27, + 32, 28, -1, 10, 27, 32, 28, -1, 3, -1, 33, 23, 33, -1, 33, 24, 33, -1, 33, 26, 32, -1, 27, 33, 28, -1, 32, 33, -1 }; @@ -487,10 +488,11 @@ static const yytype_uint8 yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "UNIT", "NUM", "ACOS", "ASIN", "ATAN", - "ATAN2", "COS", "EXP", "ABS", "MOD", "LOG", "LOG10", "POW", "SIN", - "SINH", "TAN", "TANH", "SQRT", "'-'", "'+'", "'*'", "'/'", "NEG", "'^'", - "'('", "')'", "','", "$accept", "input", "num", "unit", "quantity", YY_NULL + "$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 }; #endif @@ -501,7 +503,7 @@ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 45, 43, 42, 47, 276, 94, 40, 41, 44 + 275, 276, 43, 42, 47, 277, 94, 40, 41, 44 }; # endif @@ -530,9 +532,9 @@ static const yytype_uint8 yydefact[] = { 2, 31, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 4, 5, 0, 0, 0, 0, 0, + 0, 0, 3, 4, 5, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 12, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 35, 9, 8, 10, 11, @@ -549,26 +551,26 @@ static const yytype_int8 yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -23 +#define YYPACT_NINF -26 static const yytype_int16 yypact[] = { - 92, -23, -23, -22, -19, -13, -10, -5, -4, 16, - 17, 36, 39, 44, 54, 65, 89, 111, 124, 116, - 92, 7, 38, 91, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 31, 30, 62, -23, 116, 116, 116, 116, - 116, 18, 91, 18, 18, 116, 38, -23, 56, 118, - 126, -20, 134, 142, 150, -11, 158, 166, 46, 174, - 182, 190, 198, 206, -23, -23, 236, 236, 31, 31, - 31, 57, 57, 67, -23, -23, -23, 116, -23, -23, - -23, 116, -23, -23, 116, -23, -23, -23, -23, -23, - 214, 222, 230, -23, -23, -23 + 58, -26, -26, 117, -25, -13, -10, 16, 17, 26, + 29, 32, 54, 56, 57, 59, 62, 63, 65, 66, + 58, 9, 77, -11, 117, 117, -3, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 134, -18, -26, 117, 117, 117, 117, + 117, 18, -11, 18, 18, 117, 77, -26, 141, 148, + 156, -4, 163, 170, 178, 83, 185, 192, 91, 200, + 207, 214, 222, 229, -26, -26, 28, 28, -3, -3, + -3, 69, 69, -15, -26, -26, -26, 117, -26, -26, + -26, 117, -26, -26, 117, -26, -26, -26, -26, -26, + 236, 244, 251, -26, -26, -26 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -23, -23, 0, 20, -8 + -26, -26, 0, 4, -8 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -577,70 +579,72 @@ static const yytype_int8 yypgoto[] = #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { - 22, 46, 47, 48, 49, 25, 50, 45, 26, 87, - 46, 47, 48, 49, 27, 50, 57, 28, 91, 42, - 23, 1, 29, 30, 56, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 1, 52, 31, 32, 51, 76, 77, 78, 79, - 80, 46, 47, 48, 49, 83, 50, 50, 74, 46, - 47, 48, 49, 33, 50, 51, 34, 46, 47, 48, - 49, 35, 50, 81, 82, 94, 52, 46, 47, 48, - 49, 36, 50, 55, 84, 53, 54, 100, 55, 47, - 75, 101, 37, 50, 102, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 53, 54, 38, 55, 0, 20, - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 39, 46, - 47, 48, 49, 41, 50, 0, 85, 46, 47, 48, - 49, 40, 50, 0, 86, 46, 47, 48, 49, 0, - 50, 0, 88, 46, 47, 48, 49, 0, 50, 0, - 89, 46, 47, 48, 49, 0, 50, 0, 90, 46, - 47, 48, 49, 0, 50, 0, 92, 46, 47, 48, - 49, 0, 50, 0, 93, 46, 47, 48, 49, 0, - 50, 0, 95, 46, 47, 48, 49, 0, 50, 0, - 96, 46, 47, 48, 49, 0, 50, 0, 97, 46, - 47, 48, 49, 0, 50, 0, 98, 46, 47, 48, - 49, 0, 50, 0, 99, 46, 47, 48, 49, 0, - 50, 0, 103, 46, 47, 48, 49, 0, 50, 0, - 104, 46, 47, 48, 49, 0, 50, 0, 105, 48, - 49, 0, 50 + 22, 46, 27, 26, 23, 53, 54, 47, 55, 45, + 75, 50, 53, 54, 28, 55, 57, 29, 47, 48, + 49, 1, 50, 50, 56, 87, 52, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 30, 31, 51, 76, 77, 78, 79, + 80, 48, 49, 32, 50, 83, 33, 81, 82, 34, + 52, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 1, 35, 46, 36, 37, 20, 38, 100, 46, 39, + 40, 101, 41, 42, 102, 55, 46, 0, 0, 47, + 48, 49, 0, 50, 51, 47, 48, 49, 0, 50, + 0, 0, 91, 47, 48, 49, 0, 50, 0, 0, + 94, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 46, + 0, 0, 0, 0, 25, 0, 46, 0, 0, 0, + 0, 0, 0, 46, 0, 0, 47, 48, 49, 0, + 50, 46, 74, 47, 48, 49, 0, 50, 46, 84, + 47, 48, 49, 0, 50, 46, 85, 0, 47, 48, + 49, 0, 50, 46, 86, 47, 48, 49, 0, 50, + 46, 88, 47, 48, 49, 0, 50, 46, 89, 0, + 47, 48, 49, 0, 50, 46, 90, 47, 48, 49, + 0, 50, 46, 92, 47, 48, 49, 0, 50, 46, + 93, 0, 47, 48, 49, 0, 50, 46, 95, 47, + 48, 49, 0, 50, 46, 96, 47, 48, 49, 0, + 50, 46, 97, 0, 47, 48, 49, 0, 50, 46, + 98, 47, 48, 49, 0, 50, 46, 99, 47, 48, + 49, 0, 50, 0, 103, 0, 47, 48, 49, 0, + 50, 0, 104, 47, 48, 49, 0, 50, 0, 105 }; #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-23))) + (!!((Yystate) == (-26))) #define yytable_value_is_error(Yytable_value) \ YYID (0) static const yytype_int8 yycheck[] = { - 0, 21, 22, 23, 24, 27, 26, 0, 27, 29, - 21, 22, 23, 24, 27, 26, 24, 27, 29, 19, - 0, 3, 27, 27, 24, 25, 26, 27, 28, 29, + 0, 5, 27, 3, 0, 23, 24, 22, 26, 0, + 28, 26, 23, 24, 27, 26, 24, 27, 22, 23, + 24, 3, 26, 26, 24, 29, 22, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 3, 22, 27, 27, 27, 46, 47, 48, 49, - 50, 21, 22, 23, 24, 55, 26, 26, 28, 21, - 22, 23, 24, 27, 26, 27, 27, 21, 22, 23, - 24, 27, 26, 53, 54, 29, 56, 21, 22, 23, - 24, 27, 26, 26, 28, 23, 24, 87, 26, 22, - 28, 91, 27, 26, 94, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 23, 24, 27, 26, -1, 27, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 27, 21, - 22, 23, 24, 27, 26, -1, 28, 21, 22, 23, - 24, 27, 26, -1, 28, 21, 22, 23, 24, -1, - 26, -1, 28, 21, 22, 23, 24, -1, 26, -1, - 28, 21, 22, 23, 24, -1, 26, -1, 28, 21, - 22, 23, 24, -1, 26, -1, 28, 21, 22, 23, - 24, -1, 26, -1, 28, 21, 22, 23, 24, -1, - 26, -1, 28, 21, 22, 23, 24, -1, 26, -1, - 28, 21, 22, 23, 24, -1, 26, -1, 28, 21, - 22, 23, 24, -1, 26, -1, 28, 21, 22, 23, - 24, -1, 26, -1, 28, 21, 22, 23, 24, -1, - 26, -1, 28, 21, 22, 23, 24, -1, 26, -1, - 28, 21, 22, 23, 24, -1, 26, -1, 28, 23, - 24, -1, 26 + 40, 41, 42, 27, 27, 27, 46, 47, 48, 49, + 50, 23, 24, 27, 26, 55, 27, 53, 54, 27, + 56, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 3, 27, 5, 27, 27, 27, 27, 87, 5, 27, + 27, 91, 27, 27, 94, 26, 5, -1, -1, 22, + 23, 24, -1, 26, 27, 22, 23, 24, -1, 26, + -1, -1, 29, 22, 23, 24, -1, 26, -1, -1, + 29, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 5, + -1, -1, -1, -1, 27, -1, 5, -1, -1, -1, + -1, -1, -1, 5, -1, -1, 22, 23, 24, -1, + 26, 5, 28, 22, 23, 24, -1, 26, 5, 28, + 22, 23, 24, -1, 26, 5, 28, -1, 22, 23, + 24, -1, 26, 5, 28, 22, 23, 24, -1, 26, + 5, 28, 22, 23, 24, -1, 26, 5, 28, -1, + 22, 23, 24, -1, 26, 5, 28, 22, 23, 24, + -1, 26, 5, 28, 22, 23, 24, -1, 26, 5, + 28, -1, 22, 23, 24, -1, 26, 5, 28, 22, + 23, 24, -1, 26, 5, 28, 22, 23, 24, -1, + 26, 5, 28, -1, 22, 23, 24, -1, 26, 5, + 28, 22, 23, 24, -1, 26, 5, 28, 22, 23, + 24, -1, 26, -1, 28, -1, 22, 23, 24, -1, + 26, -1, 28, 22, 23, 24, -1, 26, -1, 28 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -649,9 +653,9 @@ static const yytype_uint8 yystos[] = { 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 27, 31, 32, 33, 34, 27, 27, 27, 27, 27, + 27, 31, 32, 33, 34, 27, 32, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 32, 32, 33, 0, 21, 22, 23, 24, + 27, 27, 27, 32, 33, 0, 5, 22, 23, 24, 26, 27, 33, 23, 24, 26, 32, 34, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 28, 28, 32, 32, 32, 32, @@ -1660,7 +1664,7 @@ yyreduce: /* Line 1787 of yacc.c */ -#line 1664 "QuantityParser.c" +#line 1668 "QuantityParser.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires diff --git a/src/Base/QuantityParser.l b/src/Base/QuantityParser.l index 0f149c2041..ca588a206b 100644 --- a/src/Base/QuantityParser.l +++ b/src/Base/QuantityParser.l @@ -31,12 +31,15 @@ ID [a-z][a-z0-9]* "\]" { BEGIN(INITIAL); } . { ;} - + [ \t] ; [\n]+ ; -[-+()=/*^] { return *yytext; } +[+()=/*^] { return *yytext; } + "-" return MINUSSIGN; + "\xe2\x88\x92" return MINUSSIGN; + "nm" yylval = Quantity::NanoMetre; return UNIT; // nano meter "um" yylval = Quantity::MicroMetre; return UNIT; // micro meter "\xC2\xB5m" yylval = Quantity::MicroMetre; return UNIT; // micro meter (greek micro in UTF8) @@ -45,7 +48,7 @@ ID [a-z][a-z0-9]* "dm" yylval = Quantity::DeciMetre; return UNIT; // deci meter "m" yylval = Quantity::Metre; return UNIT; // metre "km" yylval = Quantity::KiloMetre; return UNIT; // kilo meter - + "l" yylval = Quantity::Liter; return UNIT; // Liter dm^3 "ug" yylval = Quantity::MicroGram; return UNIT; // micro gram @@ -124,9 +127,11 @@ ID [a-z][a-z0-9]* "rad" yylval = Quantity::Radian; return UNIT; // radian "gon" yylval = Quantity::Gon; return UNIT; // gon -{DIGIT}*["."","]{DIGIT}*[eE][-+]?[0-9]+ {for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;} -{DIGIT}*["."","]{DIGIT}* {for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;} -{DIGIT}+ {yylval = atof( yytext ); return NUM;} + +{DIGIT}*["."","]{DIGIT}*[eE][-+]?[0-9]+ { for(char* c=yytext;*c!='\0';c++) if(*c==',') *c='.'; yylval = atof( yytext ); return NUM; } +{DIGIT}*["."","]{DIGIT}* { for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM; } +{DIGIT}+ { yylval = atof( yytext ); return NUM;} + "pi" {yylval = M_PI ; return NUM;} // constant pi "e" {yylval = M_E ; return NUM;} // constant e diff --git a/src/Base/QuantityParser.y b/src/Base/QuantityParser.y index 46f810446e..bf9bd91521 100644 --- a/src/Base/QuantityParser.y +++ b/src/Base/QuantityParser.y @@ -17,9 +17,9 @@ %} /* Bison declarations. */ - %token UNIT NUM + %token UNIT NUM MINUSSIGN %token ACOS ASIN ATAN ATAN2 COS EXP ABS MOD LOG LOG10 POW SIN SINH TAN TANH SQRT; - %left '-' '+' + %left MINUSSIGN '+' %left '*' '/' %left NEG /* negation--unary minus */ %right '^' /* exponentiation */ @@ -38,10 +38,10 @@ ; num: NUM { $$ = $1; } | num '+' num { $$ = $1.getValue() + $3.getValue(); } - | num '-' num { $$ = $1.getValue() - $3.getValue(); } + | num MINUSSIGN num { $$ = $1.getValue() - $3.getValue(); } | num '*' num { $$ = $1.getValue() * $3.getValue(); } | num '/' num { $$ = $1.getValue() / $3.getValue(); } - | '-' num %prec NEG { $$ = -$2.getValue(); } + | MINUSSIGN num %prec NEG { $$ = -$2.getValue(); } | num '^' num { $$ = pow ($1.getValue(), $3.getValue());} | '(' num ')' { $$ = $2; } | ACOS '(' num ')' { $$ = acos($3.getValue()); }