Commit 3f990c4a by alokp@chromium.org

Added lexer rules for operators.

Review URL: https://codereview.appspot.com/5966072 git-svn-id: https://angleproject.googlecode.com/svn/trunk@1014 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 3b130253
...@@ -21,14 +21,27 @@ struct Token ...@@ -21,14 +21,27 @@ struct Token
CONST_INT, CONST_INT,
CONST_FLOAT, CONST_FLOAT,
OP_LEFT_SHIFT, OP_INC,
OP_RIGHT_SHIFT, OP_DEC,
OP_LESS_EQUAL, OP_LEFT,
OP_GREATER_EQUAL, OP_RIGHT,
OP_EQUAL, OP_LE,
OP_NOT_EQUAL, OP_GE,
OP_AND_AND, OP_EQ,
OP_OR_OR OP_NE,
OP_AND,
OP_XOR,
OP_OR,
OP_ADD_ASSIGN,
OP_SUB_ASSIGN,
OP_MUL_ASSIGN,
OP_DIV_ASSIGN,
OP_MOD_ASSIGN,
OP_LEFT_ASSIGN,
OP_RIGHT_ASSIGN,
OP_AND_ASSIGN,
OP_XOR_ASSIGN,
OP_OR_ASSIGN
}; };
struct Location struct Location
{ {
......
...@@ -77,6 +77,28 @@ FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".") ...@@ -77,6 +77,28 @@ FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
return pp::Token::CONST_FLOAT; return pp::Token::CONST_FLOAT;
} }
"++" { return pp::Token::OP_INC; }
"--" { return pp::Token::OP_DEC; }
"<<" { return pp::Token::OP_LEFT; }
">>" { return pp::Token::OP_RIGHT; }
"<=" { return pp::Token::OP_LE; }
">=" { return pp::Token::OP_GE; }
"==" { return pp::Token::OP_EQ; }
"!=" { return pp::Token::OP_NE; }
"&&" { return pp::Token::OP_AND; }
"^^" { return pp::Token::OP_XOR; }
"||" { return pp::Token::OP_OR; }
"+=" { return pp::Token::OP_ADD_ASSIGN; }
"-=" { return pp::Token::OP_SUB_ASSIGN; }
"*=" { return pp::Token::OP_MUL_ASSIGN; }
"/=" { return pp::Token::OP_DIV_ASSIGN; }
"%=" { return pp::Token::OP_MOD_ASSIGN; }
"<<=" { return pp::Token::OP_LEFT_ASSIGN; }
">>=" { return pp::Token::OP_RIGHT_ASSIGN; }
"&=" { return pp::Token::OP_AND_ASSIGN; }
"^=" { return pp::Token::OP_XOR_ASSIGN; }
"|=" { return pp::Token::OP_OR_ASSIGN; }
{PUNCTUATOR} { return yytext[0]; } {PUNCTUATOR} { return yytext[0]; }
[ \t\v\f]+ { /* Ignore whitespace */ } [ \t\v\f]+ { /* Ignore whitespace */ }
......
#line 16 "compiler/preprocessor/new/pp.l" #line 16 "./src/compiler/preprocessor/new/pp.l"
// //
// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#line 13 "compiler/preprocessor/new/pp_lex.cpp" #line 13 "./src/compiler/preprocessor/new/pp_lex.cpp"
#define YY_INT_ALIGNED short int #define YY_INT_ALIGNED short int
...@@ -371,8 +371,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); ...@@ -371,8 +371,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
*yy_cp = '\0'; \ *yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp; yyg->yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 8 #define YY_NUM_RULES 29
#define YY_END_OF_BUFFER 9 #define YY_END_OF_BUFFER 30
/* This struct is not used in this scanner, /* This struct is not used in this scanner,
but its presence is necessary. */ but its presence is necessary. */
struct yy_trans_info struct yy_trans_info
...@@ -380,11 +380,15 @@ struct yy_trans_info ...@@ -380,11 +380,15 @@ struct yy_trans_info
flex_int32_t yy_verify; flex_int32_t yy_verify;
flex_int32_t yy_nxt; flex_int32_t yy_nxt;
}; };
static yyconst flex_int16_t yy_accept[29] = static yyconst flex_int16_t yy_accept[62] =
{ 0, { 0,
0, 0, 9, 8, 6, 7, 5, 1, 5, 3, 0, 0, 30, 29, 27, 28, 26, 1, 26, 26,
3, 2, 6, 4, 4, 3, 0, 0, 0, 3, 26, 26, 26, 26, 26, 26, 3, 3, 26, 26,
2, 0, 0, 4, 3, 0, 4, 0 26, 2, 26, 26, 27, 12, 20, 13, 23, 18,
5, 16, 6, 17, 4, 19, 4, 3, 0, 0,
0, 3, 7, 9, 11, 10, 8, 2, 24, 14,
25, 15, 0, 0, 4, 3, 21, 22, 0, 4,
0
} ; } ;
static yyconst flex_int32_t yy_ec[256] = static yyconst flex_int32_t yy_ec[256] =
...@@ -392,17 +396,17 @@ static yyconst flex_int32_t yy_ec[256] = ...@@ -392,17 +396,17 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 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, 2, 4, 1, 5, 1, 4, 4, 1, 4, 1, 2, 4, 1, 5, 1, 6, 7, 1, 8,
4, 4, 6, 4, 6, 7, 4, 8, 9, 9, 8, 9, 10, 8, 11, 12, 13, 14, 15, 15,
9, 9, 9, 9, 9, 10, 10, 4, 4, 4, 15, 15, 15, 15, 15, 16, 16, 8, 8, 17,
4, 4, 4, 1, 11, 11, 11, 11, 12, 11, 18, 19, 8, 1, 20, 20, 20, 20, 21, 20,
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
13, 13, 13, 13, 13, 13, 13, 14, 13, 13, 22, 22, 22, 22, 22, 22, 22, 23, 22, 22,
4, 1, 4, 4, 13, 1, 11, 11, 11, 11, 8, 1, 8, 24, 22, 1, 20, 20, 20, 20,
12, 11, 13, 13, 13, 13, 13, 13, 13, 13, 21, 20, 22, 22, 22, 22, 22, 22, 22, 22,
13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23,
13, 13, 4, 4, 4, 4, 1, 1, 1, 1, 22, 22, 8, 25, 8, 8, 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, 1, 1, 1, 1,
...@@ -419,54 +423,76 @@ static yyconst flex_int32_t yy_ec[256] = ...@@ -419,54 +423,76 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1 1, 1, 1, 1, 1
} ; } ;
static yyconst flex_int32_t yy_meta[15] = static yyconst flex_int32_t yy_meta[26] =
{ 0, { 0,
1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
5, 6, 7, 7 2, 3, 1, 4, 4, 4, 1, 1, 1, 5,
6, 7, 7, 1, 1
} ; } ;
static yyconst flex_int16_t yy_base[35] = static yyconst flex_int16_t yy_base[68] =
{ 0, { 0,
0, 0, 50, 51, 47, 51, 51, 51, 0, 8, 0, 0, 99, 100, 96, 100, 79, 100, 78, 19,
12, 0, 46, 35, 0, 32, 17, 38, 0, 16, 100, 77, 17, 18, 16, 76, 26, 22, 27, 74,
0, 32, 25, 0, 0, 21, 0, 51, 17, 26, 32, 0, 15, 28, 84, 100, 100, 100, 100, 100,
29, 35, 36, 41 100, 100, 100, 100, 62, 100, 55, 37, 40, 46,
0, 40, 30, 100, 100, 100, 10, 0, 100, 100,
100, 100, 48, 48, 51, 0, 100, 100, 54, 57,
100, 71, 74, 78, 83, 84, 89
} ; } ;
static yyconst flex_int16_t yy_def[35] = static yyconst flex_int16_t yy_def[68] =
{ 0, { 0,
28, 1, 28, 28, 28, 28, 28, 28, 29, 28, 61, 1, 61, 61, 61, 61, 61, 61, 61, 61,
30, 31, 28, 29, 14, 10, 16, 32, 33, 30, 61, 61, 61, 61, 61, 61, 61, 62, 61, 61,
31, 34, 32, 23, 33, 34, 26, 0, 28, 28, 61, 63, 61, 61, 61, 61, 61, 61, 61, 61,
28, 28, 28, 28 61, 61, 61, 61, 64, 61, 64, 17, 38, 65,
66, 62, 61, 61, 61, 61, 61, 63, 61, 61,
61, 61, 67, 61, 61, 66, 61, 61, 61, 61,
0, 61, 61, 61, 61, 61, 61
} ; } ;
static yyconst flex_int16_t yy_nxt[66] = static yyconst flex_int16_t yy_nxt[126] =
{ 0, { 0,
4, 5, 6, 7, 8, 7, 9, 10, 11, 11, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
12, 12, 12, 12, 15, 16, 16, 17, 15, 18, 14, 15, 16, 17, 18, 18, 19, 20, 21, 22,
14, 19, 15, 18, 17, 17, 28, 18, 20, 20, 22, 22, 22, 23, 24, 28, 31, 58, 33, 35,
28, 20, 21, 21, 21, 21, 24, 26, 24, 25, 35, 35, 49, 37, 32, 34, 29, 37, 50, 38,
25, 25, 27, 23, 27, 28, 22, 13, 13, 28, 38, 39, 40, 43, 44, 51, 40, 57, 41, 46,
3, 28, 28, 28, 28, 28, 28, 28, 28, 28, 47, 37, 52, 39, 39, 54, 54, 59, 59, 61,
28, 28, 28, 28, 28 40, 55, 55, 55, 55, 55, 55, 60, 60, 60,
60, 60, 60, 42, 42, 53, 42, 48, 48, 48,
48, 35, 53, 35, 55, 25, 55, 56, 56, 56,
60, 45, 60, 36, 30, 27, 26, 25, 61, 3,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 61, 61, 61
} ; } ;
static yyconst flex_int16_t yy_chk[66] = static yyconst flex_int16_t yy_chk[126] =
{ 0, { 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, 10, 10, 10, 10, 11, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
29, 10, 20, 11, 17, 17, 26, 20, 30, 30, 1, 1, 1, 1, 1, 10, 13, 47, 14, 15,
23, 30, 31, 31, 31, 31, 32, 22, 32, 33, 15, 15, 23, 18, 13, 14, 10, 17, 23, 17,
33, 33, 34, 18, 34, 16, 14, 13, 5, 3, 17, 17, 18, 19, 19, 24, 17, 43, 17, 21,
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 21, 42, 24, 39, 39, 40, 40, 53, 53, 38,
28, 28, 28, 28, 28 42, 54, 54, 54, 55, 55, 55, 59, 59, 59,
60, 60, 60, 62, 62, 37, 62, 63, 63, 63,
63, 64, 35, 64, 65, 25, 65, 66, 66, 66,
67, 20, 67, 16, 12, 9, 7, 5, 3, 61,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 61, 61, 61
} ; } ;
/* Table of booleans, true if rule could match eol. */ /* Table of booleans, true if rule could match eol. */
static yyconst flex_int32_t yy_rule_can_match_eol[9] = static yyconst flex_int32_t yy_rule_can_match_eol[30] =
{ 0, { 0,
0, 0, 0, 0, 0, 0, 1, 0, }; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, };
/* The intent behind this definition is that it'll catch /* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed. * any uses of REJECT which flex missed.
...@@ -787,13 +813,13 @@ yy_match: ...@@ -787,13 +813,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 29 ) if ( yy_current_state >= 62 )
yy_c = yy_meta[(unsigned int) yy_c]; yy_c = yy_meta[(unsigned int) yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp; ++yy_cp;
} }
while ( yy_current_state != 28 ); while ( yy_current_state != 61 );
yy_cp = yyg->yy_last_accepting_cpos; yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state; yy_current_state = yyg->yy_last_accepting_state;
...@@ -854,14 +880,98 @@ YY_RULE_SETUP ...@@ -854,14 +880,98 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 5: case 5:
YY_RULE_SETUP YY_RULE_SETUP
{ return yytext[0]; } { return pp::Token::OP_INC; }
YY_BREAK YY_BREAK
case 6: case 6:
YY_RULE_SETUP YY_RULE_SETUP
{ /* Ignore whitespace */ } { return pp::Token::OP_DEC; }
YY_BREAK YY_BREAK
case 7: case 7:
/* rule 7 can match eol */ YY_RULE_SETUP
{ return pp::Token::OP_LEFT; }
YY_BREAK
case 8:
YY_RULE_SETUP
{ return pp::Token::OP_RIGHT; }
YY_BREAK
case 9:
YY_RULE_SETUP
{ return pp::Token::OP_LE; }
YY_BREAK
case 10:
YY_RULE_SETUP
{ return pp::Token::OP_GE; }
YY_BREAK
case 11:
YY_RULE_SETUP
{ return pp::Token::OP_EQ; }
YY_BREAK
case 12:
YY_RULE_SETUP
{ return pp::Token::OP_NE; }
YY_BREAK
case 13:
YY_RULE_SETUP
{ return pp::Token::OP_AND; }
YY_BREAK
case 14:
YY_RULE_SETUP
{ return pp::Token::OP_XOR; }
YY_BREAK
case 15:
YY_RULE_SETUP
{ return pp::Token::OP_OR; }
YY_BREAK
case 16:
YY_RULE_SETUP
{ return pp::Token::OP_ADD_ASSIGN; }
YY_BREAK
case 17:
YY_RULE_SETUP
{ return pp::Token::OP_SUB_ASSIGN; }
YY_BREAK
case 18:
YY_RULE_SETUP
{ return pp::Token::OP_MUL_ASSIGN; }
YY_BREAK
case 19:
YY_RULE_SETUP
{ return pp::Token::OP_DIV_ASSIGN; }
YY_BREAK
case 20:
YY_RULE_SETUP
{ return pp::Token::OP_MOD_ASSIGN; }
YY_BREAK
case 21:
YY_RULE_SETUP
{ return pp::Token::OP_LEFT_ASSIGN; }
YY_BREAK
case 22:
YY_RULE_SETUP
{ return pp::Token::OP_RIGHT_ASSIGN; }
YY_BREAK
case 23:
YY_RULE_SETUP
{ return pp::Token::OP_AND_ASSIGN; }
YY_BREAK
case 24:
YY_RULE_SETUP
{ return pp::Token::OP_XOR_ASSIGN; }
YY_BREAK
case 25:
YY_RULE_SETUP
{ return pp::Token::OP_OR_ASSIGN; }
YY_BREAK
case 26:
YY_RULE_SETUP
{ return yytext[0]; }
YY_BREAK
case 27:
YY_RULE_SETUP
{ /* Ignore whitespace */ }
YY_BREAK
case 28:
/* rule 28 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
{ {
++yylineno; yycolumn = 0; ++yylineno; yycolumn = 0;
...@@ -871,7 +981,7 @@ YY_RULE_SETUP ...@@ -871,7 +981,7 @@ YY_RULE_SETUP
case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(INITIAL):
{ yyterminate(); } { yyterminate(); }
YY_BREAK YY_BREAK
case 8: case 29:
YY_RULE_SETUP YY_RULE_SETUP
ECHO; ECHO;
YY_BREAK YY_BREAK
...@@ -1167,7 +1277,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) ...@@ -1167,7 +1277,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 29 ) if ( yy_current_state >= 62 )
yy_c = yy_meta[(unsigned int) yy_c]; yy_c = yy_meta[(unsigned int) yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
...@@ -1196,11 +1306,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) ...@@ -1196,11 +1306,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 29 ) if ( yy_current_state >= 62 )
yy_c = yy_meta[(unsigned int) yy_c]; yy_c = yy_meta[(unsigned int) yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 28); yy_is_jam = (yy_current_state == 61);
return yy_is_jam ? 0 : yy_current_state; return yy_is_jam ? 0 : yy_current_state;
} }
......
/* A Bison parser, made by GNU Bison 2.3. */ /* A Bison parser, made by GNU Bison 2.4.2. */
/* Skeleton implementation for Bison's Yacc-like parsers in C /* Skeleton implementation for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
Free Software Foundation, Inc. Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option) the Free Software Foundation, either version 3 of the License, or
any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program. If not, see <http://www.gnu.org/licenses/>. */
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, you may create a larger work that contains /* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work part or all of the Bison parser skeleton and distribute that work
...@@ -29,7 +27,7 @@ ...@@ -29,7 +27,7 @@
special exception, which will cause the skeleton and the resulting special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public Bison output files to be licensed under the GNU General Public
License without this special exception. License without this special exception.
This special exception was added by the Free Software Foundation in This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */ version 2.2 of Bison. */
...@@ -47,7 +45,7 @@ ...@@ -47,7 +45,7 @@
#define YYBISON 1 #define YYBISON 1
/* Bison version. */ /* Bison version. */
#define YYBISON_VERSION "2.3" #define YYBISON_VERSION "2.4.2"
/* Skeleton name. */ /* Skeleton name. */
#define YYSKELETON_NAME "yacc.c" #define YYSKELETON_NAME "yacc.c"
...@@ -55,69 +53,24 @@ ...@@ -55,69 +53,24 @@
/* Pure parsers. */ /* Pure parsers. */
#define YYPURE 1 #define YYPURE 1
/* Push parsers. */
#define YYPUSH 0
/* Pull parsers. */
#define YYPULL 1
/* Using locations. */ /* Using locations. */
#define YYLSP_NEEDED 1 #define YYLSP_NEEDED 1
/* Substitute the variable and function names. */ /* Substitute the variable and function names. */
#define yyparse ppparse #define yyparse ppparse
#define yylex pplex #define yylex pplex
#define yyerror pperror #define yyerror pperror
#define yylval pplval #define yylval pplval
#define yychar ppchar #define yychar ppchar
#define yydebug ppdebug #define yydebug ppdebug
#define yynerrs ppnerrs #define yynerrs ppnerrs
#define yylloc pplloc #define yylloc pplloc
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
HASH = 258,
HASH_UNDEF = 259,
HASH_IF = 260,
HASH_IFDEF = 261,
HASH_IFNDEF = 262,
HASH_ELSE = 263,
HASH_ELIF = 264,
HASH_ENDIF = 265,
DEFINED = 266,
HASH_ERROR = 267,
HASH_PRAGMA = 268,
HASH_EXTENSION = 269,
HASH_VERSION = 270,
HASH_LINE = 271,
HASH_DEFINE_OBJ = 272,
HASH_DEFINE_FUNC = 273,
INT_CONSTANT = 274,
FLOAT_CONSTANT = 275,
IDENTIFIER = 276
};
#endif
/* Tokens. */
#define HASH 258
#define HASH_UNDEF 259
#define HASH_IF 260
#define HASH_IFDEF 261
#define HASH_IFNDEF 262
#define HASH_ELSE 263
#define HASH_ELIF 264
#define HASH_ENDIF 265
#define DEFINED 266
#define HASH_ERROR 267
#define HASH_PRAGMA 268
#define HASH_EXTENSION 269
#define HASH_VERSION 270
#define HASH_LINE 271
#define HASH_DEFINE_OBJ 272
#define HASH_DEFINE_FUNC 273
#define INT_CONSTANT 274
#define FLOAT_CONSTANT 275
#define IDENTIFIER 276
/* Copy the first part of user declarations. */ /* Copy the first part of user declarations. */
...@@ -140,6 +93,7 @@ ...@@ -140,6 +93,7 @@
#define YYDEBUG 1 #define YYDEBUG 1
/* Enabling traces. */ /* Enabling traces. */
#ifndef YYDEBUG #ifndef YYDEBUG
# define YYDEBUG 0 # define YYDEBUG 0
...@@ -158,21 +112,53 @@ ...@@ -158,21 +112,53 @@
# define YYTOKEN_TABLE 0 # define YYTOKEN_TABLE 0
#endif #endif
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
HASH = 258,
HASH_UNDEF = 259,
HASH_IF = 260,
HASH_IFDEF = 261,
HASH_IFNDEF = 262,
HASH_ELSE = 263,
HASH_ELIF = 264,
HASH_ENDIF = 265,
DEFINED = 266,
HASH_ERROR = 267,
HASH_PRAGMA = 268,
HASH_EXTENSION = 269,
HASH_VERSION = 270,
HASH_LINE = 271,
HASH_DEFINE_OBJ = 272,
HASH_DEFINE_FUNC = 273,
INT_CONSTANT = 274,
FLOAT_CONSTANT = 275,
IDENTIFIER = 276
};
#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE typedef union YYSTYPE
{ {
int ival; int ival;
std::string* sval; std::string* sval;
pp::Token* tval; pp::Token* tval;
pp::TokenVector* tlist; pp::TokenVector* tlist;
}
/* Line 187 of yacc.c. */
YYSTYPE;
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif #endif
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
...@@ -201,8 +187,6 @@ static void pushConditionalBlock(pp::Context* context, bool condition); ...@@ -201,8 +187,6 @@ static void pushConditionalBlock(pp::Context* context, bool condition);
static void popConditionalBlock(pp::Context* context); static void popConditionalBlock(pp::Context* context);
/* Line 216 of yacc.c. */
#ifdef short #ifdef short
# undef short # undef short
...@@ -252,7 +236,7 @@ typedef short int yytype_int16; ...@@ -252,7 +236,7 @@ typedef short int yytype_int16;
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_ #ifndef YY_
# if YYENABLE_NLS # if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS # if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid) # define YY_(msgid) dgettext ("bison-runtime", msgid)
...@@ -277,14 +261,14 @@ typedef short int yytype_int16; ...@@ -277,14 +261,14 @@ typedef short int yytype_int16;
#if (defined __STDC__ || defined __C99__FUNC__ \ #if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER) || defined __cplusplus || defined _MSC_VER)
static int static int
YYID (int i) YYID (int yyi)
#else #else
static int static int
YYID (i) YYID (yyi)
int i; int yyi;
#endif #endif
{ {
return i; return yyi;
} }
#endif #endif
...@@ -366,9 +350,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ ...@@ -366,9 +350,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
/* A type that is properly aligned for any stack member. */ /* A type that is properly aligned for any stack member. */
union yyalloc union yyalloc
{ {
yytype_int16 yyss; yytype_int16 yyss_alloc;
YYSTYPE yyvs; YYSTYPE yyvs_alloc;
YYLTYPE yyls; YYLTYPE yyls_alloc;
}; };
/* The size of the maximum gap between one aligned stack and the next. */ /* The size of the maximum gap between one aligned stack and the next. */
...@@ -403,12 +387,12 @@ union yyalloc ...@@ -403,12 +387,12 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next stack. Advance YYPTR to a properly aligned location for the next
stack. */ stack. */
# define YYSTACK_RELOCATE(Stack) \ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \ do \
{ \ { \
YYSIZE_T yynewbytes; \ YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack; \ Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \ yyptr += yynewbytes / sizeof (*yyptr); \
} \ } \
...@@ -712,9 +696,18 @@ static const yytype_uint8 yystos[] = ...@@ -712,9 +696,18 @@ static const yytype_uint8 yystos[] =
/* Like YYERROR except do call yyerror. This remains here temporarily /* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC. to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */ 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 #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
#define YYRECOVERING() (!!yyerrstatus) #define YYRECOVERING() (!!yyerrstatus)
...@@ -771,7 +764,7 @@ while (YYID (0)) ...@@ -771,7 +764,7 @@ while (YYID (0))
we won't break user code: when these are the locations we know. */ we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT #ifndef YY_LOCATION_PRINT
# if YYLTYPE_IS_TRIVIAL # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \ # define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \ fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \ (Loc).first_line, (Loc).first_column, \
...@@ -890,17 +883,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, context) ...@@ -890,17 +883,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, context)
#if (defined __STDC__ || defined __C99__FUNC__ \ #if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER) || defined __cplusplus || defined _MSC_VER)
static void static void
yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
#else #else
static void static void
yy_stack_print (bottom, top) yy_stack_print (yybottom, yytop)
yytype_int16 *bottom; yytype_int16 *yybottom;
yytype_int16 *top; yytype_int16 *yytop;
#endif #endif
{ {
YYFPRINTF (stderr, "Stack now"); YYFPRINTF (stderr, "Stack now");
for (; bottom <= top; ++bottom) for (; yybottom <= yytop; yybottom++)
YYFPRINTF (stderr, " %d", *bottom); {
int yybot = *yybottom;
YYFPRINTF (stderr, " %d", yybot);
}
YYFPRINTF (stderr, "\n"); YYFPRINTF (stderr, "\n");
} }
...@@ -936,11 +932,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule, context) ...@@ -936,11 +932,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule, context)
/* The symbols being reduced. */ /* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++) for (yyi = 0; yyi < yynrhs; yyi++)
{ {
fprintf (stderr, " $%d = ", yyi + 1); YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)]) &(yyvsp[(yyi + 1) - (yynrhs)])
, &(yylsp[(yyi + 1) - (yynrhs)]) , context); , &(yylsp[(yyi + 1) - (yynrhs)]) , context);
fprintf (stderr, "\n"); YYFPRINTF (stderr, "\n");
} }
} }
...@@ -1224,10 +1220,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, context) ...@@ -1224,10 +1220,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, context)
break; break;
} }
} }
/* Prevent warnings from -Wmissing-prototypes. */ /* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM #ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus #if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM); int yyparse (void *YYPARSE_PARAM);
...@@ -1246,10 +1240,9 @@ int yyparse (); ...@@ -1246,10 +1240,9 @@ int yyparse ();
/*-------------------------.
/*----------. | yyparse or yypush_parse. |
| yyparse. | `-------------------------*/
`----------*/
#ifdef YYPARSE_PARAM #ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \ #if (defined __STDC__ || defined __C99__FUNC__ \
...@@ -1273,88 +1266,97 @@ yyparse (context) ...@@ -1273,88 +1266,97 @@ yyparse (context)
#endif #endif
#endif #endif
{ {
/* The look-ahead symbol. */ /* The lookahead symbol. */
int yychar; int yychar;
/* The semantic value of the look-ahead symbol. */ /* The semantic value of the lookahead symbol. */
YYSTYPE yylval; YYSTYPE yylval;
/* Number of syntax errors so far. */ /* Location data for the lookahead symbol. */
int yynerrs;
/* Location data for the look-ahead symbol. */
YYLTYPE yylloc; YYLTYPE yylloc;
int yystate; /* Number of syntax errors so far. */
int yyn; int yynerrs;
int yyresult;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* Look-ahead token as an internal (translated) token number. */
int yytoken = 0;
#if YYERROR_VERBOSE
/* Buffer for error messages, and its allocated size. */
char yymsgbuf[128];
char *yymsg = yymsgbuf;
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
/* Three stacks and their tools: int yystate;
`yyss': related to states, /* Number of tokens to shift before error messages enabled. */
`yyvs': related to semantic values, int yyerrstatus;
`yyls': related to locations.
Refer to the stacks thru separate pointers, to allow yyoverflow /* The stacks and their tools:
to reallocate them elsewhere. */ `yyss': related to states.
`yyvs': related to semantic values.
`yyls': related to locations.
/* The state stack. */ Refer to the stacks thru separate pointers, to allow yyoverflow
yytype_int16 yyssa[YYINITDEPTH]; to reallocate them elsewhere. */
yytype_int16 *yyss = yyssa;
yytype_int16 *yyssp;
/* The semantic value stack. */ /* The state stack. */
YYSTYPE yyvsa[YYINITDEPTH]; yytype_int16 yyssa[YYINITDEPTH];
YYSTYPE *yyvs = yyvsa; yytype_int16 *yyss;
YYSTYPE *yyvsp; yytype_int16 *yyssp;
/* The location stack. */ /* The semantic value stack. */
YYLTYPE yylsa[YYINITDEPTH]; YYSTYPE yyvsa[YYINITDEPTH];
YYLTYPE *yyls = yylsa; YYSTYPE *yyvs;
YYLTYPE *yylsp; YYSTYPE *yyvsp;
/* The locations where the error started and ended. */
YYLTYPE yyerror_range[2];
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) /* The location stack. */
YYLTYPE yylsa[YYINITDEPTH];
YYLTYPE *yyls;
YYLTYPE *yylsp;
/* The locations where the error started and ended. */
YYLTYPE yyerror_range[2];
YYSIZE_T yystacksize = YYINITDEPTH; YYSIZE_T yystacksize;
int yyn;
int yyresult;
/* Lookahead token as an internal (translated) token number. */
int yytoken;
/* The variables used to return semantic value and location from the /* The variables used to return semantic value and location from the
action routines. */ action routines. */
YYSTYPE yyval; YYSTYPE yyval;
YYLTYPE yyloc; YYLTYPE yyloc;
#if YYERROR_VERBOSE
/* Buffer for error messages, and its allocated size. */
char yymsgbuf[128];
char *yymsg = yymsgbuf;
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
/* The number of symbols on the RHS of the reduced rule. /* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */ Keep to zero when no symbol should be popped. */
int yylen = 0; int yylen = 0;
yytoken = 0;
yyss = yyssa;
yyvs = yyvsa;
yyls = yylsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n")); YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0; yystate = 0;
yyerrstatus = 0; yyerrstatus = 0;
yynerrs = 0; yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */ yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers. /* Initialize stack pointers.
Waste one element of value and location stack Waste one element of value and location stack
so that they stay on the same level as the state stack. so that they stay on the same level as the state stack.
The wasted elements are never initialized. */ The wasted elements are never initialized. */
yyssp = yyss; yyssp = yyss;
yyvsp = yyvs; yyvsp = yyvs;
yylsp = yyls; yylsp = yyls;
#if YYLTYPE_IS_TRIVIAL
#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
/* Initialize the default location before parsing starts. */ /* Initialize the default location before parsing starts. */
yylloc.first_line = yylloc.last_line = 1; yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = 0; yylloc.first_column = yylloc.last_column = 1;
#endif #endif
goto yysetstate; goto yysetstate;
...@@ -1393,6 +1395,7 @@ YYLTYPE yylloc; ...@@ -1393,6 +1395,7 @@ YYLTYPE yylloc;
&yyvs1, yysize * sizeof (*yyvsp), &yyvs1, yysize * sizeof (*yyvsp),
&yyls1, yysize * sizeof (*yylsp), &yyls1, yysize * sizeof (*yylsp),
&yystacksize); &yystacksize);
yyls = yyls1; yyls = yyls1;
yyss = yyss1; yyss = yyss1;
yyvs = yyvs1; yyvs = yyvs1;
...@@ -1414,9 +1417,9 @@ YYLTYPE yylloc; ...@@ -1414,9 +1417,9 @@ YYLTYPE yylloc;
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr) if (! yyptr)
goto yyexhaustedlab; goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs); YYSTACK_RELOCATE (yyvs_alloc, yyvs);
YYSTACK_RELOCATE (yyls); YYSTACK_RELOCATE (yyls_alloc, yyls);
# undef YYSTACK_RELOCATE # undef YYSTACK_RELOCATE
if (yyss1 != yyssa) if (yyss1 != yyssa)
YYSTACK_FREE (yyss1); YYSTACK_FREE (yyss1);
...@@ -1437,6 +1440,9 @@ YYLTYPE yylloc; ...@@ -1437,6 +1440,9 @@ YYLTYPE yylloc;
YYDPRINTF ((stderr, "Entering state %d\n", yystate)); YYDPRINTF ((stderr, "Entering state %d\n", yystate));
if (yystate == YYFINAL)
YYACCEPT;
goto yybackup; goto yybackup;
/*-----------. /*-----------.
...@@ -1445,16 +1451,16 @@ YYLTYPE yylloc; ...@@ -1445,16 +1451,16 @@ YYLTYPE yylloc;
yybackup: yybackup:
/* Do appropriate processing given the current state. Read a /* Do appropriate processing given the current state. Read a
look-ahead token if we need one and don't already have one. */ lookahead token if we need one and don't already have one. */
/* First try to decide what to do without reference to look-ahead token. */ /* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate]; yyn = yypact[yystate];
if (yyn == YYPACT_NINF) if (yyn == YYPACT_NINF)
goto yydefault; goto yydefault;
/* Not known => get a look-ahead token if don't already have one. */ /* Not known => get a lookahead token if don't already have one. */
/* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY) if (yychar == YYEMPTY)
{ {
YYDPRINTF ((stderr, "Reading a token: ")); YYDPRINTF ((stderr, "Reading a token: "));
...@@ -1486,20 +1492,16 @@ yybackup: ...@@ -1486,20 +1492,16 @@ yybackup:
goto yyreduce; goto yyreduce;
} }
if (yyn == YYFINAL)
YYACCEPT;
/* Count tokens shifted since error; after three, turn off error /* Count tokens shifted since error; after three, turn off error
status. */ status. */
if (yyerrstatus) if (yyerrstatus)
yyerrstatus--; yyerrstatus--;
/* Shift the look-ahead token. */ /* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
/* Discard the shifted token unless it is eof. */ /* Discard the shifted token. */
if (yychar != YYEOF) yychar = YYEMPTY;
yychar = YYEMPTY;
yystate = yyn; yystate = yyn;
*++yyvsp = yylval; *++yyvsp = yylval;
...@@ -1546,78 +1548,78 @@ yyreduce: ...@@ -1546,78 +1548,78 @@ yyreduce:
pp::TokenVector* out = context->output(); pp::TokenVector* out = context->output();
out->insert(out->end(), (yyvsp[(1) - (2)].tlist)->begin(), (yyvsp[(1) - (2)].tlist)->end()); out->insert(out->end(), (yyvsp[(1) - (2)].tlist)->begin(), (yyvsp[(1) - (2)].tlist)->end());
delete (yyvsp[(1) - (2)].tlist); delete (yyvsp[(1) - (2)].tlist);
;} }
break; break;
case 9: case 9:
{ {
context->defineMacro((yylsp[(1) - (3)]).first_line, pp::Macro::kTypeObj, (yyvsp[(1) - (3)].sval), NULL, (yyvsp[(2) - (3)].tlist)); context->defineMacro((yylsp[(1) - (3)]).first_line, pp::Macro::kTypeObj, (yyvsp[(1) - (3)].sval), NULL, (yyvsp[(2) - (3)].tlist));
;} }
break; break;
case 10: case 10:
{ {
context->defineMacro((yylsp[(1) - (6)]).first_line, pp::Macro::kTypeFunc, (yyvsp[(1) - (6)].sval), (yyvsp[(3) - (6)].tlist), (yyvsp[(5) - (6)].tlist)); context->defineMacro((yylsp[(1) - (6)]).first_line, pp::Macro::kTypeFunc, (yyvsp[(1) - (6)].sval), (yyvsp[(3) - (6)].tlist), (yyvsp[(5) - (6)].tlist));
;} }
break; break;
case 11: case 11:
{ {
context->undefineMacro((yyvsp[(2) - (3)].sval)); context->undefineMacro((yyvsp[(2) - (3)].sval));
;} }
break; break;
case 12: case 12:
{ {
pushConditionalBlock(context, (yyvsp[(2) - (3)].tlist) ? true : false); pushConditionalBlock(context, (yyvsp[(2) - (3)].tlist) ? true : false);
;} }
break; break;
case 13: case 13:
{ {
pushConditionalBlock(context, context->isMacroDefined((yyvsp[(2) - (3)].sval))); pushConditionalBlock(context, context->isMacroDefined((yyvsp[(2) - (3)].sval)));
;} }
break; break;
case 14: case 14:
{ {
pushConditionalBlock(context, !context->isMacroDefined((yyvsp[(2) - (3)].sval))); pushConditionalBlock(context, !context->isMacroDefined((yyvsp[(2) - (3)].sval)));
;} }
break; break;
case 15: case 15:
{ {
;} }
break; break;
case 16: case 16:
{ {
;} }
break; break;
case 17: case 17:
{ {
popConditionalBlock(context); popConditionalBlock(context);
;} }
break; break;
case 23: case 23:
{ (yyval.tlist) = NULL; ;} { (yyval.tlist) = NULL; }
break; break;
case 25: case 25:
{ (yyval.tlist) = NULL; ;} { (yyval.tlist) = NULL; }
break; break;
case 26: case 26:
...@@ -1625,7 +1627,7 @@ yyreduce: ...@@ -1625,7 +1627,7 @@ yyreduce:
{ {
(yyval.tlist) = new pp::TokenVector; (yyval.tlist) = new pp::TokenVector;
(yyval.tlist)->push_back(new pp::Token((yylsp[(1) - (1)]).first_line, IDENTIFIER, (yyvsp[(1) - (1)].sval))); (yyval.tlist)->push_back(new pp::Token((yylsp[(1) - (1)]).first_line, IDENTIFIER, (yyvsp[(1) - (1)].sval)));
;} }
break; break;
case 27: case 27:
...@@ -1633,7 +1635,7 @@ yyreduce: ...@@ -1633,7 +1635,7 @@ yyreduce:
{ {
(yyval.tlist) = (yyvsp[(1) - (3)].tlist); (yyval.tlist) = (yyvsp[(1) - (3)].tlist);
(yyval.tlist)->push_back(new pp::Token((yylsp[(3) - (3)]).first_line, IDENTIFIER, (yyvsp[(3) - (3)].sval))); (yyval.tlist)->push_back(new pp::Token((yylsp[(3) - (3)]).first_line, IDENTIFIER, (yyvsp[(3) - (3)].sval)));
;} }
break; break;
case 28: case 28:
...@@ -1641,7 +1643,7 @@ yyreduce: ...@@ -1641,7 +1643,7 @@ yyreduce:
{ {
(yyval.tlist) = new pp::TokenVector; (yyval.tlist) = new pp::TokenVector;
(yyval.tlist)->push_back((yyvsp[(1) - (1)].tval)); (yyval.tlist)->push_back((yyvsp[(1) - (1)].tval));
;} }
break; break;
case 29: case 29:
...@@ -1649,7 +1651,7 @@ yyreduce: ...@@ -1649,7 +1651,7 @@ yyreduce:
{ {
(yyval.tlist) = (yyvsp[(1) - (2)].tlist); (yyval.tlist) = (yyvsp[(1) - (2)].tlist);
(yyval.tlist)->push_back((yyvsp[(2) - (2)].tval)); (yyval.tlist)->push_back((yyvsp[(2) - (2)].tval));
;} }
break; break;
case 30: case 30:
...@@ -1657,7 +1659,7 @@ yyreduce: ...@@ -1657,7 +1659,7 @@ yyreduce:
{ {
(yyval.tlist) = new pp::TokenVector; (yyval.tlist) = new pp::TokenVector;
(yyval.tlist)->push_back((yyvsp[(1) - (1)].tval)); (yyval.tlist)->push_back((yyvsp[(1) - (1)].tval));
;} }
break; break;
case 31: case 31:
...@@ -1665,171 +1667,170 @@ yyreduce: ...@@ -1665,171 +1667,170 @@ yyreduce:
{ {
(yyval.tlist) = (yyvsp[(1) - (2)].tlist); (yyval.tlist) = (yyvsp[(1) - (2)].tlist);
(yyval.tlist)->push_back((yyvsp[(2) - (2)].tval)); (yyval.tlist)->push_back((yyvsp[(2) - (2)].tval));
;} }
break; break;
case 32: case 32:
{ {
;} }
break; break;
case 33: case 33:
{ {
;} }
break; break;
case 35: case 35:
{ {
(yyval.tval) = new pp::Token((yylsp[(1) - (1)]).first_line, (yyvsp[(1) - (1)].ival), NULL); (yyval.tval) = new pp::Token((yylsp[(1) - (1)]).first_line, (yyvsp[(1) - (1)].ival), NULL);
;} }
break; break;
case 36: case 36:
{ {
(yyval.tval) = new pp::Token((yylsp[(1) - (1)]).first_line, INT_CONSTANT, (yyvsp[(1) - (1)].sval)); (yyval.tval) = new pp::Token((yylsp[(1) - (1)]).first_line, INT_CONSTANT, (yyvsp[(1) - (1)].sval));
;} }
break; break;
case 37: case 37:
{ {
(yyval.tval) = new pp::Token((yylsp[(1) - (1)]).first_line, FLOAT_CONSTANT, (yyvsp[(1) - (1)].sval)); (yyval.tval) = new pp::Token((yylsp[(1) - (1)]).first_line, FLOAT_CONSTANT, (yyvsp[(1) - (1)].sval));
;} }
break; break;
case 38: case 38:
{ {
(yyval.tval) = new pp::Token((yylsp[(1) - (1)]).first_line, IDENTIFIER, (yyvsp[(1) - (1)].sval)); (yyval.tval) = new pp::Token((yylsp[(1) - (1)]).first_line, IDENTIFIER, (yyvsp[(1) - (1)].sval));
;} }
break; break;
case 39: case 39:
{ (yyval.ival) = '['; ;} { (yyval.ival) = '['; }
break; break;
case 40: case 40:
{ (yyval.ival) = ']'; ;} { (yyval.ival) = ']'; }
break; break;
case 41: case 41:
{ (yyval.ival) = '<'; ;} { (yyval.ival) = '<'; }
break; break;
case 42: case 42:
{ (yyval.ival) = '>'; ;} { (yyval.ival) = '>'; }
break; break;
case 43: case 43:
{ (yyval.ival) = '('; ;} { (yyval.ival) = '('; }
break; break;
case 44: case 44:
{ (yyval.ival) = ')'; ;} { (yyval.ival) = ')'; }
break; break;
case 45: case 45:
{ (yyval.ival) = '{'; ;} { (yyval.ival) = '{'; }
break; break;
case 46: case 46:
{ (yyval.ival) = '}'; ;} { (yyval.ival) = '}'; }
break; break;
case 47: case 47:
{ (yyval.ival) = '.'; ;} { (yyval.ival) = '.'; }
break; break;
case 48: case 48:
{ (yyval.ival) = '+'; ;} { (yyval.ival) = '+'; }
break; break;
case 49: case 49:
{ (yyval.ival) = '-'; ;} { (yyval.ival) = '-'; }
break; break;
case 50: case 50:
{ (yyval.ival) = '/'; ;} { (yyval.ival) = '/'; }
break; break;
case 51: case 51:
{ (yyval.ival) = '*'; ;} { (yyval.ival) = '*'; }
break; break;
case 52: case 52:
{ (yyval.ival) = '%'; ;} { (yyval.ival) = '%'; }
break; break;
case 53: case 53:
{ (yyval.ival) = '^'; ;} { (yyval.ival) = '^'; }
break; break;
case 54: case 54:
{ (yyval.ival) = '|'; ;} { (yyval.ival) = '|'; }
break; break;
case 55: case 55:
{ (yyval.ival) = '&'; ;} { (yyval.ival) = '&'; }
break; break;
case 56: case 56:
{ (yyval.ival) = '~'; ;} { (yyval.ival) = '~'; }
break; break;
case 57: case 57:
{ (yyval.ival) = '='; ;} { (yyval.ival) = '='; }
break; break;
case 58: case 58:
{ (yyval.ival) = '!'; ;} { (yyval.ival) = '!'; }
break; break;
case 59: case 59:
{ (yyval.ival) = ':'; ;} { (yyval.ival) = ':'; }
break; break;
case 60: case 60:
{ (yyval.ival) = ';'; ;} { (yyval.ival) = ';'; }
break; break;
case 61: case 61:
{ (yyval.ival) = ','; ;} { (yyval.ival) = ','; }
break; break;
case 62: case 62:
{ (yyval.ival) = '?'; ;} { (yyval.ival) = '?'; }
break; break;
/* Line 1267 of yacc.c. */
default: break; default: break;
} }
...@@ -1906,7 +1907,7 @@ yyerrlab: ...@@ -1906,7 +1907,7 @@ yyerrlab:
if (yyerrstatus == 3) if (yyerrstatus == 3)
{ {
/* If just tried and failed to reuse look-ahead token after an /* If just tried and failed to reuse lookahead token after an
error, discard it. */ error, discard it. */
if (yychar <= YYEOF) if (yychar <= YYEOF)
...@@ -1923,7 +1924,7 @@ yyerrlab: ...@@ -1923,7 +1924,7 @@ yyerrlab:
} }
} }
/* Else will try to reuse look-ahead token after shifting the error /* Else will try to reuse lookahead token after shifting the error
token. */ token. */
goto yyerrlab1; goto yyerrlab1;
...@@ -1981,14 +1982,11 @@ yyerrlab1: ...@@ -1981,14 +1982,11 @@ yyerrlab1:
YY_STACK_PRINT (yyss, yyssp); YY_STACK_PRINT (yyss, yyssp);
} }
if (yyn == YYFINAL)
YYACCEPT;
*++yyvsp = yylval; *++yyvsp = yylval;
yyerror_range[1] = yylloc; yyerror_range[1] = yylloc;
/* Using YYLLOC is tempting, but would change the location of /* Using YYLLOC is tempting, but would change the location of
the look-ahead. YYLOC is available though. */ the lookahead. YYLOC is available though. */
YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
*++yylsp = yyloc; *++yylsp = yyloc;
...@@ -2013,7 +2011,7 @@ yyabortlab: ...@@ -2013,7 +2011,7 @@ yyabortlab:
yyresult = 1; yyresult = 1;
goto yyreturn; goto yyreturn;
#ifndef yyoverflow #if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------. /*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. | | yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/ `-------------------------------------------------*/
...@@ -2024,7 +2022,7 @@ yyexhaustedlab: ...@@ -2024,7 +2022,7 @@ yyexhaustedlab:
#endif #endif
yyreturn: yyreturn:
if (yychar != YYEOF && yychar != YYEMPTY) if (yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead", yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, &yylloc, context); yytoken, &yylval, &yylloc, context);
/* Do not reclaim the symbols of the rule which action triggered /* Do not reclaim the symbols of the rule which action triggered
......
/* A Bison parser, made by GNU Bison 2.3. */ /* A Bison parser, made by GNU Bison 2.4.2. */
/* Skeleton interface for Bison's Yacc-like parsers in C /* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
Free Software Foundation, Inc. Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option) the Free Software Foundation, either version 3 of the License, or
any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program. If not, see <http://www.gnu.org/licenses/>. */
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, you may create a larger work that contains /* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work part or all of the Bison parser skeleton and distribute that work
...@@ -29,10 +27,11 @@ ...@@ -29,10 +27,11 @@
special exception, which will cause the skeleton and the resulting special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public Bison output files to be licensed under the GNU General Public
License without this special exception. License without this special exception.
This special exception was added by the Free Software Foundation in This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */ version 2.2 of Bison. */
/* Tokens. */ /* Tokens. */
#ifndef YYTOKENTYPE #ifndef YYTOKENTYPE
# define YYTOKENTYPE # define YYTOKENTYPE
...@@ -60,45 +59,25 @@ ...@@ -60,45 +59,25 @@
IDENTIFIER = 276 IDENTIFIER = 276
}; };
#endif #endif
/* Tokens. */
#define HASH 258
#define HASH_UNDEF 259
#define HASH_IF 260
#define HASH_IFDEF 261
#define HASH_IFNDEF 262
#define HASH_ELSE 263
#define HASH_ELIF 264
#define HASH_ENDIF 265
#define DEFINED 266
#define HASH_ERROR 267
#define HASH_PRAGMA 268
#define HASH_EXTENSION 269
#define HASH_VERSION 270
#define HASH_LINE 271
#define HASH_DEFINE_OBJ 272
#define HASH_DEFINE_FUNC 273
#define INT_CONSTANT 274
#define FLOAT_CONSTANT 275
#define IDENTIFIER 276
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE typedef union YYSTYPE
{ {
int ival; int ival;
std::string* sval; std::string* sval;
pp::Token* tval; pp::Token* tval;
pp::TokenVector* tlist; pp::TokenVector* tlist;
}
/* Line 1489 of yacc.c. */
YYSTYPE;
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif #endif
...@@ -117,3 +96,4 @@ typedef struct YYLTYPE ...@@ -117,3 +96,4 @@ typedef struct YYLTYPE
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment