Skip to content

Commit

Permalink
small fix in Quantity lexer
Browse files Browse the repository at this point in the history
  • Loading branch information
jriegel committed Dec 12, 2013
1 parent df53ad4 commit 0db5160
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 105 deletions.
213 changes: 109 additions & 104 deletions src/Base/QuantityLexer.c
Expand Up @@ -361,35 +361,35 @@ static void yy_fatal_error (yyconst char msg[] );
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;

#define YY_NUM_RULES 94
#define YY_END_OF_BUFFER 95
#define YY_NUM_RULES 95
#define YY_END_OF_BUFFER 96
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
{
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[166] =
static yyconst flex_int16_t yy_accept[167] =
{ 0,
0, 0, 0, 0, 95, 94, 4, 5, 36, 38,
0, 0, 0, 0, 96, 94, 4, 5, 36, 38,
6, 74, 75, 25, 94, 94, 65, 29, 94, 49,
94, 94, 94, 63, 1, 94, 94, 94, 77, 94,
19, 24, 94, 94, 15, 13, 94, 94, 94, 94,
22, 21, 94, 94, 94, 3, 2, 5, 74, 0,
74, 75, 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, 76, 0, 0, 0, 0, 0,

46, 0, 0, 32, 0, 16, 41, 8, 0, 0,
73, 56, 55, 0, 67, 84, 0, 0, 0, 82,
47, 70, 83, 72, 54, 62, 48, 44, 86, 0,
40, 23, 85, 33, 88, 61, 71, 89, 0, 91,
0, 0, 31, 0, 17, 9, 57, 78, 79, 80,
0, 0, 90, 93, 92, 39, 0, 0, 81, 87,
58, 59, 0, 60, 0
22, 21, 94, 94, 94, 3, 95, 2, 5, 74,
0, 74, 75, 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, 76, 0, 0, 0, 0,

0, 46, 0, 0, 32, 0, 16, 8, 41, 0,
0, 73, 56, 55, 0, 67, 84, 0, 0, 0,
82, 47, 70, 83, 72, 54, 62, 48, 44, 86,
0, 40, 23, 85, 33, 88, 61, 71, 89, 0,
91, 0, 0, 31, 0, 17, 9, 57, 78, 79,
80, 0, 0, 90, 93, 92, 39, 0, 0, 81,
87, 58, 59, 0, 60, 0
} ;

static yyconst flex_int32_t yy_ec[256] =
Expand Down Expand Up @@ -434,48 +434,48 @@ static yyconst flex_int32_t yy_meta[53] =
1, 1
} ;

static yyconst flex_int16_t yy_base[167] =
static yyconst flex_int16_t yy_base[168] =
{ 0,
0, 0, 50, 51, 219, 220, 220, 215, 47, 220,
220, 54, 63, 220, 194, 195, 220, 220, 66, 177,
187, 173, 199, 167, 220, 52, 52, 30, 162, 164,
168, 220, 168, 80, 55, 112, 168, 155, 54, 177,
67, 57, 86, 73, 152, 220, 220, 199, 105, 128,
144, 153, 220, 174, 220, 220, 173, 220, 220, 156,
154, 220, 153, 156, 160, 167, 220, 220, 149, 147,
158, 220, 149, 220, 150, 220, 220, 220, 161, 220,
220, 152, 89, 152, 220, 220, 220, 144, 220, 68,
220, 92, 220, 220, 220, 136, 147, 150, 140, 135,

220, 138, 136, 220, 129, 220, 220, 220, 148, 132,
162, 220, 220, 125, 220, 220, 123, 121, 119, 220,
220, 220, 220, 220, 220, 220, 220, 220, 141, 106,
220, 220, 220, 220, 220, 220, 220, 114, 101, 99,
85, 85, 220, 86, 220, 220, 220, 220, 220, 112,
101, 63, 220, 220, 220, 220, 45, 27, 220, 220,
220, 220, 17, 220, 220, 54
67, 57, 88, 173, 151, 220, 220, 220, 198, 105,
128, 144, 153, 220, 173, 220, 220, 172, 220, 220,
155, 153, 220, 152, 155, 159, 166, 220, 220, 148,
146, 157, 220, 148, 220, 149, 220, 220, 220, 160,
220, 220, 150, 73, 151, 220, 220, 220, 143, 220,
90, 220, 111, 220, 220, 220, 135, 145, 139, 129,

124, 220, 121, 118, 220, 111, 220, 220, 220, 148,
162, 167, 220, 220, 106, 220, 220, 102, 105, 104,
220, 220, 220, 220, 220, 220, 220, 220, 220, 132,
90, 220, 220, 220, 220, 220, 220, 220, 97, 83,
89, 76, 76, 220, 68, 220, 220, 220, 220, 220,
96, 95, 60, 220, 220, 220, 220, 45, 27, 220,
220, 220, 220, 17, 220, 220, 54
} ;

static yyconst flex_int16_t yy_def[167] =
static yyconst flex_int16_t yy_def[168] =
{ 0,
165, 1, 166, 166, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,

165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 0, 165
166, 1, 167, 167, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,

166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 0, 166
} ;

static yyconst flex_int16_t yy_nxt[273] =
Expand All @@ -485,31 +485,31 @@ static yyconst flex_int16_t yy_nxt[273] =
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, 45, 6, 6, 46, 49, 49, 49, 49, 164,
71, 50, 49, 49, 49, 49, 51, 72, 50, 163,
51, 52, 52, 52, 52, 47, 47, 50, 55, 63,
64, 67, 83, 102, 50, 56, 57, 162, 95, 68,
103, 69, 77, 96, 84, 65, 66, 97, 70, 78,

79, 99, 107, 104, 131, 161, 132, 105, 100, 160,
108, 101, 80, 49, 49, 49, 49, 81, 106, 50,
127, 133, 159, 82, 85, 158, 128, 157, 134, 86,
156, 87, 155, 88, 110, 50, 111, 111, 111, 111,
111, 111, 111, 111, 89, 154, 90, 153, 152, 91,
151, 92, 49, 49, 49, 49, 51, 150, 50, 149,
51, 52, 52, 52, 52, 143, 148, 147, 142, 144,
111, 111, 111, 111, 50, 141, 140, 139, 138, 137,
145, 136, 135, 130, 129, 146, 126, 125, 124, 123,
6, 45, 47, 47, 46, 50, 50, 50, 50, 165,
72, 51, 50, 50, 50, 50, 52, 73, 51, 164,
52, 53, 53, 53, 53, 48, 48, 51, 56, 64,
65, 68, 84, 103, 51, 57, 58, 163, 96, 69,
104, 70, 78, 97, 85, 66, 67, 98, 71, 79,

80, 100, 162, 161, 128, 105, 160, 159, 101, 106,
129, 102, 81, 50, 50, 50, 50, 82, 158, 51,
107, 157, 156, 83, 86, 108, 132, 155, 133, 87,
154, 88, 153, 89, 111, 51, 112, 112, 112, 112,
134, 152, 151, 150, 90, 149, 91, 135, 148, 92,
143, 93, 50, 50, 50, 50, 52, 142, 51, 141,
52, 53, 53, 53, 53, 144, 140, 139, 138, 145,
112, 112, 112, 112, 51, 112, 112, 112, 112, 137,
146, 136, 131, 130, 127, 147, 126, 125, 124, 123,
122, 121, 120, 119, 118, 117, 116, 115, 114, 113,

112, 48, 109, 98, 94, 93, 76, 75, 74, 73,
62, 61, 60, 59, 58, 54, 53, 48, 165, 5,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165
49, 110, 109, 99, 95, 94, 77, 76, 75, 74,
63, 62, 61, 60, 59, 55, 54, 49, 166, 5,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166
} ;

static yyconst flex_int16_t yy_chk[273] =
Expand All @@ -519,31 +519,31 @@ static yyconst flex_int16_t yy_chk[273] =
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, 166, 9, 9, 9, 9, 163,
28, 9, 12, 12, 12, 12, 13, 28, 12, 158,
1, 1, 3, 4, 167, 9, 9, 9, 9, 164,
28, 9, 12, 12, 12, 12, 13, 28, 12, 159,
13, 13, 13, 13, 13, 3, 4, 9, 19, 26,
26, 27, 35, 42, 12, 19, 19, 157, 39, 27,
26, 27, 35, 42, 12, 19, 19, 158, 39, 27,
42, 27, 34, 39, 35, 26, 26, 39, 27, 34,

34, 41, 44, 43, 90, 152, 90, 43, 41, 151,
44, 41, 34, 49, 49, 49, 49, 34, 43, 49,
83, 92, 150, 34, 36, 144, 83, 142, 92, 36,
141, 36, 140, 36, 50, 49, 50, 50, 50, 50,
110, 110, 110, 110, 36, 139, 36, 138, 130, 36,
129, 36, 51, 51, 51, 51, 52, 119, 51, 118,
52, 52, 52, 52, 52, 109, 117, 114, 105, 109,
111, 111, 111, 111, 51, 103, 102, 100, 99, 98,
109, 97, 96, 88, 84, 109, 82, 79, 75, 73,
71, 70, 69, 66, 65, 64, 63, 61, 60, 57,

54, 48, 45, 40, 38, 37, 33, 31, 30, 29,
24, 23, 22, 21, 20, 16, 15, 8, 5, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
165, 165
34, 41, 153, 152, 84, 43, 151, 145, 41, 43,
84, 41, 34, 50, 50, 50, 50, 34, 143, 50,
43, 142, 141, 34, 36, 43, 91, 140, 91, 36,
139, 36, 131, 36, 51, 50, 51, 51, 51, 51,
93, 130, 120, 119, 36, 118, 36, 93, 115, 36,
106, 36, 52, 52, 52, 52, 53, 104, 52, 103,
53, 53, 53, 53, 53, 110, 101, 100, 99, 110,
111, 111, 111, 111, 52, 112, 112, 112, 112, 98,
110, 97, 89, 85, 83, 110, 80, 76, 74, 72,
71, 70, 67, 66, 65, 64, 62, 61, 58, 55,

49, 45, 44, 40, 38, 37, 33, 31, 30, 29,
24, 23, 22, 21, 20, 16, 15, 8, 5, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166
} ;

static yy_state_type yy_last_accepting_state;
Expand Down Expand Up @@ -811,13 +811,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 >= 166 )
if ( yy_current_state >= 167 )
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 != 165 );
while ( yy_current_state != 166 );
yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state);

Expand Down Expand Up @@ -1306,9 +1306,14 @@ return SQRT;
case 94:
YY_RULE_SETUP
#line 150 "QuantityParser.l"
return *yytext;
YY_BREAK
case 95:
YY_RULE_SETUP
#line 151 "QuantityParser.l"
ECHO;
YY_BREAK
#line 1312 "QuantityLexer.c"
#line 1317 "QuantityLexer.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(C_COMMENT):
yyterminate();
Expand Down Expand Up @@ -1602,7 +1607,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 >= 166 )
if ( yy_current_state >= 167 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
Expand Down Expand Up @@ -1630,11 +1635,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 >= 166 )
if ( yy_current_state >= 167 )
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 == 165);
yy_is_jam = (yy_current_state == 166);

return yy_is_jam ? 0 : yy_current_state;
}
Expand Down Expand Up @@ -2267,4 +2272,4 @@ void yyfree (void * ptr )

#define YYTABLES_NAME "yytables"

#line 150 "QuantityParser.l"
#line 151 "QuantityParser.l"
3 changes: 2 additions & 1 deletion src/Base/QuantityParser.l
Expand Up @@ -38,7 +38,7 @@ ID [a-z][a-z0-9]*
[-+()=/*^] { return *yytext; }

"nm" yylval = Quantity::NanoMetre; return UNIT; // nano meter
"ym" yylval = Quantity::MicroMetre; return UNIT; // micro meter
"um" yylval = Quantity::MicroMetre; return UNIT; // micro meter
"\xC2\xB5m" yylval = Quantity::MicroMetre; return UNIT; // micro meter (greek micro in UTF8)
"mm" yylval = Quantity::MilliMetre; return UNIT; // milli meter (internal standard length)
"cm" yylval = Quantity::CentiMetre; return UNIT; // centi meter
Expand Down Expand Up @@ -147,3 +147,4 @@ ID [a-z][a-z0-9]*
"tanh" return TANH;
"sqrt" return SQRT;

. return *yytext;

0 comments on commit 0db5160

Please sign in to comment.