ENH: Fix precedence

This commit is contained in:
Andy Cedilnik 2005-10-17 16:53:11 -04:00
parent 985d092d4d
commit f6c00e74c2
2 changed files with 69 additions and 69 deletions

View File

@ -97,7 +97,7 @@
/* Copy the first part of user declarations. */
#line 1 "/home/andy/vtk/CMake/Source/cmExprParser.y"
/*=========================================================================
@ -191,7 +191,7 @@ typedef int YYSTYPE;
/* Line 214 of yacc.c. */
#line 195 "/home/andy/vtk/CMake-bin/Source/cmExprParser.cxx"
#if ! defined (yyoverflow) || YYERROR_VERBOSE
@ -354,7 +354,7 @@ static const unsigned char yytranslate[] =
static const unsigned char yyprhs[] =
{
0, 0, 3, 5, 7, 11, 13, 17, 19, 23,
25, 29, 33, 35, 39, 43, 47, 49, 53, 57,
25, 29, 33, 35, 39, 43, 45, 49, 53, 57,
59
};
@ -363,10 +363,10 @@ static const yysigned_char yyrhs[] =
{
18, 0, -1, 19, -1, 20, -1, 19, 12, 20,
-1, 21, -1, 20, 14, 21, -1, 22, -1, 21,
13, 22, -1, 23, -1, 22, 3, 23, -1, 22,
4, 23, -1, 24, -1, 23, 5, 24, -1, 23,
6, 24, -1, 23, 7, 24, -1, 25, -1, 24,
8, 25, -1, 24, 9, 25, -1, 16, -1, 10,
13, 22, -1, 23, -1, 22, 8, 23, -1, 22,
9, 23, -1, 24, -1, 23, 3, 24, -1, 23,
4, 24, -1, 25, -1, 24, 5, 25, -1, 24,
6, 25, -1, 24, 7, 25, -1, 16, -1, 10,
19, 11, -1
};
@ -374,7 +374,7 @@ static const yysigned_char yyrhs[] =
static const unsigned char yyrline[] =
{
0, 94, 94, 100, 103, 107, 110, 114, 117, 121,
124, 127, 131, 134, 137, 140, 144, 147, 150, 155,
124, 127, 132, 135, 138, 142, 145, 148, 151, 155,
158
};
#endif
@ -388,7 +388,7 @@ static const char *const yytname[] =
"exp_DIVIDE", "exp_MOD", "exp_SHIFTLEFT", "exp_SHIFTRIGHT",
"exp_OPENPARENT", "exp_CLOSEPARENT", "exp_OR", "exp_AND", "exp_XOR",
"exp_NOT", "exp_NUMBER", "$accept", "Start", "exp", "bitwiseor",
"bitwisexor", "bitwiseand", "term", "factor", "shift", 0
"bitwisexor", "bitwiseand", "shift", "term", "factor", 0
};
#endif
@ -406,7 +406,7 @@ static const unsigned short int yytoknum[] =
static const unsigned char yyr1[] =
{
0, 17, 18, 19, 19, 20, 20, 21, 21, 22,
22, 22, 23, 23, 23, 23, 24, 24, 24, 25,
22, 22, 23, 23, 23, 24, 24, 24, 24, 25,
25
};
@ -414,7 +414,7 @@ static const unsigned char yyr1[] =
static const unsigned char yyr2[] =
{
0, 2, 1, 1, 3, 1, 3, 1, 3, 1,
3, 3, 1, 3, 3, 3, 1, 3, 3, 1,
3, 3, 1, 3, 3, 1, 3, 3, 3, 1,
3
};
@ -424,9 +424,9 @@ static const unsigned char yyr2[] =
static const unsigned char yydefact[] =
{
0, 0, 19, 0, 2, 3, 5, 7, 9, 12,
16, 0, 1, 0, 0, 0, 0, 0, 0, 0,
15, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 20, 4, 6, 8, 10, 11, 13,
14, 15, 17, 18
14, 16, 17, 18
};
/* YYDEFGOTO[NTERM-NUM]. */
@ -437,19 +437,19 @@ static const yysigned_char yydefgoto[] =
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
#define YYPACT_NINF -12
#define YYPACT_NINF -14
static const yysigned_char yypact[] =
{
-10, -10, -12, 18, 7, 6, 8, 1, -4, 2,
-12, 3, -12, -10, -10, -10, -10, -10, -10, -10,
-10, -10, -10, -12, 6, 8, 1, -4, -4, 2,
2, 2, -12, -12
-10, -10, -14, 18, 7, 6, 8, 2, 1, -4,
-14, 3, -14, -10, -10, -10, -10, -10, -10, -10,
-10, -10, -10, -14, 6, 8, 2, 1, 1, -4,
-4, -14, -14, -14
};
/* YYPGOTO[NTERM-NUM]. */
static const yysigned_char yypgoto[] =
{
-12, -12, 21, 10, 11, 9, 0, -11, -9
-14, -14, 21, 10, 11, 9, 0, -6, -13
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@ -459,15 +459,15 @@ static const yysigned_char yypgoto[] =
#define YYTABLE_NINF -1
static const unsigned char yytable[] =
{
1, 18, 19, 20, 16, 17, 2, 29, 30, 31,
21, 22, 32, 33, 23, 13, 27, 28, 12, 13,
1, 20, 21, 22, 18, 19, 2, 31, 32, 33,
16, 17, 29, 30, 23, 13, 27, 28, 12, 13,
14, 15, 11, 24, 26, 25
};
static const unsigned char yycheck[] =
{
10, 5, 6, 7, 3, 4, 16, 18, 19, 20,
8, 9, 21, 22, 11, 12, 16, 17, 0, 12,
10, 5, 6, 7, 3, 4, 16, 20, 21, 22,
8, 9, 18, 19, 11, 12, 16, 17, 0, 12,
14, 13, 1, 13, 15, 14
};
@ -476,9 +476,9 @@ static const unsigned char yycheck[] =
static const unsigned char yystos[] =
{
0, 10, 16, 18, 19, 20, 21, 22, 23, 24,
25, 19, 0, 12, 14, 13, 3, 4, 5, 6,
7, 8, 9, 11, 20, 21, 22, 23, 23, 24,
24, 24, 25, 25
25, 19, 0, 12, 14, 13, 8, 9, 3, 4,
5, 6, 7, 11, 20, 21, 22, 23, 23, 24,
24, 25, 25, 25
};
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
@ -1090,99 +1090,99 @@ yyreduce:
switch (yyn)
{
case 2:
#line 95 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{
yyGetParser->SetResult(yyvsp[0].Number);
}
break;
case 3:
#line 101 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[0].Number;}
break;
case 4:
#line 104 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[-2].Number | yyvsp[0].Number;}
break;
case 5:
#line 108 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[0].Number;}
break;
case 6:
#line 111 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[-2].Number ^ yyvsp[0].Number;}
break;
case 7:
#line 115 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[0].Number;}
break;
case 8:
#line 118 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[-2].Number & yyvsp[0].Number;}
break;
case 9:
#line 122 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[0].Number;}
break;
case 10:
#line 125 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[-2].Number + yyvsp[0].Number;}
{yyval.Number = yyvsp[-2].Number << yyvsp[0].Number;}
break;
case 11:
#line 128 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[-2].Number - yyvsp[0].Number;}
{yyval.Number = yyvsp[-2].Number >> yyvsp[0].Number;}
break;
case 12:
#line 132 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[0].Number;}
break;
case 13:
#line 135 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[-2].Number * yyvsp[0].Number;}
{yyval.Number = yyvsp[-2].Number + yyvsp[0].Number;}
break;
case 14:
#line 138 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[-2].Number / yyvsp[0].Number;}
{yyval.Number = yyvsp[-2].Number - yyvsp[0].Number;}
break;
case 15:
#line 141 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[-2].Number % yyvsp[0].Number;}
break;
case 16:
#line 145 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[0].Number;}
break;
case 16:
{yyval.Number = yyvsp[-2].Number * yyvsp[0].Number;}
break;
case 17:
#line 148 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[-2].Number << yyvsp[0].Number;}
{yyval.Number = yyvsp[-2].Number / yyvsp[0].Number;}
break;
case 18:
#line 151 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[-2].Number >> yyvsp[0].Number;}
{yyval.Number = yyvsp[-2].Number % yyvsp[0].Number;}
break;
case 19:
#line 156 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[0].Number;}
break;
case 20:
#line 159 "/home/andy/vtk/CMake/Source/cmExprParser.y"
{yyval.Number = yyvsp[-1].Number;}
break;
@ -1190,7 +1190,7 @@ yyreduce:
}
/* Line 1010 of yacc.c. */
#line 1194 "/home/andy/vtk/CMake-bin/Source/cmExprParser.cxx"
yyvsp -= yylen;
yyssp -= yylen;
@ -1415,7 +1415,7 @@ yyreturn:
}
#line 163 "/home/andy/vtk/CMake/Source/cmExprParser.y"
/* End of grammar */

View File

@ -118,13 +118,24 @@ bitwisexor exp_AND bitwiseand
{$<Number>$ = $<Number>1 & $<Number>3;}
bitwiseand:
shift
{$<Number>$ = $<Number>1;}
|
bitwiseand exp_SHIFTLEFT shift
{$<Number>$ = $<Number>1 << $<Number>3;}
|
bitwiseand exp_SHIFTRIGHT shift
{$<Number>$ = $<Number>1 >> $<Number>3;}
shift:
term
{$<Number>$ = $<Number>1;}
|
bitwiseand exp_PLUS term
shift exp_PLUS term
{$<Number>$ = $<Number>1 + $<Number>3;}
|
bitwiseand exp_MINUS term
shift exp_MINUS term
{$<Number>$ = $<Number>1 - $<Number>3;}
term:
@ -141,17 +152,6 @@ term exp_MOD factor
{$<Number>$ = $<Number>1 % $<Number>3;}
factor:
shift
{$<Number>$ = $<Number>1;}
|
factor exp_SHIFTLEFT shift
{$<Number>$ = $<Number>1 << $<Number>3;}
|
factor exp_SHIFTRIGHT shift
{$<Number>$ = $<Number>1 >> $<Number>3;}
shift:
exp_NUMBER
{$<Number>$ = $<Number>1;}
|