Make Unit string output parsably and add Pascale and Newtons

This commit is contained in:
jriegel
2013-11-10 15:38:23 +01:00
parent fab8d7d70b
commit ac9395d113
5 changed files with 331 additions and 258 deletions

View File

@@ -381,18 +381,18 @@ union yyalloc
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 43
#define YYFINAL 45
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 259
#define YYLAST 262
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 30
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 5
/* YYNRULES -- Number of rules. */
#define YYNRULES 34
#define YYNRULES 35
/* YYNRULES -- Number of states. */
#define YYNSTATES 102
#define YYNSTATES 106
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -442,7 +442,7 @@ static const yytype_uint8 yyprhs[] =
0, 0, 3, 5, 7, 9, 12, 14, 18, 22,
26, 30, 33, 37, 41, 46, 51, 56, 63, 68,
73, 80, 85, 90, 97, 102, 107, 112, 117, 122,
127, 129, 133, 137, 141
127, 129, 133, 137, 141, 145
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -462,7 +462,7 @@ static const yytype_int8 yyrhs[] =
28, -1, 19, 27, 32, 28, -1, 20, 27, 32,
28, -1, 9, 27, 32, 28, -1, 3, -1, 33,
23, 33, -1, 33, 24, 33, -1, 33, 26, 32,
-1, 32, 33, -1
-1, 27, 33, 28, -1, 32, 33, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -471,7 +471,7 @@ static const yytype_uint8 yyrline[] =
0, 26, 26, 27, 28, 29, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
57, 58, 59, 60, 62
57, 58, 59, 60, 61, 63
};
#endif
@@ -504,7 +504,7 @@ static const yytype_uint8 yyr1[] =
0, 30, 31, 31, 31, 31, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
33, 33, 33, 33, 34
33, 33, 33, 33, 33, 34
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -513,7 +513,7 @@ static const yytype_uint8 yyr2[] =
0, 2, 1, 1, 1, 2, 1, 3, 3, 3,
3, 2, 3, 3, 4, 4, 4, 6, 4, 4,
6, 4, 4, 6, 4, 4, 4, 4, 4, 4,
1, 3, 3, 3, 2
1, 3, 3, 3, 3, 2
};
/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
@@ -525,43 +525,43 @@ static const yytype_uint8 yydefact[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 2, 3, 4, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 11, 0, 1, 0, 0, 0, 0, 0, 34,
0, 0, 0, 0, 5, 0, 0, 0, 0, 0,
0, 0, 11, 0, 0, 1, 0, 0, 0, 0,
0, 0, 35, 0, 0, 0, 0, 5, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 13, 8, 7, 9, 10, 12, 31, 32, 33,
14, 15, 16, 0, 29, 19, 18, 0, 21, 22,
0, 24, 25, 26, 27, 28, 0, 0, 0, 17,
20, 23
0, 0, 0, 0, 13, 34, 8, 7, 9, 10,
12, 31, 32, 33, 14, 15, 16, 0, 29, 19,
18, 0, 21, 22, 0, 24, 25, 26, 27, 28,
0, 0, 0, 17, 20, 23
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
-1, 21, 22, 49, 24
-1, 21, 43, 44, 24
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
#define YYPACT_NINF -25
#define YYPACT_NINF -23
static const yytype_int16 yypact[] =
{
69, -25, -25, -24, -23, -5, -4, -3, 3, 4,
5, 27, 28, 29, 35, 40, 72, 78, 86, 30,
30, 70, 88, 229, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 81, 80, -25, 30, 30, 30, 30, 30, 229,
95, 95, 30, 88, -25, 103, 111, 119, 37, 127,
135, 143, 71, 151, 159, 94, 167, 175, 183, 191,
199, -25, 233, 233, 81, 81, 81, 93, 93, 43,
-25, -25, -25, 30, -25, -25, -25, 30, -25, -25,
30, -25, -25, -25, -25, -25, 207, 215, 223, -25,
-25, -25
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
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
-25, -25, -19, 2, 97
-23, -23, 0, 20, -8
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -570,68 +570,70 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
41, 42, 23, 25, 26, 53, 55, 56, 57, 58,
59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
69, 70, 27, 28, 29, 72, 73, 74, 75, 76,
30, 31, 32, 79, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 77, 78, 33, 34, 35, 20, 44, 45,
46, 47, 36, 48, 96, 45, 83, 37, 97, 48,
43, 98, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 1, 44, 45, 46, 47, 20, 48, 1, 38,
87, 44, 45, 46, 47, 39, 48, 48, 71, 44,
45, 46, 47, 40, 48, 44, 45, 46, 47, 52,
48, 54, 0, 90, 44, 45, 46, 47, 0, 48,
0, 80, 44, 45, 46, 47, 0, 48, 0, 81,
44, 45, 46, 47, 0, 48, 0, 82, 44, 45,
46, 47, 0, 48, 0, 84, 44, 45, 46, 47,
0, 48, 0, 85, 44, 45, 46, 47, 0, 48,
0, 86, 44, 45, 46, 47, 0, 48, 0, 88,
44, 45, 46, 47, 0, 48, 0, 89, 44, 45,
46, 47, 0, 48, 0, 91, 44, 45, 46, 47,
0, 48, 0, 92, 44, 45, 46, 47, 0, 48,
0, 93, 44, 45, 46, 47, 0, 48, 0, 94,
44, 45, 46, 47, 0, 48, 0, 95, 44, 45,
46, 47, 0, 48, 0, 99, 44, 45, 46, 47,
0, 48, 0, 100, 44, 45, 46, 47, 0, 48,
0, 101, 50, 51, 0, 52, 46, 47, 0, 48
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
};
#define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-25)))
(!!((Yystate) == (-23)))
#define yytable_value_is_error(Yytable_value) \
YYID (0)
static const yytype_int8 yycheck[] =
{
19, 20, 0, 27, 27, 24, 25, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 27, 27, 27, 44, 45, 46, 47, 48,
27, 27, 27, 52, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 50, 51, 27, 27, 27, 27, 21, 22,
23, 24, 27, 26, 83, 22, 29, 27, 87, 26,
0, 90, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 3, 21, 22, 23, 24, 27, 26, 3, 27,
29, 21, 22, 23, 24, 27, 26, 26, 28, 21,
22, 23, 24, 27, 26, 21, 22, 23, 24, 26,
26, 24, -1, 29, 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, 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, 23, 24, -1, 26
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,
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
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -642,13 +644,13 @@ static const yytype_uint8 yystos[] =
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
27, 31, 32, 33, 34, 27, 27, 27, 27, 27,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
27, 32, 32, 0, 21, 22, 23, 24, 26, 33,
23, 24, 26, 32, 34, 32, 32, 32, 32, 32,
27, 27, 32, 32, 33, 0, 21, 22, 23, 24,
26, 27, 33, 23, 24, 26, 32, 34, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 28, 32, 32, 32, 32, 32, 33, 33, 32,
28, 28, 28, 29, 28, 28, 28, 29, 28, 28,
29, 28, 28, 28, 28, 28, 32, 32, 32, 28,
28, 28
32, 32, 32, 32, 28, 28, 32, 32, 32, 32,
32, 33, 33, 32, 28, 28, 28, 29, 28, 28,
28, 29, 28, 28, 29, 28, 28, 28, 28, 28,
32, 32, 32, 28, 28, 28
};
#define yyerrok (yyerrstatus = 0)
@@ -1633,13 +1635,19 @@ yyreduce:
case 34:
/* Line 1787 of yacc.c */
#line 62 "QuantityParser.y"
#line 61 "QuantityParser.y"
{ (yyval) = (yyvsp[(2) - (3)]); }
break;
case 35:
/* Line 1787 of yacc.c */
#line 63 "QuantityParser.y"
{ (yyval) = (yyvsp[(1) - (2)])*(yyvsp[(2) - (2)]); }
break;
/* Line 1787 of yacc.c */
#line 1643 "QuantityParser.c"
#line 1651 "QuantityParser.c"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -1871,5 +1879,5 @@ yyreturn:
/* Line 2050 of yacc.c */
#line 66 "QuantityParser.y"
#line 67 "QuantityParser.y"