Changeset 642
- Timestamp:
- 07/17/15 13:58:13 (9 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 8 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/field.cpp
r641 r642 19 19 #include "file_writer_filter.hpp" 20 20 #include "pass_through_filter.hpp" 21 #include "filter_expr_node.hpp" 22 #include "lex_parser.hpp" 21 23 22 24 namespace xios{ … … 774 776 if (!instantDataFilter) 775 777 { 778 // Check if we have an expression to parse 779 if (!content.empty()) 780 { 781 boost::scoped_ptr<IFilterExprNode> expr(parseExpr(content + '\0')); 782 instantDataFilter = expr->reduce(gc, *this); 783 } 776 784 // Check if we have a reference on another field 777 if (!field_ref.isEmpty())785 else if (!field_ref.isEmpty()) 778 786 { 779 787 boost::shared_ptr<CPassThroughFilter> passThroughFilter(new CPassThroughFilter(gc)); … … 805 813 } 806 814 } 815 } 816 817 /*! 818 * Returns the source filter to handle a self reference in the field's expression. 819 * If the needed source filter does not exist, it is created, otherwise it is reused. 820 * This method should only be called when building the filter graph corresponding 821 * to the field's expression. 822 * 823 * \param gc the garbage collector to use 824 * \return the output pin corresponding to a self reference 825 */ 826 boost::shared_ptr<COutputPin> CField::getSelfReference(CGarbageCollector& gc) 827 { 828 if (instantDataFilter || content.empty()) 829 ERROR("COutputPin* CField::getSelfReference(CGarbageCollector& gc)", 830 "Impossible to add a self reference to a field which has already been parsed or which does not have an expression."); 831 832 if (!clientSourceFilter) 833 clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(grid)); 834 835 return clientSourceFilter; 807 836 } 808 837 … … 1159 1188 if (content.size() > 0) 1160 1189 { 1161 CSimpleNodeExpr* simpleExpr = parseExpr(content+'\0');1190 CSimpleNodeExpr* simpleExpr;// = parseExpr(content+'\0'); 1162 1191 expression = CFieldNode::newNode(simpleExpr); 1163 1192 delete simpleExpr; -
XIOS/trunk/src/node/field.hpp
r641 r642 133 133 134 134 void buildFilterGraph(CGarbageCollector& gc, bool enableOutput); 135 boost::shared_ptr<COutputPin> getSelfReference(CGarbageCollector& gc); 135 136 136 137 // virtual void fromBinary(StdIStream & is); -
XIOS/trunk/src/parse_expr/expr_node.hpp
r501 r642 5 5 #include "simple_node_expr.hpp" 6 6 #include "operator_expr.hpp" 7 #include "lex_parser.hpp"8 7 9 8 namespace xios -
XIOS/trunk/src/parse_expr/lex_parser.cpp
r501 r642 10 10 #define YY_FLEX_MAJOR_VERSION 2 11 11 #define YY_FLEX_MINOR_VERSION 5 12 #define YY_FLEX_SUBMINOR_VERSION 3 512 #define YY_FLEX_SUBMINOR_VERSION 39 13 13 #if YY_FLEX_SUBMINOR_VERSION > 0 14 14 #define FLEX_BETA … … 55 55 typedef unsigned short int flex_uint16_t; 56 56 typedef unsigned int flex_uint32_t; 57 #endif /* ! C99 */58 57 59 58 /* Limits of integral types. */ … … 85 84 #define UINT32_MAX (4294967295U) 86 85 #endif 86 87 #endif /* ! C99 */ 87 88 88 89 #endif /* ! FLEXINT_H */ … … 142 143 /* Size of default input buffer. */ 143 144 #ifndef YY_BUF_SIZE 145 #ifdef __ia64__ 146 /* On IA-64, the buffer size is 16k, not 8k. 147 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. 148 * Ditto for the __ia64__ case accordingly. 149 */ 150 #define YY_BUF_SIZE 32768 151 #else 144 152 #define YY_BUF_SIZE 16384 153 #endif /* __ia64__ */ 145 154 #endif 146 155 … … 154 163 #endif 155 164 156 extern int yyleng; 165 #ifndef YY_TYPEDEF_YY_SIZE_T 166 #define YY_TYPEDEF_YY_SIZE_T 167 typedef size_t yy_size_t; 168 #endif 169 170 extern yy_size_t yyleng; 157 171 158 172 extern FILE *yyin, *yyout; … … 163 177 164 178 #define YY_LESS_LINENO(n) 179 #define YY_LINENO_REWIND_TO(ptr) 165 180 166 181 /* Return all but the first "n" matched characters back to the input stream. */ … … 180 195 #define unput(c) yyunput( c, (yytext_ptr) ) 181 196 182 #ifndef YY_TYPEDEF_YY_SIZE_T183 #define YY_TYPEDEF_YY_SIZE_T184 typedef size_t yy_size_t;185 #endif186 187 197 #ifndef YY_STRUCT_YY_BUFFER_STATE 188 198 #define YY_STRUCT_YY_BUFFER_STATE … … 202 212 * characters. 203 213 */ 204 int yy_n_chars;214 yy_size_t yy_n_chars; 205 215 206 216 /* Whether we "own" the buffer - i.e., we know we created it, … … 272 282 /* yy_hold_char holds the character lost when yytext is formed. */ 273 283 static char yy_hold_char; 274 static int yy_n_chars; /* number of characters read into yy_ch_buf */275 int yyleng;284 static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ 285 yy_size_t yyleng; 276 286 277 287 /* Points to current character in buffer. */ … … 301 311 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); 302 312 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); 303 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes, int len );313 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); 304 314 305 315 void *yyalloc (yy_size_t ); … … 331 341 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 332 342 333 #define yywrap( n) 1343 #define yywrap() 1 334 344 #define YY_SKIP_YYWRAP 335 345 … … 346 356 extern char *yytext; 347 357 #define yytext_ptr yytext 358 348 359 static yyconst flex_int16_t yy_nxt[][128] = 349 360 { … … 929 940 } 930 941 #undef YY_INPUT 931 #define YY_INPUT(b, r,s) readInputForLexer(b,&r,s)942 #define YY_INPUT(b, r, s) readInputForLexer(b, &r, s) 932 943 #include <string> 933 944 934 int readInputForLexer( char *buffer, int *numBytesRead, int maxBytesToRead ) ; 935 936 937 #include "simple_node_expr.hpp" 945 int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead); 946 947 #include "filter_expr_node.hpp" 938 948 #include "yacc_parser.hpp" 939 949 940 #line 9 41 "lex_parser.cpp"950 #line 951 "lex_parser.cpp" 941 951 942 952 #define INITIAL 0 … … 977 987 void yyset_out (FILE * out_str ); 978 988 979 int yyget_leng (void );989 yy_size_t yyget_leng (void ); 980 990 981 991 char *yyget_text (void ); … … 1019 1029 /* Amount of stuff to slurp up with each read. */ 1020 1030 #ifndef YY_READ_BUF_SIZE 1031 #ifdef __ia64__ 1032 /* On IA-64, the buffer size is 16k, not 8k */ 1033 #define YY_READ_BUF_SIZE 16384 1034 #else 1021 1035 #define YY_READ_BUF_SIZE 8192 1036 #endif /* __ia64__ */ 1022 1037 #endif 1023 1038 … … 1104 1119 register int yy_act; 1105 1120 1106 #line 29 "lex_parser.lex"1107 1108 1109 #line 1110 "lex_parser.cpp"1110 1111 1121 if ( !(yy_init) ) 1112 1122 { … … 1134 1144 yy_load_buffer_state( ); 1135 1145 } 1146 1147 { 1148 #line 29 "lex_parser.lex" 1149 1150 1151 #line 1152 "lex_parser.cpp" 1136 1152 1137 1153 while ( 1 ) /* loops until end-of-file is reached */ … … 1187 1203 #line 33 "lex_parser.lex" 1188 1204 { 1189 yylval.str=new std::string(yytext);1190 return NUMBER;1191 }1205 yylval.str = new std::string(yytext); 1206 return NUMBER; 1207 } 1192 1208 YY_BREAK 1193 1209 case 3: … … 1195 1211 #line 38 "lex_parser.lex" 1196 1212 { 1197 yylval.str=new std::string(yytext+1);1198 return AVERAGE;1199 1213 yylval.str = new std::string(yytext + 1); 1214 return AVERAGE; 1215 } 1200 1216 YY_BREAK 1201 1217 case 4: … … 1203 1219 #line 43 "lex_parser.lex" 1204 1220 { 1205 yylval.str=new std::string(yytext+1);1206 return VAR;1207 1221 yylval.str = new std::string(yytext + 1); 1222 return VAR; 1223 } 1208 1224 YY_BREAK 1209 1225 case 5: … … 1211 1227 #line 48 "lex_parser.lex" 1212 1228 { 1213 yylval.str=new std::string(yytext);1214 return ID;1215 1229 yylval.str = new std::string(yytext); 1230 return ID; 1231 } 1216 1232 YY_BREAK 1217 1233 case 6: 1218 1234 YY_RULE_SETUP 1219 1235 #line 54 "lex_parser.lex" 1220 return (PLUS);1236 return PLUS; 1221 1237 YY_BREAK 1222 1238 case 7: 1223 1239 YY_RULE_SETUP 1224 1240 #line 55 "lex_parser.lex" 1225 return (MINUS);1241 return MINUS; 1226 1242 YY_BREAK 1227 1243 case 8: 1228 1244 YY_RULE_SETUP 1229 1245 #line 57 "lex_parser.lex" 1230 return (TIMES);1246 return TIMES; 1231 1247 YY_BREAK 1232 1248 case 9: 1233 1249 YY_RULE_SETUP 1234 1250 #line 58 "lex_parser.lex" 1235 return (DIVIDE);1251 return DIVIDE; 1236 1252 YY_BREAK 1237 1253 case 10: 1238 1254 YY_RULE_SETUP 1239 1255 #line 60 "lex_parser.lex" 1240 return (POWER);1256 return POWER; 1241 1257 YY_BREAK 1242 1258 case 11: 1243 1259 YY_RULE_SETUP 1244 1260 #line 62 "lex_parser.lex" 1245 return (LEFT_PARENTHESIS);1261 return LEFT_PARENTHESIS; 1246 1262 YY_BREAK 1247 1263 case 12: 1248 1264 YY_RULE_SETUP 1249 1265 #line 63 "lex_parser.lex" 1250 return (RIGHT_PARENTHESIS);1266 return RIGHT_PARENTHESIS; 1251 1267 YY_BREAK 1252 1268 case 13: 1253 1269 YY_RULE_SETUP 1254 1270 #line 65 "lex_parser.lex" 1255 { 1256 return(END); 1257 } 1271 return END; 1258 1272 YY_BREAK 1259 1273 case 14: 1260 1274 YY_RULE_SETUP 1261 #line 6 8"lex_parser.lex"1275 #line 66 "lex_parser.lex" 1262 1276 ECHO; 1263 1277 YY_BREAK 1264 #line 12 65"lex_parser.cpp"1278 #line 1279 "lex_parser.cpp" 1265 1279 case YY_STATE_EOF(INITIAL): 1266 1280 yyterminate(); … … 1393 1407 } /* end of action switch */ 1394 1408 } /* end of scanning one token */ 1409 } /* end of user's declarations */ 1395 1410 } /* end of yylex */ 1396 1411 … … 1448 1463 else 1449 1464 { 1450 int num_to_read =1465 yy_size_t num_to_read = 1451 1466 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1452 1467 … … 1455 1470 1456 1471 /* just a shorter name for the current buffer */ 1457 YY_BUFFER_STATE b = YY_CURRENT_BUFFER ;1472 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; 1458 1473 1459 1474 int yy_c_buf_p_offset = … … 1462 1477 if ( b->yy_is_our_buffer ) 1463 1478 { 1464 int new_size = b->yy_buf_size * 2;1479 yy_size_t new_size = b->yy_buf_size * 2; 1465 1480 1466 1481 if ( new_size <= 0 ) … … 1493 1508 /* Read in more data. */ 1494 1509 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1495 (yy_n_chars), (size_t)num_to_read );1510 (yy_n_chars), num_to_read ); 1496 1511 1497 1512 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); … … 1583 1598 } 1584 1599 1585 return yy_is_jam ? 0 : yy_current_state;1600 return yy_is_jam ? 0 : yy_current_state; 1586 1601 } 1587 1602 … … 1598 1613 { /* need to shift things up to make room */ 1599 1614 /* +2 for EOB chars. */ 1600 register int number_to_move = (yy_n_chars) + 2;1615 register yy_size_t number_to_move = (yy_n_chars) + 2; 1601 1616 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ 1602 1617 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; … … 1647 1662 else 1648 1663 { /* need more input */ 1649 int offset = (yy_c_buf_p) - (yytext_ptr);1664 yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); 1650 1665 ++(yy_c_buf_p); 1651 1666 … … 1807 1822 } 1808 1823 1809 #ifndef __cplusplus1810 extern int isatty (int );1811 #endif /* __cplusplus */1812 1813 1824 /* Initializes or reinitializes a buffer. 1814 1825 * This function is sometimes called more than once on the same buffer, … … 1923 1934 static void yyensure_buffer_stack (void) 1924 1935 { 1925 int num_to_alloc;1936 yy_size_t num_to_alloc; 1926 1937 1927 1938 if (!(yy_buffer_stack)) { … … 2015 2026 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will 2016 2027 * scan from a @e copy of @a bytes. 2017 * @param bytes the byte buffer to scan2018 * @param len the number of bytes in the buffer pointed to by @a bytes.2028 * @param yybytes the byte buffer to scan 2029 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. 2019 2030 * 2020 2031 * @return the newly allocated buffer state object. 2021 2032 */ 2022 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )2033 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) 2023 2034 { 2024 2035 YY_BUFFER_STATE b; 2025 2036 char *buf; 2026 2037 yy_size_t n; 2027 int i;2038 yy_size_t i; 2028 2039 2029 2040 /* Get memory for full buffer, including space for trailing EOB's. */ … … 2107 2118 * 2108 2119 */ 2109 int yyget_leng (void)2120 yy_size_t yyget_leng (void) 2110 2121 { 2111 2122 return yyleng; … … 2255 2266 #define YYTABLES_NAME "yytables" 2256 2267 2257 #line 6 8"lex_parser.lex"2268 #line 65 "lex_parser.lex" -
XIOS/trunk/src/parse_expr/lex_parser.hpp
r501 r642 5 5 namespace xios 6 6 { 7 CSimpleNodeExpr* parseExpr(const std::string& strExpr);7 IFilterExprNode* parseExpr(const std::string& strExpr); 8 8 } 9 9 -
XIOS/trunk/src/parse_expr/lex_parser.lex
r501 r642 7 7 } 8 8 #undef YY_INPUT 9 #define YY_INPUT(b, r,s) readInputForLexer(b,&r,s)9 #define YY_INPUT(b, r, s) readInputForLexer(b, &r, s) 10 10 #include <string> 11 11 12 int readInputForLexer( char *buffer, int *numBytesRead, int maxBytesToRead );12 int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead); 13 13 14 15 #include "simple_node_expr.hpp" 14 #include "filter_expr_node.hpp" 16 15 #include "yacc_parser.hpp" 17 16 18 17 %} 19 18 20 white [ \t]+19 white [ \t]+ 21 20 22 digit [0-9]21 digit [0-9] 23 22 integer {digit}+ 24 23 exponant [eE][+-]?{integer} 25 real {integer}("."{integer})?{exponant}? 26 id [a-zA-Z][a-zA-Z0-9_]* 27 average @{id} 28 var \${id} 24 real {integer}("."{integer})?{exponant}? 25 id [a-zA-Z][a-zA-Z0-9_]* 26 average @{id} 27 var \${id} 28 29 29 %% 30 30 31 {white} { /* We ignore white characters */ }31 {white} { /* We ignore white characters */ } 32 32 33 {real} {34 yylval.str=new std::string(yytext);35 return NUMBER;36 }33 {real} { 34 yylval.str = new std::string(yytext); 35 return NUMBER; 36 } 37 37 38 {average} 39 yylval.str=new std::string(yytext+1);40 return AVERAGE;41 38 {average} { 39 yylval.str = new std::string(yytext + 1); 40 return AVERAGE; 41 } 42 42 43 {var} 44 yylval.str=new std::string(yytext+1);45 return VAR;46 43 {var} { 44 yylval.str = new std::string(yytext + 1); 45 return VAR; 46 } 47 47 48 {id} 49 yylval.str=new std::string(yytext);50 return ID;51 48 {id} { 49 yylval.str = new std::string(yytext); 50 return ID; 51 } 52 52 53 53 54 "+" return (PLUS);55 "-" return (MINUS);54 "+" return PLUS; 55 "-" return MINUS; 56 56 57 "*" return (TIMES);58 "/" return (DIVIDE);57 "*" return TIMES; 58 "/" return DIVIDE; 59 59 60 "^" return (POWER);60 "^" return POWER; 61 61 62 "(" return (LEFT_PARENTHESIS);63 ")" return (RIGHT_PARENTHESIS);62 "(" return LEFT_PARENTHESIS; 63 ")" return RIGHT_PARENTHESIS; 64 64 65 "\0" { 66 return(END); 67 } 65 "\0" return END; -
XIOS/trunk/src/parse_expr/yacc_parser.cpp
r501 r642 1 2 /* A Bison parser, made by GNU Bison 2.4.1. */ 3 4 /* Skeleton implementation for Bison's Yacc-like parsers in C 5 6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 7 Free Software Foundation, Inc. 8 1 /* A Bison parser, made by GNU Bison 3.0.2. */ 2 3 /* Bison implementation for Yacc-like parsers in C 4 5 Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. 6 9 7 This program is free software: you can redistribute it and/or modify 10 8 it under the terms of the GNU General Public License as published by 11 9 the Free Software Foundation, either version 3 of the License, or 12 10 (at your option) any later version. 13 11 14 12 This program is distributed in the hope that it will be useful, 15 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 15 GNU General Public License for more details. 18 16 19 17 You should have received a copy of the GNU General Public License 20 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ … … 29 27 Bison output files to be licensed under the GNU General Public 30 28 License without this special exception. 31 29 32 30 This special exception was added by the Free Software Foundation in 33 31 version 2.2 of Bison. */ … … 47 45 48 46 /* Bison version. */ 49 #define YYBISON_VERSION " 2.4.1"47 #define YYBISON_VERSION "3.0.2" 50 48 51 49 /* Skeleton name. */ … … 61 59 #define YYPULL 1 62 60 63 /* Using locations. */64 #define YYLSP_NEEDED 065 61 66 62 67 63 68 64 /* Copy the first part of user declarations. */ 69 70 /* Line 189 of yacc.c */ 71 #line 1 "yacc_parser.yacc" 72 73 #include "simple_node_expr.hpp" 65 #line 1 "yacc_parser.yacc" /* yacc.c:339 */ 66 67 #include "filter_expr_node.hpp" 74 68 #include <string> 75 69 #include <iostream> 76 70 #include "exception.hpp" 77 71 78 using namespace std 79 using namespace xios 72 using namespace std; 73 using namespace xios; 80 74 81 75 extern "C" … … 83 77 int yyparse(void); 84 78 int yylex(void); 85 int yyerror(const char *s) 79 int yyerror(const char *s); 86 80 } 87 81 88 CSimpleNodeExpr* parsed;89 90 int globalReadOffset=0;91 92 int readInputForLexer( char *buffer, int *numBytesRead, int maxBytesToRead)93 94 int numBytesToRead = maxBytesToRead;95 int bytesRemaining = globalInputText.length()-globalReadOffset;96 int i;97 if ( numBytesToRead > bytesRemaining) numBytesToRead = bytesRemaining;98 for ( i = 0; i < numBytesToRead; i++ ) buffer[i] = globalInputText.c_str()[globalReadOffset+i];82 IFilterExprNode* parsed; 83 std::string globalInputText; 84 size_t globalReadOffset = 0; 85 86 int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead) 87 { 88 size_t numBytesToRead = maxBytesToRead; 89 size_t bytesRemaining = globalInputText.length()-globalReadOffset; 90 size_t i; 91 if (numBytesToRead > bytesRemaining) numBytesToRead = bytesRemaining; 92 for (i = 0; i < numBytesToRead; i++) buffer[i] = globalInputText.c_str()[globalReadOffset + i]; 99 93 *numBytesRead = numBytesToRead; 100 94 globalReadOffset += numBytesToRead; 101 95 return 0; 102 103 104 105 106 /* Line 189 of yacc.c */ 107 # line 108 "yacc_parser.cpp"108 109 /* Enabling traces. */ 110 # ifndef YYDEBUG111 # define YYDEBUG 0112 # endif96 } 97 98 #line 99 "yacc_parser.cpp" /* yacc.c:339 */ 99 100 # ifndef YY_NULLPTR 101 # if defined __cplusplus && 201103L <= __cplusplus 102 # define YY_NULLPTR nullptr 103 # else 104 # define YY_NULLPTR 0 105 # endif 106 # endif 113 107 114 108 /* Enabling verbose error messages. */ … … 120 114 #endif 121 115 122 /* Enabling the token table. */ 123 #ifndef YYTOKEN_TABLE 124 # define YYTOKEN_TABLE 0 125 #endif 126 127 128 /* Tokens. */ 116 /* In a future release of Bison, this section will be replaced 117 by #include "yacc_parser.hpp". */ 118 #ifndef YY_YY_YACC_PARSER_HPP_INCLUDED 119 # define YY_YY_YACC_PARSER_HPP_INCLUDED 120 /* Debug traces. */ 121 #ifndef YYDEBUG 122 # define YYDEBUG 0 123 #endif 124 #if YYDEBUG 125 extern int yydebug; 126 #endif 127 128 /* Token type. */ 129 129 #ifndef YYTOKENTYPE 130 130 # define YYTOKENTYPE 131 /* Put the tokens into the symbol table, so that GDB and other debuggers 132 know about them. */ 133 enum yytokentype { 134 NUMBER = 258, 135 VAR = 259, 136 ID = 260, 137 AVERAGE = 261, 138 PLUS = 262, 139 MINUS = 263, 140 TIMES = 264, 141 DIVIDE = 265, 142 POWER = 266, 143 LEFT_PARENTHESIS = 267, 144 RIGHT_PARENTHESIS = 268, 145 END = 269, 146 NEG = 270 147 }; 148 #endif 149 150 151 131 enum yytokentype 132 { 133 NUMBER = 258, 134 VAR = 259, 135 ID = 260, 136 AVERAGE = 261, 137 PLUS = 262, 138 MINUS = 263, 139 TIMES = 264, 140 DIVIDE = 265, 141 POWER = 266, 142 LEFT_PARENTHESIS = 267, 143 RIGHT_PARENTHESIS = 268, 144 END = 269, 145 NEG = 270 146 }; 147 #endif 148 149 /* Value type. */ 152 150 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 153 typedef union YYSTYPE 154 { 155 156 /* Line 214 of yacc.c */ 157 #line 36 "yacc_parser.yacc" 158 159 std::string* str ; /* symbol table index */ 160 CSimpleNodeExpr* node ; 161 162 163 164 /* Line 214 of yacc.c */ 165 #line 166 "yacc_parser.cpp" 166 } YYSTYPE; 151 typedef union YYSTYPE YYSTYPE; 152 union YYSTYPE 153 { 154 #line 35 "yacc_parser.yacc" /* yacc.c:355 */ 155 156 std::string* str; /* symbol table index */ 157 xios::IScalarExprNode* scalarNode; 158 xios::IFilterExprNode* filterNode; 159 160 #line 161 "yacc_parser.cpp" /* yacc.c:355 */ 161 }; 167 162 # define YYSTYPE_IS_TRIVIAL 1 168 # define yystype YYSTYPE /* obsolescent; will be withdrawn */169 163 # define YYSTYPE_IS_DECLARED 1 170 164 #endif 171 165 172 166 167 extern YYSTYPE yylval; 168 169 int yyparse (void); 170 171 #endif /* !YY_YY_YACC_PARSER_HPP_INCLUDED */ 172 173 173 /* Copy the second part of user declarations. */ 174 174 175 176 /* Line 264 of yacc.c */ 177 #line 178 "yacc_parser.cpp" 175 #line 176 "yacc_parser.cpp" /* yacc.c:358 */ 178 176 179 177 #ifdef short … … 189 187 #ifdef YYTYPE_INT8 190 188 typedef YYTYPE_INT8 yytype_int8; 191 #elif (defined __STDC__ || defined __C99__FUNC__ \ 192 || defined __cplusplus || defined _MSC_VER) 189 #else 193 190 typedef signed char yytype_int8; 194 #else195 typedef short int yytype_int8;196 191 #endif 197 192 … … 213 208 # elif defined size_t 214 209 # define YYSIZE_T size_t 215 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 216 || defined __cplusplus || defined _MSC_VER) 210 # elif ! defined YYSIZE_T 217 211 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 218 212 # define YYSIZE_T size_t … … 225 219 226 220 #ifndef YY_ 227 # if YYENABLE_NLS221 # if defined YYENABLE_NLS && YYENABLE_NLS 228 222 # if ENABLE_NLS 229 223 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 230 # define YY_( msgid) dgettext ("bison-runtime", msgid)224 # define YY_(Msgid) dgettext ("bison-runtime", Msgid) 231 225 # endif 232 226 # endif 233 227 # ifndef YY_ 234 # define YY_(msgid) msgid 228 # define YY_(Msgid) Msgid 229 # endif 230 #endif 231 232 #ifndef YY_ATTRIBUTE 233 # if (defined __GNUC__ \ 234 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ 235 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C 236 # define YY_ATTRIBUTE(Spec) __attribute__(Spec) 237 # else 238 # define YY_ATTRIBUTE(Spec) /* empty */ 239 # endif 240 #endif 241 242 #ifndef YY_ATTRIBUTE_PURE 243 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) 244 #endif 245 246 #ifndef YY_ATTRIBUTE_UNUSED 247 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) 248 #endif 249 250 #if !defined _Noreturn \ 251 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) 252 # if defined _MSC_VER && 1200 <= _MSC_VER 253 # define _Noreturn __declspec (noreturn) 254 # else 255 # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) 235 256 # endif 236 257 #endif … … 238 259 /* Suppress unused-variable warnings by "using" E. */ 239 260 #if ! defined lint || defined __GNUC__ 240 # define YYUSE( e) ((void) (e))261 # define YYUSE(E) ((void) (E)) 241 262 #else 242 # define YYUSE(e) /* empty */ 243 #endif 244 245 /* Identity function, used to suppress warnings about constant conditions. */ 246 #ifndef lint 247 # define YYID(n) (n) 263 # define YYUSE(E) /* empty */ 264 #endif 265 266 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 267 /* Suppress an incorrect diagnostic about yylval being uninitialized. */ 268 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 269 _Pragma ("GCC diagnostic push") \ 270 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ 271 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 272 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 273 _Pragma ("GCC diagnostic pop") 248 274 #else 249 #if (defined __STDC__ || defined __C99__FUNC__ \ 250 || defined __cplusplus || defined _MSC_VER) 251 static int 252 YYID (int yyi) 253 #else 254 static int 255 YYID (yyi) 256 int yyi; 257 #endif 258 { 259 return yyi; 260 } 261 #endif 275 # define YY_INITIAL_VALUE(Value) Value 276 #endif 277 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 278 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 279 # define YY_IGNORE_MAYBE_UNINITIALIZED_END 280 #endif 281 #ifndef YY_INITIAL_VALUE 282 # define YY_INITIAL_VALUE(Value) /* Nothing. */ 283 #endif 284 262 285 263 286 #if ! defined yyoverflow || YYERROR_VERBOSE … … 278 301 # else 279 302 # define YYSTACK_ALLOC alloca 280 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 281 || defined __cplusplus || defined _MSC_VER) 303 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 282 304 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 283 # ifndef _STDLIB_H 284 # define _STDLIB_H 1 305 /* Use EXIT_SUCCESS as a witness for stdlib.h. */ 306 # ifndef EXIT_SUCCESS 307 # define EXIT_SUCCESS 0 285 308 # endif 286 309 # endif … … 290 313 291 314 # ifdef YYSTACK_ALLOC 292 /* Pacify GCC's `empty if-body' warning. */293 # define YYSTACK_FREE(Ptr) do { /* empty */; } while ( YYID (0))315 /* Pacify GCC's 'empty if-body' warning. */ 316 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 294 317 # ifndef YYSTACK_ALLOC_MAXIMUM 295 318 /* The OS might guarantee only one guard page at the bottom of the stack, … … 305 328 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 306 329 # endif 307 # if (defined __cplusplus && ! defined _STDLIB_H\330 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 308 331 && ! ((defined YYMALLOC || defined malloc) \ 309 332 && (defined YYFREE || defined free))) 310 333 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 311 # ifndef _STDLIB_H312 # define _STDLIB_H 1334 # ifndef EXIT_SUCCESS 335 # define EXIT_SUCCESS 0 313 336 # endif 314 337 # endif 315 338 # ifndef YYMALLOC 316 339 # define YYMALLOC malloc 317 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 318 || defined __cplusplus || defined _MSC_VER) 340 # if ! defined malloc && ! defined EXIT_SUCCESS 319 341 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 320 342 # endif … … 322 344 # ifndef YYFREE 323 345 # define YYFREE free 324 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 325 || defined __cplusplus || defined _MSC_VER) 346 # if ! defined free && ! defined EXIT_SUCCESS 326 347 void free (void *); /* INFRINGES ON USER NAME SPACE */ 327 348 # endif … … 333 354 #if (! defined yyoverflow \ 334 355 && (! defined __cplusplus \ 335 356 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 336 357 337 358 /* A type that is properly aligned for any stack member. */ … … 351 372 + YYSTACK_GAP_MAXIMUM) 352 373 353 /* Copy COUNT objects from FROM to TO. The source and destination do 354 not overlap. */ 355 # ifndef YYCOPY 356 # if defined __GNUC__ && 1 < __GNUC__ 357 # define YYCOPY(To, From, Count) \ 358 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 359 # else 360 # define YYCOPY(To, From, Count) \ 361 do \ 362 { \ 363 YYSIZE_T yyi; \ 364 for (yyi = 0; yyi < (Count); yyi++) \ 365 (To)[yyi] = (From)[yyi]; \ 366 } \ 367 while (YYID (0)) 368 # endif 369 # endif 374 # define YYCOPY_NEEDED 1 370 375 371 376 /* Relocate STACK from its old location to the new one. The … … 374 379 stack. Advance YYPTR to a properly aligned location for the next 375 380 stack. */ 376 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 377 do \ 378 { \ 379 YYSIZE_T yynewbytes; \ 380 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 381 Stack = &yyptr->Stack_alloc; \ 382 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 383 yyptr += yynewbytes / sizeof (*yyptr); \ 384 } \ 385 while (YYID (0)) 386 387 #endif 381 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 382 do \ 383 { \ 384 YYSIZE_T yynewbytes; \ 385 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 386 Stack = &yyptr->Stack_alloc; \ 387 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 388 yyptr += yynewbytes / sizeof (*yyptr); \ 389 } \ 390 while (0) 391 392 #endif 393 394 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 395 /* Copy COUNT objects from SRC to DST. The source and destination do 396 not overlap. */ 397 # ifndef YYCOPY 398 # if defined __GNUC__ && 1 < __GNUC__ 399 # define YYCOPY(Dst, Src, Count) \ 400 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) 401 # else 402 # define YYCOPY(Dst, Src, Count) \ 403 do \ 404 { \ 405 YYSIZE_T yyi; \ 406 for (yyi = 0; yyi < (Count); yyi++) \ 407 (Dst)[yyi] = (Src)[yyi]; \ 408 } \ 409 while (0) 410 # endif 411 # endif 412 #endif /* !YYCOPY_NEEDED */ 388 413 389 414 /* YYFINAL -- State number of the termination state. */ … … 398 423 /* YYNRULES -- Number of rules. */ 399 424 #define YYNRULES 32 400 /* YYN RULES -- Number of states. */425 /* YYNSTATES -- Number of states. */ 401 426 #define YYNSTATES 68 402 427 403 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 428 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned 429 by yylex, with out-of-bounds checking. */ 404 430 #define YYUNDEFTOK 2 405 431 #define YYMAXUTOK 270 406 432 407 #define YYTRANSLATE(YYX) 433 #define YYTRANSLATE(YYX) \ 408 434 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 409 435 410 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 436 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM 437 as returned by yylex, without out-of-bounds checking. */ 411 438 static const yytype_uint8 yytranslate[] = 412 439 { … … 442 469 443 470 #if YYDEBUG 444 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 445 YYRHS. */ 446 static const yytype_uint8 yyprhs[] = 447 { 448 0, 0, 3, 5, 8, 10, 12, 16, 20, 24, 449 28, 31, 35, 39, 44, 46, 48, 52, 56, 60, 450 64, 67, 71, 75, 79, 83, 87, 91, 95, 99, 451 103, 107, 111 471 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ 472 static const yytype_uint8 yyrline[] = 473 { 474 0, 59, 59, 60, 64, 65, 66, 67, 68, 69, 475 70, 71, 72, 73, 77, 78, 79, 80, 81, 82, 476 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 477 93, 94, 95 452 478 }; 453 454 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 455 static const yytype_int8 yyrhs[] = 456 { 457 17, 0, -1, 14, -1, 19, 14, -1, 3, -1, 458 4, -1, 18, 7, 18, -1, 18, 8, 18, -1, 459 18, 9, 18, -1, 18, 10, 18, -1, 8, 18, 460 -1, 18, 11, 18, -1, 12, 18, 13, -1, 5, 461 12, 18, 13, -1, 5, -1, 6, -1, 19, 7, 462 19, -1, 19, 8, 19, -1, 19, 9, 19, -1, 463 19, 10, 19, -1, 8, 19, -1, 19, 11, 19, 464 -1, 12, 19, 13, -1, 19, 7, 18, -1, 18, 465 7, 19, -1, 19, 8, 18, -1, 18, 8, 19, 466 -1, 19, 9, 18, -1, 18, 9, 19, -1, 19, 467 10, 18, -1, 18, 10, 19, -1, 19, 11, 18, 468 -1, 5, 12, 19, 13, -1 469 }; 470 471 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 472 static const yytype_uint8 yyrline[] = 473 { 474 0, 58, 58, 59, 63, 64, 65, 66, 67, 68, 475 69, 70, 71, 72, 76, 77, 78, 79, 80, 81, 476 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 477 92, 93, 94 478 }; 479 #endif 480 481 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 479 #endif 480 481 #if YYDEBUG || YYERROR_VERBOSE || 0 482 482 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 483 483 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ … … 487 487 "MINUS", "TIMES", "DIVIDE", "POWER", "LEFT_PARENTHESIS", 488 488 "RIGHT_PARENTHESIS", "END", "NEG", "$accept", "Line", "Expression", 489 "Field_expr", 0489 "Field_expr", YY_NULLPTR 490 490 }; 491 491 #endif 492 492 493 493 # ifdef YYPRINT 494 /* YYTOKNUM[ YYLEX-NUM] -- Internal token number corresponding to495 token YYLEX-NUM. */494 /* YYTOKNUM[NUM] -- (External) token number corresponding to the 495 (internal) symbol number NUM (which must be that of a token). */ 496 496 static const yytype_uint16 yytoknum[] = 497 497 { … … 501 501 # endif 502 502 503 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 504 static const yytype_uint8 yyr1[] = 505 { 506 0, 16, 17, 17, 18, 18, 18, 18, 18, 18, 507 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 508 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 509 19, 19, 19 503 #define YYPACT_NINF -6 504 505 #define yypact_value_is_default(Yystate) \ 506 (!!((Yystate) == (-6))) 507 508 #define YYTABLE_NINF -1 509 510 #define yytable_value_is_error(Yytable_value) \ 511 0 512 513 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 514 STATE-NUM. */ 515 static const yytype_int8 yypact[] = 516 { 517 55, -6, -6, -4, -6, -1, -1, -6, 9, 123, 518 73, -1, 14, 20, 81, 88, -6, -1, -1, -1, 519 -1, 67, -1, -1, -1, -1, -1, -6, 95, 102, 520 -6, -6, 13, 19, 13, 19, 14, 20, 14, 20, 521 -2, 67, 67, 14, 13, 19, 13, 19, 14, 20, 522 14, 20, 14, 20, -6, -6, 67, 14, 109, 67, 523 67, 67, 67, 116, 24, 24, 14, 14 510 524 }; 511 525 512 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 513 static const yytype_uint8 yyr2[] = 514 { 515 0, 2, 1, 2, 1, 1, 3, 3, 3, 3, 516 2, 3, 3, 4, 1, 1, 3, 3, 3, 3, 517 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 518 3, 3, 4 519 }; 520 521 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 522 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 523 means the default is an error. */ 526 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. 527 Performed when YYTABLE does not specify something else to do. Zero 528 means the default is an error. */ 524 529 static const yytype_uint8 yydefact[] = 525 530 { … … 533 538 }; 534 539 535 /* YYDEFGOTO[NTERM-NUM]. */ 540 /* YYPGOTO[NTERM-NUM]. */ 541 static const yytype_int8 yypgoto[] = 542 { 543 -6, -6, -5, 21 544 }; 545 546 /* YYDEFGOTO[NTERM-NUM]. */ 536 547 static const yytype_int8 yydefgoto[] = 537 548 { … … 539 550 }; 540 551 541 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 542 STATE-NUM. */ 543 #define YYPACT_NINF -6 544 static const yytype_int8 yypact[] = 545 { 546 55, -6, -6, -4, -6, -1, -1, -6, 9, 123, 547 73, -1, 14, 20, 81, 88, -6, -1, -1, -1, 548 -1, 67, -1, -1, -1, -1, -1, -6, 95, 102, 549 -6, -6, 13, 19, 13, 19, 14, 20, 14, 20, 550 -2, 67, 67, 14, 13, 19, 13, 19, 14, 20, 551 14, 20, 14, 20, -6, -6, 67, 14, 109, 67, 552 67, 67, 67, 116, 24, 24, 14, 14 553 }; 554 555 /* YYPGOTO[NTERM-NUM]. */ 556 static const yytype_int8 yypgoto[] = 557 { 558 -6, -6, -5, 21 559 }; 560 561 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 562 positive, shift that token. If negative, reduce the rule which 563 number is the opposite. If zero, do what YYDEFACT says. 564 If YYTABLE_NINF, syntax error. */ 565 #define YYTABLE_NINF -1 552 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If 553 positive, shift that token. If negative, reduce the rule whose 554 number is the opposite. If YYTABLE_NINF, syntax error. */ 566 555 static const yytype_uint8 yytable[] = 567 556 { … … 600 589 }; 601 590 602 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing603 symbol of state STATE-NUM. */591 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 592 symbol of state STATE-NUM. */ 604 593 static const yytype_uint8 yystos[] = 605 594 { … … 613 602 }; 614 603 615 #define yyerrok (yyerrstatus = 0) 616 #define yyclearin (yychar = YYEMPTY) 617 #define YYEMPTY (-2) 618 #define YYEOF 0 619 620 #define YYACCEPT goto yyacceptlab 621 #define YYABORT goto yyabortlab 622 #define YYERROR goto yyerrorlab 623 624 625 /* Like YYERROR except do call yyerror. This remains here temporarily 626 to ease the transition to the new meaning of YYERROR, for GCC. 627 Once GCC version 2 has supplanted version 1, this can go. */ 628 629 #define YYFAIL goto yyerrlab 604 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 605 static const yytype_uint8 yyr1[] = 606 { 607 0, 16, 17, 17, 18, 18, 18, 18, 18, 18, 608 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 609 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 610 19, 19, 19 611 }; 612 613 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ 614 static const yytype_uint8 yyr2[] = 615 { 616 0, 2, 1, 2, 1, 1, 3, 3, 3, 3, 617 2, 3, 3, 4, 1, 1, 3, 3, 3, 3, 618 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 619 3, 3, 4 620 }; 621 622 623 #define yyerrok (yyerrstatus = 0) 624 #define yyclearin (yychar = YYEMPTY) 625 #define YYEMPTY (-2) 626 #define YYEOF 0 627 628 #define YYACCEPT goto yyacceptlab 629 #define YYABORT goto yyabortlab 630 #define YYERROR goto yyerrorlab 631 630 632 631 633 #define YYRECOVERING() (!!yyerrstatus) 632 634 633 #define YYBACKUP(Token, Value) 634 do 635 if (yychar == YYEMPTY && yylen == 1)\636 { 637 yychar = (Token); 638 yylval = (Value); 639 yytoken = YYTRANSLATE (yychar);\640 YYPOPSTACK (1);\641 goto yybackup; 642 } 643 else 644 { 635 #define YYBACKUP(Token, Value) \ 636 do \ 637 if (yychar == YYEMPTY) \ 638 { \ 639 yychar = (Token); \ 640 yylval = (Value); \ 641 YYPOPSTACK (yylen); \ 642 yystate = *yyssp; \ 643 goto yybackup; \ 644 } \ 645 else \ 646 { \ 645 647 yyerror (YY_("syntax error: cannot back up")); \ 646 YYERROR; \ 647 } \ 648 while (YYID (0)) 649 650 651 #define YYTERROR 1 652 #define YYERRCODE 256 653 654 655 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 656 If N is 0, then set CURRENT to the empty location which ends 657 the previous symbol: RHS[0] (always defined). */ 658 659 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 660 #ifndef YYLLOC_DEFAULT 661 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 662 do \ 663 if (YYID (N)) \ 664 { \ 665 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 666 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 667 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 668 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 669 } \ 670 else \ 671 { \ 672 (Current).first_line = (Current).last_line = \ 673 YYRHSLOC (Rhs, 0).last_line; \ 674 (Current).first_column = (Current).last_column = \ 675 YYRHSLOC (Rhs, 0).last_column; \ 676 } \ 677 while (YYID (0)) 678 #endif 679 680 681 /* YY_LOCATION_PRINT -- Print the location on the stream. 682 This macro was not mandated originally: define only if we know 683 we won't break user code: when these are the locations we know. */ 684 685 #ifndef YY_LOCATION_PRINT 686 # if YYLTYPE_IS_TRIVIAL 687 # define YY_LOCATION_PRINT(File, Loc) \ 688 fprintf (File, "%d.%d-%d.%d", \ 689 (Loc).first_line, (Loc).first_column, \ 690 (Loc).last_line, (Loc).last_column) 691 # else 692 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 693 # endif 694 #endif 695 696 697 /* YYLEX -- calling `yylex' with the right arguments. */ 698 699 #ifdef YYLEX_PARAM 700 # define YYLEX yylex (YYLEX_PARAM) 701 #else 702 # define YYLEX yylex () 703 #endif 648 YYERROR; \ 649 } \ 650 while (0) 651 652 /* Error token number */ 653 #define YYTERROR 1 654 #define YYERRCODE 256 655 656 704 657 705 658 /* Enable debugging if requested. */ … … 711 664 # endif 712 665 713 # define YYDPRINTF(Args) \ 714 do { \ 715 if (yydebug) \ 716 YYFPRINTF Args; \ 717 } while (YYID (0)) 718 719 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 720 do { \ 721 if (yydebug) \ 722 { \ 723 YYFPRINTF (stderr, "%s ", Title); \ 724 yy_symbol_print (stderr, \ 725 Type, Value); \ 726 YYFPRINTF (stderr, "\n"); \ 727 } \ 728 } while (YYID (0)) 729 730 731 /*--------------------------------. 732 | Print this symbol on YYOUTPUT. | 733 `--------------------------------*/ 734 735 /*ARGSUSED*/ 736 #if (defined __STDC__ || defined __C99__FUNC__ \ 737 || defined __cplusplus || defined _MSC_VER) 666 # define YYDPRINTF(Args) \ 667 do { \ 668 if (yydebug) \ 669 YYFPRINTF Args; \ 670 } while (0) 671 672 /* This macro is provided for backward compatibility. */ 673 #ifndef YY_LOCATION_PRINT 674 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 675 #endif 676 677 678 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 679 do { \ 680 if (yydebug) \ 681 { \ 682 YYFPRINTF (stderr, "%s ", Title); \ 683 yy_symbol_print (stderr, \ 684 Type, Value); \ 685 YYFPRINTF (stderr, "\n"); \ 686 } \ 687 } while (0) 688 689 690 /*----------------------------------------. 691 | Print this symbol's value on YYOUTPUT. | 692 `----------------------------------------*/ 693 738 694 static void 739 695 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 740 #else 741 static void 742 yy_symbol_value_print (yyoutput, yytype, yyvaluep) 743 FILE *yyoutput; 744 int yytype; 745 YYSTYPE const * const yyvaluep; 746 #endif 747 { 696 { 697 FILE *yyo = yyoutput; 698 YYUSE (yyo); 748 699 if (!yyvaluep) 749 700 return; … … 751 702 if (yytype < YYNTOKENS) 752 703 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 753 # else754 YYUSE (yyoutput);755 704 # endif 756 switch (yytype) 757 { 758 default: 759 break; 760 } 705 YYUSE (yytype); 761 706 } 762 707 … … 766 711 `--------------------------------*/ 767 712 768 #if (defined __STDC__ || defined __C99__FUNC__ \769 || defined __cplusplus || defined _MSC_VER)770 713 static void 771 714 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 772 #else 773 static void 774 yy_symbol_print (yyoutput, yytype, yyvaluep) 775 FILE *yyoutput; 776 int yytype; 777 YYSTYPE const * const yyvaluep; 778 #endif 779 { 780 if (yytype < YYNTOKENS) 781 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 782 else 783 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 715 { 716 YYFPRINTF (yyoutput, "%s %s (", 717 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); 784 718 785 719 yy_symbol_value_print (yyoutput, yytype, yyvaluep); … … 792 726 `------------------------------------------------------------------*/ 793 727 794 #if (defined __STDC__ || defined __C99__FUNC__ \795 || defined __cplusplus || defined _MSC_VER)796 728 static void 797 729 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 798 #else799 static void800 yy_stack_print (yybottom, yytop)801 yytype_int16 *yybottom;802 yytype_int16 *yytop;803 #endif804 730 { 805 731 YYFPRINTF (stderr, "Stack now"); … … 812 738 } 813 739 814 # define YY_STACK_PRINT(Bottom, Top) 815 do { 816 if (yydebug) 817 yy_stack_print ((Bottom), (Top)); 818 } while ( YYID (0))740 # define YY_STACK_PRINT(Bottom, Top) \ 741 do { \ 742 if (yydebug) \ 743 yy_stack_print ((Bottom), (Top)); \ 744 } while (0) 819 745 820 746 … … 823 749 `------------------------------------------------*/ 824 750 825 #if (defined __STDC__ || defined __C99__FUNC__ \826 || defined __cplusplus || defined _MSC_VER)827 751 static void 828 yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 829 #else 830 static void 831 yy_reduce_print (yyvsp, yyrule) 832 YYSTYPE *yyvsp; 833 int yyrule; 834 #endif 835 { 752 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) 753 { 754 unsigned long int yylno = yyrline[yyrule]; 836 755 int yynrhs = yyr2[yyrule]; 837 756 int yyi; 838 unsigned long int yylno = yyrline[yyrule];839 757 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 840 758 yyrule - 1, yylno); 841 759 /* The symbols being reduced. */ 842 760 for (yyi = 0; yyi < yynrhs; yyi++) 843 761 { 844 762 YYFPRINTF (stderr, " $%d = ", yyi + 1); 845 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 846 &(yyvsp[(yyi + 1) - (yynrhs)]) 847 ); 763 yy_symbol_print (stderr, 764 yystos[yyssp[yyi + 1 - yynrhs]], 765 &(yyvsp[(yyi + 1) - (yynrhs)]) 766 ); 848 767 YYFPRINTF (stderr, "\n"); 849 768 } 850 769 } 851 770 852 # define YY_REDUCE_PRINT(Rule) 853 do { 854 if (yydebug) 855 yy_reduce_print (yy vsp, Rule); \856 } while ( YYID (0))771 # define YY_REDUCE_PRINT(Rule) \ 772 do { \ 773 if (yydebug) \ 774 yy_reduce_print (yyssp, yyvsp, Rule); \ 775 } while (0) 857 776 858 777 /* Nonzero means print parse trace. It is left uninitialized so that … … 868 787 869 788 /* YYINITDEPTH -- initial size of the parser's stacks. */ 870 #ifndef 789 #ifndef YYINITDEPTH 871 790 # define YYINITDEPTH 200 872 791 #endif … … 882 801 # define YYMAXDEPTH 10000 883 802 #endif 884 885 886 803 887 804 … … 893 810 # else 894 811 /* Return the length of YYSTR. */ 895 #if (defined __STDC__ || defined __C99__FUNC__ \896 || defined __cplusplus || defined _MSC_VER)897 812 static YYSIZE_T 898 813 yystrlen (const char *yystr) 899 #else900 static YYSIZE_T901 yystrlen (yystr)902 const char *yystr;903 #endif904 814 { 905 815 YYSIZE_T yylen; … … 917 827 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 918 828 YYDEST. */ 919 #if (defined __STDC__ || defined __C99__FUNC__ \920 || defined __cplusplus || defined _MSC_VER)921 829 static char * 922 830 yystpcpy (char *yydest, const char *yysrc) 923 #else924 static char *925 yystpcpy (yydest, yysrc)926 char *yydest;927 const char *yysrc;928 #endif929 831 { 930 832 char *yyd = yydest; … … 956 858 957 859 for (;;) 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 860 switch (*++yyp) 861 { 862 case '\'': 863 case ',': 864 goto do_not_strip_quotes; 865 866 case '\\': 867 if (*++yyp != '\\') 868 goto do_not_strip_quotes; 869 /* Fall through. */ 870 default: 871 if (yyres) 872 yyres[yyn] = *yyp; 873 yyn++; 874 break; 875 876 case '"': 877 if (yyres) 878 yyres[yyn] = '\0'; 879 return yyn; 880 } 979 881 do_not_strip_quotes: ; 980 882 } … … 987 889 # endif 988 890 989 /* Copy into YYRESULT an error message about the unexpected token 990 YYCHAR while in state YYSTATE. Return the number of bytes copied, 991 including the terminating null byte. If YYRESULT is null, do not 992 copy anything; just return the number of bytes that would be 993 copied. As a special case, return 0 if an ordinary "syntax error" 994 message will do. Return YYSIZE_MAXIMUM if overflow occurs during 995 size calculation. */ 996 static YYSIZE_T 997 yysyntax_error (char *yyresult, int yystate, int yychar) 998 { 999 int yyn = yypact[yystate]; 1000 1001 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 1002 return 0; 1003 else 891 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message 892 about the unexpected token YYTOKEN for the state stack whose top is 893 YYSSP. 894 895 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is 896 not large enough to hold the message. In that case, also set 897 *YYMSG_ALLOC to the required number of bytes. Return 2 if the 898 required number of bytes is too large to store. */ 899 static int 900 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 901 yytype_int16 *yyssp, int yytoken) 902 { 903 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); 904 YYSIZE_T yysize = yysize0; 905 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 906 /* Internationalized format string. */ 907 const char *yyformat = YY_NULLPTR; 908 /* Arguments of yyformat. */ 909 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 910 /* Number of reported tokens (one for the "unexpected", one per 911 "expected"). */ 912 int yycount = 0; 913 914 /* There are many possibilities here to consider: 915 - If this state is a consistent state with a default action, then 916 the only way this function was invoked is if the default action 917 is an error action. In that case, don't check for expected 918 tokens because there are none. 919 - The only way there can be no lookahead present (in yychar) is if 920 this state is a consistent state with a default action. Thus, 921 detecting the absence of a lookahead is sufficient to determine 922 that there is no unexpected or expected token to report. In that 923 case, just report a simple "syntax error". 924 - Don't assume there isn't a lookahead just because this state is a 925 consistent state with a default action. There might have been a 926 previous inconsistent state, consistent state with a non-default 927 action, or user semantic action that manipulated yychar. 928 - Of course, the expected token list depends on states to have 929 correct lookahead information, and it depends on the parser not 930 to perform extra reductions after fetching a lookahead from the 931 scanner and before detecting a syntax error. Thus, state merging 932 (from LALR or IELR) and default reductions corrupt the expected 933 token list. However, the list is correct for canonical LR with 934 one exception: it will still contain any token that will not be 935 accepted due to an error action in a later state. 936 */ 937 if (yytoken != YYEMPTY) 1004 938 { 1005 int yytype = YYTRANSLATE (yychar); 1006 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 1007 YYSIZE_T yysize = yysize0; 1008 YYSIZE_T yysize1; 1009 int yysize_overflow = 0; 1010 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1011 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1012 int yyx; 1013 1014 # if 0 1015 /* This is so xgettext sees the translatable formats that are 1016 constructed on the fly. */ 1017 YY_("syntax error, unexpected %s"); 1018 YY_("syntax error, unexpected %s, expecting %s"); 1019 YY_("syntax error, unexpected %s, expecting %s or %s"); 1020 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 1021 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 1022 # endif 1023 char *yyfmt; 1024 char const *yyf; 1025 static char const yyunexpected[] = "syntax error, unexpected %s"; 1026 static char const yyexpecting[] = ", expecting %s"; 1027 static char const yyor[] = " or %s"; 1028 char yyformat[sizeof yyunexpected 1029 + sizeof yyexpecting - 1 1030 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 1031 * (sizeof yyor - 1))]; 1032 char const *yyprefix = yyexpecting; 1033 1034 /* Start YYX at -YYN if negative to avoid negative indexes in 1035 YYCHECK. */ 1036 int yyxbegin = yyn < 0 ? -yyn : 0; 1037 1038 /* Stay within bounds of both yycheck and yytname. */ 1039 int yychecklim = YYLAST - yyn + 1; 1040 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1041 int yycount = 1; 1042 1043 yyarg[0] = yytname[yytype]; 1044 yyfmt = yystpcpy (yyformat, yyunexpected); 1045 1046 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1047 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 1048 { 1049 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1050 { 1051 yycount = 1; 1052 yysize = yysize0; 1053 yyformat[sizeof yyunexpected - 1] = '\0'; 1054 break; 1055 } 1056 yyarg[yycount++] = yytname[yyx]; 1057 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 1058 yysize_overflow |= (yysize1 < yysize); 1059 yysize = yysize1; 1060 yyfmt = yystpcpy (yyfmt, yyprefix); 1061 yyprefix = yyor; 1062 } 1063 1064 yyf = YY_(yyformat); 1065 yysize1 = yysize + yystrlen (yyf); 1066 yysize_overflow |= (yysize1 < yysize); 1067 yysize = yysize1; 1068 1069 if (yysize_overflow) 1070 return YYSIZE_MAXIMUM; 1071 1072 if (yyresult) 1073 { 1074 /* Avoid sprintf, as that infringes on the user's name space. 1075 Don't have undefined behavior even if the translation 1076 produced a string with the wrong number of "%s"s. */ 1077 char *yyp = yyresult; 1078 int yyi = 0; 1079 while ((*yyp = *yyf) != '\0') 1080 { 1081 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 1082 { 1083 yyp += yytnamerr (yyp, yyarg[yyi++]); 1084 yyf += 2; 1085 } 1086 else 1087 { 1088 yyp++; 1089 yyf++; 1090 } 1091 } 1092 } 1093 return yysize; 939 int yyn = yypact[*yyssp]; 940 yyarg[yycount++] = yytname[yytoken]; 941 if (!yypact_value_is_default (yyn)) 942 { 943 /* Start YYX at -YYN if negative to avoid negative indexes in 944 YYCHECK. In other words, skip the first -YYN actions for 945 this state because they are default actions. */ 946 int yyxbegin = yyn < 0 ? -yyn : 0; 947 /* Stay within bounds of both yycheck and yytname. */ 948 int yychecklim = YYLAST - yyn + 1; 949 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 950 int yyx; 951 952 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 953 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR 954 && !yytable_value_is_error (yytable[yyx + yyn])) 955 { 956 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 957 { 958 yycount = 1; 959 yysize = yysize0; 960 break; 961 } 962 yyarg[yycount++] = yytname[yyx]; 963 { 964 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); 965 if (! (yysize <= yysize1 966 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 967 return 2; 968 yysize = yysize1; 969 } 970 } 971 } 1094 972 } 973 974 switch (yycount) 975 { 976 # define YYCASE_(N, S) \ 977 case N: \ 978 yyformat = S; \ 979 break 980 YYCASE_(0, YY_("syntax error")); 981 YYCASE_(1, YY_("syntax error, unexpected %s")); 982 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 983 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 984 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 985 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 986 # undef YYCASE_ 987 } 988 989 { 990 YYSIZE_T yysize1 = yysize + yystrlen (yyformat); 991 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 992 return 2; 993 yysize = yysize1; 994 } 995 996 if (*yymsg_alloc < yysize) 997 { 998 *yymsg_alloc = 2 * yysize; 999 if (! (yysize <= *yymsg_alloc 1000 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 1001 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 1002 return 1; 1003 } 1004 1005 /* Avoid sprintf, as that infringes on the user's name space. 1006 Don't have undefined behavior even if the translation 1007 produced a string with the wrong number of "%s"s. */ 1008 { 1009 char *yyp = *yymsg; 1010 int yyi = 0; 1011 while ((*yyp = *yyformat) != '\0') 1012 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 1013 { 1014 yyp += yytnamerr (yyp, yyarg[yyi++]); 1015 yyformat += 2; 1016 } 1017 else 1018 { 1019 yyp++; 1020 yyformat++; 1021 } 1022 } 1023 return 0; 1095 1024 } 1096 1025 #endif /* YYERROR_VERBOSE */ 1097 1098 1099 1026 1100 1027 /*-----------------------------------------------. … … 1102 1029 `-----------------------------------------------*/ 1103 1030 1104 /*ARGSUSED*/1105 #if (defined __STDC__ || defined __C99__FUNC__ \1106 || defined __cplusplus || defined _MSC_VER)1107 1031 static void 1108 1032 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1109 #else1110 static void1111 yydestruct (yymsg, yytype, yyvaluep)1112 const char *yymsg;1113 int yytype;1114 YYSTYPE *yyvaluep;1115 #endif1116 1033 { 1117 1034 YYUSE (yyvaluep); 1118 1119 1035 if (!yymsg) 1120 1036 yymsg = "Deleting"; 1121 1037 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1122 1038 1123 switch (yytype) 1124 { 1125 1126 default: 1127 break; 1128 } 1039 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1040 YYUSE (yytype); 1041 YY_IGNORE_MAYBE_UNINITIALIZED_END 1129 1042 } 1130 1043 1131 /* Prevent warnings from -Wmissing-prototypes. */ 1132 #ifdef YYPARSE_PARAM 1133 #if defined __STDC__ || defined __cplusplus 1134 int yyparse (void *YYPARSE_PARAM); 1135 #else 1136 int yyparse (); 1137 #endif 1138 #else /* ! YYPARSE_PARAM */ 1139 #if defined __STDC__ || defined __cplusplus 1140 int yyparse (void); 1141 #else 1142 int yyparse (); 1143 #endif 1144 #endif /* ! YYPARSE_PARAM */ 1044 1145 1045 1146 1046 … … 1150 1050 /* The semantic value of the lookahead symbol. */ 1151 1051 YYSTYPE yylval; 1152 1153 1052 /* Number of syntax errors so far. */ 1154 1053 int yynerrs; 1155 1054 1156 1055 1157 1158 /*-------------------------. 1159 | yyparse or yypush_parse. | 1160 `-------------------------*/ 1161 1162 #ifdef YYPARSE_PARAM 1163 #if (defined __STDC__ || defined __C99__FUNC__ \ 1164 || defined __cplusplus || defined _MSC_VER) 1165 int 1166 yyparse (void *YYPARSE_PARAM) 1167 #else 1168 int 1169 yyparse (YYPARSE_PARAM) 1170 void *YYPARSE_PARAM; 1171 #endif 1172 #else /* ! YYPARSE_PARAM */ 1173 #if (defined __STDC__ || defined __C99__FUNC__ \ 1174 || defined __cplusplus || defined _MSC_VER) 1056 /*----------. 1057 | yyparse. | 1058 `----------*/ 1059 1175 1060 int 1176 1061 yyparse (void) 1177 #else 1178 int 1179 yyparse () 1180 1181 #endif 1182 #endif 1183 { 1184 1185 1062 { 1186 1063 int yystate; 1187 1064 /* Number of tokens to shift before error messages enabled. */ … … 1189 1066 1190 1067 /* The stacks and their tools: 1191 `yyss': related to states.1192 `yyvs': related to semantic values.1193 1194 Refer to the stacks thr useparate pointers, to allow yyoverflow1068 'yyss': related to states. 1069 'yyvs': related to semantic values. 1070 1071 Refer to the stacks through separate pointers, to allow yyoverflow 1195 1072 to reallocate them elsewhere. */ 1196 1073 … … 1210 1087 int yyresult; 1211 1088 /* Lookahead token as an internal (translated) token number. */ 1212 int yytoken ;1089 int yytoken = 0; 1213 1090 /* The variables used to return semantic value and location from the 1214 1091 action routines. */ … … 1228 1105 int yylen = 0; 1229 1106 1230 yytoken = 0; 1231 yyss = yyssa; 1232 yyvs = yyvsa; 1107 yyssp = yyss = yyssa; 1108 yyvsp = yyvs = yyvsa; 1233 1109 yystacksize = YYINITDEPTH; 1234 1110 … … 1239 1115 yynerrs = 0; 1240 1116 yychar = YYEMPTY; /* Cause a token to be read. */ 1241 1242 /* Initialize stack pointers.1243 Waste one element of value and location stack1244 so that they stay on the same level as the state stack.1245 The wasted elements are never initialized. */1246 yyssp = yyss;1247 yyvsp = yyvs;1248 1249 1117 goto yysetstate; 1250 1118 … … 1267 1135 #ifdef yyoverflow 1268 1136 { 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1137 /* Give user a chance to reallocate the stack. Use copies of 1138 these so that the &'s don't force the real ones into 1139 memory. */ 1140 YYSTYPE *yyvs1 = yyvs; 1141 yytype_int16 *yyss1 = yyss; 1142 1143 /* Each stack pointer address is followed by the size of the 1144 data in use in that stack, in bytes. This used to be a 1145 conditional around just the two extra args, but that might 1146 be undefined if yyoverflow is a macro. */ 1147 yyoverflow (YY_("memory exhausted"), 1148 &yyss1, yysize * sizeof (*yyssp), 1149 &yyvs1, yysize * sizeof (*yyvsp), 1150 &yystacksize); 1151 1152 yyss = yyss1; 1153 yyvs = yyvs1; 1286 1154 } 1287 1155 #else /* no yyoverflow */ … … 1291 1159 /* Extend the stack our own way. */ 1292 1160 if (YYMAXDEPTH <= yystacksize) 1293 1161 goto yyexhaustedlab; 1294 1162 yystacksize *= 2; 1295 1163 if (YYMAXDEPTH < yystacksize) 1296 1164 yystacksize = YYMAXDEPTH; 1297 1165 1298 1166 { 1299 1300 1301 1302 1303 1304 1305 1167 yytype_int16 *yyss1 = yyss; 1168 union yyalloc *yyptr = 1169 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1170 if (! yyptr) 1171 goto yyexhaustedlab; 1172 YYSTACK_RELOCATE (yyss_alloc, yyss); 1173 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1306 1174 # undef YYSTACK_RELOCATE 1307 1308 1175 if (yyss1 != yyssa) 1176 YYSTACK_FREE (yyss1); 1309 1177 } 1310 1178 # endif … … 1315 1183 1316 1184 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1317 1185 (unsigned long int) yystacksize)); 1318 1186 1319 1187 if (yyss + yystacksize - 1 <= yyssp) 1320 1188 YYABORT; 1321 1189 } 1322 1190 … … 1338 1206 /* First try to decide what to do without reference to lookahead token. */ 1339 1207 yyn = yypact[yystate]; 1340 if (yy n == YYPACT_NINF)1208 if (yypact_value_is_default (yyn)) 1341 1209 goto yydefault; 1342 1210 … … 1347 1215 { 1348 1216 YYDPRINTF ((stderr, "Reading a token: ")); 1349 yychar = YYLEX;1217 yychar = yylex (); 1350 1218 } 1351 1219 … … 1369 1237 if (yyn <= 0) 1370 1238 { 1371 if (yy n == 0 || yyn == YYTABLE_NINF)1372 1239 if (yytable_value_is_error (yyn)) 1240 goto yyerrlab; 1373 1241 yyn = -yyn; 1374 1242 goto yyreduce; … … 1387 1255 1388 1256 yystate = yyn; 1257 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1389 1258 *++yyvsp = yylval; 1259 YY_IGNORE_MAYBE_UNINITIALIZED_END 1390 1260 1391 1261 goto yynewstate; … … 1410 1280 1411 1281 /* If YYLEN is nonzero, implement the default value of the action: 1412 `$$ = $1'.1282 '$$ = $1'. 1413 1283 1414 1284 Otherwise, the following line sets YYVAL to garbage. … … 1424 1294 { 1425 1295 case 2: 1426 1427 /* Line 1455 of yacc.c */ 1428 #line 58 "yacc_parser.yacc" 1429 { ;} 1296 #line 59 "yacc_parser.yacc" /* yacc.c:1646 */ 1297 { /* Nothing to do */ } 1298 #line 1299 "yacc_parser.cpp" /* yacc.c:1646 */ 1430 1299 break; 1431 1300 1432 1301 case 3: 1433 1434 /* Line 1455 of yacc.c */ 1435 #line 59 "yacc_parser.yacc" 1436 { parsed=(yyvsp[(1) - (2)].node) ;;} 1302 #line 60 "yacc_parser.yacc" /* yacc.c:1646 */ 1303 { parsed = (yyvsp[-1].filterNode); } 1304 #line 1305 "yacc_parser.cpp" /* yacc.c:1646 */ 1437 1305 break; 1438 1306 1439 1307 case 4: 1440 1441 /* Line 1455 of yacc.c */ 1442 #line 63 "yacc_parser.yacc" 1443 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::scalarDouble,(yyvsp[(1) - (1)].str)); delete (yyvsp[(1) - (1)].str) ;} 1308 #line 64 "yacc_parser.yacc" /* yacc.c:1646 */ 1309 { (yyval.scalarNode) = new CScalarValExprNode(*(yyvsp[0].str)); delete (yyvsp[0].str); } 1310 #line 1311 "yacc_parser.cpp" /* yacc.c:1646 */ 1444 1311 break; 1445 1312 1446 1313 case 5: 1447 1448 /* Line 1455 of yacc.c */ 1449 #line 64 "yacc_parser.yacc" 1450 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::scalarVariable,(yyvsp[(1) - (1)].str)) ; delete (yyvsp[(1) - (1)].str);} 1314 #line 65 "yacc_parser.yacc" /* yacc.c:1646 */ 1315 { (yyval.scalarNode) = new CScalarVarExprNode(*(yyvsp[0].str)); delete (yyvsp[0].str); } 1316 #line 1317 "yacc_parser.cpp" /* yacc.c:1646 */ 1451 1317 break; 1452 1318 1453 1319 case 6: 1454 1455 /* Line 1455 of yacc.c */ 1456 #line 65 "yacc_parser.yacc" 1457 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarScalar,"add") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1320 #line 66 "yacc_parser.yacc" /* yacc.c:1646 */ 1321 { (yyval.scalarNode) = new CScalarBinaryOpExprNode((yyvsp[-2].scalarNode), "add", (yyvsp[0].scalarNode)); } 1322 #line 1323 "yacc_parser.cpp" /* yacc.c:1646 */ 1458 1323 break; 1459 1324 1460 1325 case 7: 1461 1462 /* Line 1455 of yacc.c */ 1463 #line 66 "yacc_parser.yacc" 1464 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarScalar,"minus") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1326 #line 67 "yacc_parser.yacc" /* yacc.c:1646 */ 1327 { (yyval.scalarNode) = new CScalarBinaryOpExprNode((yyvsp[-2].scalarNode), "minus", (yyvsp[0].scalarNode)); } 1328 #line 1329 "yacc_parser.cpp" /* yacc.c:1646 */ 1465 1329 break; 1466 1330 1467 1331 case 8: 1468 1469 /* Line 1455 of yacc.c */ 1470 #line 67 "yacc_parser.yacc" 1471 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarScalar,"mult") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1332 #line 68 "yacc_parser.yacc" /* yacc.c:1646 */ 1333 { (yyval.scalarNode) = new CScalarBinaryOpExprNode((yyvsp[-2].scalarNode), "mult", (yyvsp[0].scalarNode)); } 1334 #line 1335 "yacc_parser.cpp" /* yacc.c:1646 */ 1472 1335 break; 1473 1336 1474 1337 case 9: 1475 1476 /* Line 1455 of yacc.c */ 1477 #line 68 "yacc_parser.yacc" 1478 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarScalar,"div") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1338 #line 69 "yacc_parser.yacc" /* yacc.c:1646 */ 1339 { (yyval.scalarNode) = new CScalarBinaryOpExprNode((yyvsp[-2].scalarNode), "div", (yyvsp[0].scalarNode)); } 1340 #line 1341 "yacc_parser.cpp" /* yacc.c:1646 */ 1479 1341 break; 1480 1342 1481 1343 case 10: 1482 1483 /* Line 1455 of yacc.c */ 1484 #line 69 "yacc_parser.yacc" 1485 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opScalar,"neg") ; (yyval.node)->addChild((yyvsp[(2) - (2)].node)); ;} 1344 #line 70 "yacc_parser.yacc" /* yacc.c:1646 */ 1345 { (yyval.scalarNode) = new CScalarUnaryOpExprNode("neg", (yyvsp[0].scalarNode)); } 1346 #line 1347 "yacc_parser.cpp" /* yacc.c:1646 */ 1486 1347 break; 1487 1348 1488 1349 case 11: 1489 1490 /* Line 1455 of yacc.c */ 1491 #line 70 "yacc_parser.yacc" 1492 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarScalar,"pow") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1350 #line 71 "yacc_parser.yacc" /* yacc.c:1646 */ 1351 { (yyval.scalarNode) = new CScalarBinaryOpExprNode((yyvsp[-2].scalarNode), "pow", (yyvsp[0].scalarNode)); } 1352 #line 1353 "yacc_parser.cpp" /* yacc.c:1646 */ 1493 1353 break; 1494 1354 1495 1355 case 12: 1496 1497 /* Line 1455 of yacc.c */ 1498 #line 71 "yacc_parser.yacc" 1499 { (yyval.node)=(yyvsp[(2) - (3)].node) ; ;} 1356 #line 72 "yacc_parser.yacc" /* yacc.c:1646 */ 1357 { (yyval.scalarNode) = (yyvsp[-1].scalarNode); } 1358 #line 1359 "yacc_parser.cpp" /* yacc.c:1646 */ 1500 1359 break; 1501 1360 1502 1361 case 13: 1503 1504 /* Line 1455 of yacc.c */ 1505 #line 72 "yacc_parser.yacc" 1506 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opScalar,(yyvsp[(1) - (4)].str)) ; (yyval.node)->addChild((yyvsp[(3) - (4)].node)) ; delete (yyvsp[(1) - (4)].str) ;} 1362 #line 73 "yacc_parser.yacc" /* yacc.c:1646 */ 1363 { (yyval.scalarNode) = new CScalarUnaryOpExprNode(*(yyvsp[-3].str), (yyvsp[-1].scalarNode)); delete (yyvsp[-3].str); } 1364 #line 1365 "yacc_parser.cpp" /* yacc.c:1646 */ 1507 1365 break; 1508 1366 1509 1367 case 14: 1510 1511 /* Line 1455 of yacc.c */ 1512 #line 76 "yacc_parser.yacc" 1513 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::fieldInstant,(yyvsp[(1) - (1)].str)); delete (yyvsp[(1) - (1)].str);} 1368 #line 77 "yacc_parser.yacc" /* yacc.c:1646 */ 1369 { (yyval.filterNode) = new CFilterFieldExprNode(*(yyvsp[0].str)); delete (yyvsp[0].str); } 1370 #line 1371 "yacc_parser.cpp" /* yacc.c:1646 */ 1514 1371 break; 1515 1372 1516 1373 case 15: 1517 1518 /* Line 1455 of yacc.c */ 1519 #line 77 "yacc_parser.yacc" 1520 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::fieldAverage,(yyvsp[(1) - (1)].str)); delete (yyvsp[(1) - (1)].str);} 1374 #line 78 "yacc_parser.yacc" /* yacc.c:1646 */ 1375 { /* TODO: Use temporal operation */ (yyval.filterNode) = new CFilterFieldExprNode(*(yyvsp[0].str)); delete (yyvsp[0].str); } 1376 #line 1377 "yacc_parser.cpp" /* yacc.c:1646 */ 1521 1377 break; 1522 1378 1523 1379 case 16: 1524 1525 /* Line 1455 of yacc.c */ 1526 #line 78 "yacc_parser.yacc" 1527 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldField,"add") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1380 #line 79 "yacc_parser.yacc" /* yacc.c:1646 */ 1381 { (yyval.filterNode) = new CFilterFieldFieldOpExprNode((yyvsp[-2].filterNode), "add", (yyvsp[0].filterNode)); } 1382 #line 1383 "yacc_parser.cpp" /* yacc.c:1646 */ 1528 1383 break; 1529 1384 1530 1385 case 17: 1531 1532 /* Line 1455 of yacc.c */ 1533 #line 79 "yacc_parser.yacc" 1534 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldField,"minus") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1386 #line 80 "yacc_parser.yacc" /* yacc.c:1646 */ 1387 { (yyval.filterNode) = new CFilterFieldFieldOpExprNode((yyvsp[-2].filterNode), "minus", (yyvsp[0].filterNode)); } 1388 #line 1389 "yacc_parser.cpp" /* yacc.c:1646 */ 1535 1389 break; 1536 1390 1537 1391 case 18: 1538 1539 /* Line 1455 of yacc.c */ 1540 #line 80 "yacc_parser.yacc" 1541 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldField,"mult") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1392 #line 81 "yacc_parser.yacc" /* yacc.c:1646 */ 1393 { (yyval.filterNode) = new CFilterFieldFieldOpExprNode((yyvsp[-2].filterNode), "mult", (yyvsp[0].filterNode)); } 1394 #line 1395 "yacc_parser.cpp" /* yacc.c:1646 */ 1542 1395 break; 1543 1396 1544 1397 case 19: 1545 1546 /* Line 1455 of yacc.c */ 1547 #line 81 "yacc_parser.yacc" 1548 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldField,"div") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1398 #line 82 "yacc_parser.yacc" /* yacc.c:1646 */ 1399 { (yyval.filterNode) = new CFilterFieldFieldOpExprNode((yyvsp[-2].filterNode), "div", (yyvsp[0].filterNode)); } 1400 #line 1401 "yacc_parser.cpp" /* yacc.c:1646 */ 1549 1401 break; 1550 1402 1551 1403 case 20: 1552 1553 /* Line 1455 of yacc.c */ 1554 #line 82 "yacc_parser.yacc" 1555 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opField,"neg") ; (yyval.node)->addChild((yyvsp[(2) - (2)].node));;} 1404 #line 83 "yacc_parser.yacc" /* yacc.c:1646 */ 1405 { (yyval.filterNode) = new CFilterUnaryOpExprNode("neg", (yyvsp[0].filterNode)); } 1406 #line 1407 "yacc_parser.cpp" /* yacc.c:1646 */ 1556 1407 break; 1557 1408 1558 1409 case 21: 1559 1560 /* Line 1455 of yacc.c */ 1561 #line 83 "yacc_parser.yacc" 1562 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldField,"pow") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1410 #line 84 "yacc_parser.yacc" /* yacc.c:1646 */ 1411 { (yyval.filterNode) = new CFilterFieldFieldOpExprNode((yyvsp[-2].filterNode), "pow", (yyvsp[0].filterNode)); } 1412 #line 1413 "yacc_parser.cpp" /* yacc.c:1646 */ 1563 1413 break; 1564 1414 1565 1415 case 22: 1566 1567 /* Line 1455 of yacc.c */ 1568 #line 84 "yacc_parser.yacc" 1569 { (yyval.node)=(yyvsp[(2) - (3)].node) ;;} 1416 #line 85 "yacc_parser.yacc" /* yacc.c:1646 */ 1417 { (yyval.filterNode) = (yyvsp[-1].filterNode); } 1418 #line 1419 "yacc_parser.cpp" /* yacc.c:1646 */ 1570 1419 break; 1571 1420 1572 1421 case 23: 1573 1574 /* Line 1455 of yacc.c */ 1575 #line 85 "yacc_parser.yacc" 1576 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldScalar,"add") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1422 #line 86 "yacc_parser.yacc" /* yacc.c:1646 */ 1423 { (yyval.filterNode) = new CFilterFieldScalarOpExprNode((yyvsp[-2].filterNode), "add", (yyvsp[0].scalarNode)); } 1424 #line 1425 "yacc_parser.cpp" /* yacc.c:1646 */ 1577 1425 break; 1578 1426 1579 1427 case 24: 1580 1581 /* Line 1455 of yacc.c */ 1582 #line 86 "yacc_parser.yacc" 1583 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarField,"add") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1428 #line 87 "yacc_parser.yacc" /* yacc.c:1646 */ 1429 { (yyval.filterNode) = new CFilterScalarFieldOpExprNode((yyvsp[-2].scalarNode), "add", (yyvsp[0].filterNode)); } 1430 #line 1431 "yacc_parser.cpp" /* yacc.c:1646 */ 1584 1431 break; 1585 1432 1586 1433 case 25: 1587 1588 /* Line 1455 of yacc.c */ 1589 #line 87 "yacc_parser.yacc" 1590 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldScalar,"minus") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1434 #line 88 "yacc_parser.yacc" /* yacc.c:1646 */ 1435 { (yyval.filterNode) = new CFilterFieldScalarOpExprNode((yyvsp[-2].filterNode), "minus", (yyvsp[0].scalarNode)); } 1436 #line 1437 "yacc_parser.cpp" /* yacc.c:1646 */ 1591 1437 break; 1592 1438 1593 1439 case 26: 1594 1595 /* Line 1455 of yacc.c */ 1596 #line 88 "yacc_parser.yacc" 1597 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarField,"minus") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1440 #line 89 "yacc_parser.yacc" /* yacc.c:1646 */ 1441 { (yyval.filterNode) = new CFilterScalarFieldOpExprNode((yyvsp[-2].scalarNode), "minus", (yyvsp[0].filterNode)); } 1442 #line 1443 "yacc_parser.cpp" /* yacc.c:1646 */ 1598 1443 break; 1599 1444 1600 1445 case 27: 1601 1602 /* Line 1455 of yacc.c */ 1603 #line 89 "yacc_parser.yacc" 1604 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldScalar,"mult") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1446 #line 90 "yacc_parser.yacc" /* yacc.c:1646 */ 1447 { (yyval.filterNode) = new CFilterFieldScalarOpExprNode((yyvsp[-2].filterNode), "mult", (yyvsp[0].scalarNode)); } 1448 #line 1449 "yacc_parser.cpp" /* yacc.c:1646 */ 1605 1449 break; 1606 1450 1607 1451 case 28: 1608 1609 /* Line 1455 of yacc.c */ 1610 #line 90 "yacc_parser.yacc" 1611 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarField,"mult") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1452 #line 91 "yacc_parser.yacc" /* yacc.c:1646 */ 1453 { (yyval.filterNode) = new CFilterScalarFieldOpExprNode((yyvsp[-2].scalarNode), "mult", (yyvsp[0].filterNode)); } 1454 #line 1455 "yacc_parser.cpp" /* yacc.c:1646 */ 1612 1455 break; 1613 1456 1614 1457 case 29: 1615 1616 /* Line 1455 of yacc.c */ 1617 #line 91 "yacc_parser.yacc" 1618 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldScalar,"div") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1458 #line 92 "yacc_parser.yacc" /* yacc.c:1646 */ 1459 { (yyval.filterNode) = new CFilterFieldScalarOpExprNode((yyvsp[-2].filterNode), "div", (yyvsp[0].scalarNode)); } 1460 #line 1461 "yacc_parser.cpp" /* yacc.c:1646 */ 1619 1461 break; 1620 1462 1621 1463 case 30: 1622 1623 /* Line 1455 of yacc.c */ 1624 #line 92 "yacc_parser.yacc" 1625 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarField,"div") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1464 #line 93 "yacc_parser.yacc" /* yacc.c:1646 */ 1465 { (yyval.filterNode) = new CFilterScalarFieldOpExprNode((yyvsp[-2].scalarNode), "div", (yyvsp[0].filterNode)); } 1466 #line 1467 "yacc_parser.cpp" /* yacc.c:1646 */ 1626 1467 break; 1627 1468 1628 1469 case 31: 1629 1630 /* Line 1455 of yacc.c */ 1631 #line 93 "yacc_parser.yacc" 1632 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldScalar,"pow") ; (yyval.node)->addChild((yyvsp[(1) - (3)].node)) ; (yyval.node)->addChild((yyvsp[(3) - (3)].node)); ;} 1470 #line 94 "yacc_parser.yacc" /* yacc.c:1646 */ 1471 { (yyval.filterNode) = new CFilterFieldScalarOpExprNode((yyvsp[-2].filterNode), "pow", (yyvsp[0].scalarNode)); } 1472 #line 1473 "yacc_parser.cpp" /* yacc.c:1646 */ 1633 1473 break; 1634 1474 1635 1475 case 32: 1636 1637 /* Line 1455 of yacc.c */ 1638 #line 94 "yacc_parser.yacc" 1639 { (yyval.node)=new CSimpleNodeExpr(CSimpleNodeExpr::opField,(yyvsp[(1) - (4)].str)) ; (yyval.node)->addChild((yyvsp[(3) - (4)].node)) ; delete (yyvsp[(1) - (4)].str);} 1640 break; 1641 1642 1643 1644 /* Line 1455 of yacc.c */ 1645 #line 1644 "yacc_parser.cpp" 1476 #line 95 "yacc_parser.yacc" /* yacc.c:1646 */ 1477 { (yyval.filterNode) = new CFilterUnaryOpExprNode(*(yyvsp[-3].str), (yyvsp[-1].filterNode)); delete (yyvsp[-3].str); } 1478 #line 1479 "yacc_parser.cpp" /* yacc.c:1646 */ 1479 break; 1480 1481 1482 #line 1483 "yacc_parser.cpp" /* yacc.c:1646 */ 1646 1483 default: break; 1647 1484 } 1485 /* User semantic actions sometimes alter yychar, and that requires 1486 that yytoken be updated with the new translation. We take the 1487 approach of translating immediately before every use of yytoken. 1488 One alternative is translating here after every semantic action, 1489 but that translation would be missed if the semantic action invokes 1490 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 1491 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 1492 incorrect destructor might then be invoked immediately. In the 1493 case of YYERROR or YYBACKUP, subsequent parser actions might lead 1494 to an incorrect destructor call or verbose syntax error message 1495 before the lookahead is translated. */ 1648 1496 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 1649 1497 … … 1654 1502 *++yyvsp = yyval; 1655 1503 1656 /* Now `shift' the result of the reduction. Determine what state1504 /* Now 'shift' the result of the reduction. Determine what state 1657 1505 that goes to, based on the state we popped back to and the rule 1658 1506 number reduced by. */ … … 1669 1517 1670 1518 1671 /*------------------------------------ .1672 | yyerrlab -- here on detecting error |1673 `------------------------------------ */1519 /*--------------------------------------. 1520 | yyerrlab -- here on detecting error. | 1521 `--------------------------------------*/ 1674 1522 yyerrlab: 1523 /* Make sure we have latest lookahead translation. See comments at 1524 user semantic actions for why this is necessary. */ 1525 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 1526 1675 1527 /* If not already recovering from an error, report this error. */ 1676 1528 if (!yyerrstatus) … … 1680 1532 yyerror (YY_("syntax error")); 1681 1533 #else 1534 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 1535 yyssp, yytoken) 1682 1536 { 1683 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 1684 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 1685 { 1686 YYSIZE_T yyalloc = 2 * yysize; 1687 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 1688 yyalloc = YYSTACK_ALLOC_MAXIMUM; 1689 if (yymsg != yymsgbuf) 1690 YYSTACK_FREE (yymsg); 1691 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 1692 if (yymsg) 1693 yymsg_alloc = yyalloc; 1694 else 1695 { 1696 yymsg = yymsgbuf; 1697 yymsg_alloc = sizeof yymsgbuf; 1698 } 1699 } 1700 1701 if (0 < yysize && yysize <= yymsg_alloc) 1702 { 1703 (void) yysyntax_error (yymsg, yystate, yychar); 1704 yyerror (yymsg); 1705 } 1706 else 1707 { 1708 yyerror (YY_("syntax error")); 1709 if (yysize != 0) 1710 goto yyexhaustedlab; 1711 } 1537 char const *yymsgp = YY_("syntax error"); 1538 int yysyntax_error_status; 1539 yysyntax_error_status = YYSYNTAX_ERROR; 1540 if (yysyntax_error_status == 0) 1541 yymsgp = yymsg; 1542 else if (yysyntax_error_status == 1) 1543 { 1544 if (yymsg != yymsgbuf) 1545 YYSTACK_FREE (yymsg); 1546 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 1547 if (!yymsg) 1548 { 1549 yymsg = yymsgbuf; 1550 yymsg_alloc = sizeof yymsgbuf; 1551 yysyntax_error_status = 2; 1552 } 1553 else 1554 { 1555 yysyntax_error_status = YYSYNTAX_ERROR; 1556 yymsgp = yymsg; 1557 } 1558 } 1559 yyerror (yymsgp); 1560 if (yysyntax_error_status == 2) 1561 goto yyexhaustedlab; 1712 1562 } 1563 # undef YYSYNTAX_ERROR 1713 1564 #endif 1714 1565 } … … 1719 1570 { 1720 1571 /* If just tried and failed to reuse lookahead token after an 1721 1572 error, discard it. */ 1722 1573 1723 1574 if (yychar <= YYEOF) 1724 1725 1726 1727 1728 1575 { 1576 /* Return failure if at end of input. */ 1577 if (yychar == YYEOF) 1578 YYABORT; 1579 } 1729 1580 else 1730 1731 1732 1733 1734 1581 { 1582 yydestruct ("Error: discarding", 1583 yytoken, &yylval); 1584 yychar = YYEMPTY; 1585 } 1735 1586 } 1736 1587 … … 1751 1602 goto yyerrorlab; 1752 1603 1753 /* Do not reclaim the symbols of the rule wh ichaction triggered1604 /* Do not reclaim the symbols of the rule whose action triggered 1754 1605 this YYERROR. */ 1755 1606 YYPOPSTACK (yylen); … … 1764 1615 `-------------------------------------------------------------*/ 1765 1616 yyerrlab1: 1766 yyerrstatus = 3; 1617 yyerrstatus = 3; /* Each real token shifted decrements this. */ 1767 1618 1768 1619 for (;;) 1769 1620 { 1770 1621 yyn = yypact[yystate]; 1771 if ( yyn != YYPACT_NINF)1772 1773 1774 1775 1776 1777 1778 1779 1780 1622 if (!yypact_value_is_default (yyn)) 1623 { 1624 yyn += YYTERROR; 1625 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 1626 { 1627 yyn = yytable[yyn]; 1628 if (0 < yyn) 1629 break; 1630 } 1631 } 1781 1632 1782 1633 /* Pop the current state because it cannot handle the error token. */ 1783 1634 if (yyssp == yyss) 1784 1635 YYABORT; 1785 1636 1786 1637 1787 1638 yydestruct ("Error: popping", 1788 1639 yystos[yystate], yyvsp); 1789 1640 YYPOPSTACK (1); 1790 1641 yystate = *yyssp; … … 1792 1643 } 1793 1644 1645 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1794 1646 *++yyvsp = yylval; 1647 YY_IGNORE_MAYBE_UNINITIALIZED_END 1795 1648 1796 1649 … … 1816 1669 goto yyreturn; 1817 1670 1818 #if !defined (yyoverflow)|| YYERROR_VERBOSE1671 #if !defined yyoverflow || YYERROR_VERBOSE 1819 1672 /*-------------------------------------------------. 1820 1673 | yyexhaustedlab -- memory exhaustion comes here. | … … 1828 1681 yyreturn: 1829 1682 if (yychar != YYEMPTY) 1830 yydestruct ("Cleanup: discarding lookahead", 1831 yytoken, &yylval); 1832 /* Do not reclaim the symbols of the rule which action triggered 1683 { 1684 /* Make sure we have latest lookahead translation. See comments at 1685 user semantic actions for why this is necessary. */ 1686 yytoken = YYTRANSLATE (yychar); 1687 yydestruct ("Cleanup: discarding lookahead", 1688 yytoken, &yylval); 1689 } 1690 /* Do not reclaim the symbols of the rule whose action triggered 1833 1691 this YYABORT or YYACCEPT. */ 1834 1692 YYPOPSTACK (yylen); … … 1837 1695 { 1838 1696 yydestruct ("Cleanup: popping", 1839 1697 yystos[*yyssp], yyvsp); 1840 1698 YYPOPSTACK (1); 1841 1699 } … … 1848 1706 YYSTACK_FREE (yymsg); 1849 1707 #endif 1850 /* Make sure YYID is used. */ 1851 return YYID (yyresult); 1708 return yyresult; 1852 1709 } 1853 1854 1855 1856 /* Line 1675 of yacc.c */ 1857 #line 96 "yacc_parser.yacc" 1710 #line 97 "yacc_parser.yacc" /* yacc.c:1906 */ 1858 1711 1859 1712 1860 1713 extern "C" 1861 1714 { 1862 int yyerror(const char *s) 1715 int yyerror(const char *s) 1863 1716 { 1864 ERROR("int yyerror(const char *s)", << "Parsing error :"<<s<<endl) ;1717 ERROR("int yyerror(const char *s)", << "Parsing error: " << s << endl); 1865 1718 } 1866 1719 } … … 1868 1721 namespace xios 1869 1722 { 1870 CSimpleNodeExpr* parseExpr(const string& strExpr)1723 IFilterExprNode* parseExpr(const string& strExpr) 1871 1724 { 1872 globalInputText =strExpr;1873 globalReadOffset =0;1725 globalInputText = strExpr; 1726 globalReadOffset = 0; 1874 1727 yyparse(); 1875 return parsed;1728 return parsed; 1876 1729 } 1877 1730 } 1878 1731 1879 1732 1880 -
XIOS/trunk/src/parse_expr/yacc_parser.hpp
r501 r642 1 /* A Bison parser, made by GNU Bison 3.0.2. */ 1 2 2 /* A Bison parser, made by GNU Bison 2.4.1. */3 /* Bison interface for Yacc-like parsers in C 3 4 4 /* Skeleton interface for Bison's Yacc-like parsers in C 5 6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 7 Free Software Foundation, Inc. 8 5 Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. 6 9 7 This program is free software: you can redistribute it and/or modify 10 8 it under the terms of the GNU General Public License as published by 11 9 the Free Software Foundation, either version 3 of the License, or 12 10 (at your option) any later version. 13 11 14 12 This program is distributed in the hope that it will be useful, 15 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 15 GNU General Public License for more details. 18 16 19 17 You should have received a copy of the GNU General Public License 20 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ … … 29 27 Bison output files to be licensed under the GNU General Public 30 28 License without this special exception. 31 29 32 30 This special exception was added by the Free Software Foundation in 33 31 version 2.2 of Bison. */ 34 32 33 #ifndef YY_YY_YACC_PARSER_HPP_INCLUDED 34 # define YY_YY_YACC_PARSER_HPP_INCLUDED 35 /* Debug traces. */ 36 #ifndef YYDEBUG 37 # define YYDEBUG 0 38 #endif 39 #if YYDEBUG 40 extern int yydebug; 41 #endif 35 42 36 /* Token s. */43 /* Token type. */ 37 44 #ifndef YYTOKENTYPE 38 45 # define YYTOKENTYPE 39 /* Put the tokens into the symbol table, so that GDB and other debuggers 40 know about them. */ 41 enum yytokentype { 42 NUMBER = 258, 43 VAR = 259, 44 ID = 260, 45 AVERAGE = 261, 46 PLUS = 262, 47 MINUS = 263, 48 TIMES = 264, 49 DIVIDE = 265, 50 POWER = 266, 51 LEFT_PARENTHESIS = 267, 52 RIGHT_PARENTHESIS = 268, 53 END = 269, 54 NEG = 270 55 }; 46 enum yytokentype 47 { 48 NUMBER = 258, 49 VAR = 259, 50 ID = 260, 51 AVERAGE = 261, 52 PLUS = 262, 53 MINUS = 263, 54 TIMES = 264, 55 DIVIDE = 265, 56 POWER = 266, 57 LEFT_PARENTHESIS = 267, 58 RIGHT_PARENTHESIS = 268, 59 END = 269, 60 NEG = 270 61 }; 62 #endif 63 64 /* Value type. */ 65 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 66 typedef union YYSTYPE YYSTYPE; 67 union YYSTYPE 68 { 69 #line 35 "yacc_parser.yacc" /* yacc.c:1909 */ 70 71 std::string* str; /* symbol table index */ 72 xios::IScalarExprNode* scalarNode; 73 xios::IFilterExprNode* filterNode; 74 75 #line 76 "yacc_parser.hpp" /* yacc.c:1909 */ 76 }; 77 # define YYSTYPE_IS_TRIVIAL 1 78 # define YYSTYPE_IS_DECLARED 1 56 79 #endif 57 80 58 81 59 60 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED61 typedef union YYSTYPE62 {63 64 /* Line 1676 of yacc.c */65 #line 36 "yacc_parser.yacc"66 67 std::string* str ; /* symbol table index */68 CSimpleNodeExpr* node ;69 70 71 72 /* Line 1676 of yacc.c */73 #line 74 "yacc_parser.hpp"74 } YYSTYPE;75 # define YYSTYPE_IS_TRIVIAL 176 # define yystype YYSTYPE /* obsolescent; will be withdrawn */77 # define YYSTYPE_IS_DECLARED 178 #endif79 80 82 extern YYSTYPE yylval; 81 83 84 int yyparse (void); 82 85 86 #endif /* !YY_YY_YACC_PARSER_HPP_INCLUDED */ -
XIOS/trunk/src/parse_expr/yacc_parser.yacc
r501 r642 1 1 %{ 2 #include " simple_node_expr.hpp"2 #include "filter_expr_node.hpp" 3 3 #include <string> 4 4 #include <iostream> 5 5 #include "exception.hpp" 6 6 7 using namespace std 8 using namespace xios 7 using namespace std; 8 using namespace xios; 9 9 10 10 extern "C" … … 12 12 int yyparse(void); 13 13 int yylex(void); 14 int yyerror(const char *s) 14 int yyerror(const char *s); 15 15 } 16 16 17 CSimpleNodeExpr* parsed;18 19 int globalReadOffset=0;20 21 int readInputForLexer( char *buffer, int *numBytesRead, int maxBytesToRead)22 23 int numBytesToRead = maxBytesToRead;24 int bytesRemaining = globalInputText.length()-globalReadOffset;25 int i;26 if ( numBytesToRead > bytesRemaining) numBytesToRead = bytesRemaining;27 for ( i = 0; i < numBytesToRead; i++ ) buffer[i] = globalInputText.c_str()[globalReadOffset+i];17 IFilterExprNode* parsed; 18 std::string globalInputText; 19 size_t globalReadOffset = 0; 20 21 int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead) 22 { 23 size_t numBytesToRead = maxBytesToRead; 24 size_t bytesRemaining = globalInputText.length()-globalReadOffset; 25 size_t i; 26 if (numBytesToRead > bytesRemaining) numBytesToRead = bytesRemaining; 27 for (i = 0; i < numBytesToRead; i++) buffer[i] = globalInputText.c_str()[globalReadOffset + i]; 28 28 *numBytesRead = numBytesToRead; 29 29 globalReadOffset += numBytesToRead; 30 30 return 0; 31 } 32 31 } 33 32 %} 34 33 35 34 %union 36 35 { 37 std::string* str ; /* symbol table index */ 38 CSimpleNodeExpr* node ; 36 std::string* str; /* symbol table index */ 37 xios::IScalarExprNode* scalarNode; 38 xios::IFilterExprNode* filterNode; 39 39 }; 40 40 41 41 %token <str> NUMBER 42 %token <str> 42 %token <str> VAR ID AVERAGE 43 43 %token PLUS MINUS TIMES DIVIDE POWER 44 44 %token LEFT_PARENTHESIS RIGHT_PARENTHESIS … … 50 50 %right POWER 51 51 52 %type <node> Line Expression Field_expr 52 %type <scalarNode> Expression 53 %type <filterNode> Line Field_expr 53 54 %start Line 54 55 %% … … 56 57 57 58 Line: 58 END {}59 | Field_expr END { parsed=$1 ;}60 59 END { /* Nothing to do */ } 60 | Field_expr END { parsed = $1; } 61 ; 61 62 62 63 Expression: 63 NUMBER { $$ =new CSimpleNodeExpr(CSimpleNodeExpr::scalarDouble,$1); delete $1}64 | VAR { $$ =new CSimpleNodeExpr(CSimpleNodeExpr::scalarVariable,$1) ; delete $1}65 | Expression PLUS Expression { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarScalar,"add") ; $$->addChild($1) ; $$->addChild($3); }66 | Expression MINUS Expression { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarScalar,"minus") ; $$->addChild($1) ; $$->addChild($3); }67 | Expression TIMES Expression { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarScalar,"mult") ; $$->addChild($1) ; $$->addChild($3); }68 | Expression DIVIDE Expression { $$ =new CSimpleNodeExpr(CSimpleNodeExpr::opScalarScalar,"div") ; $$->addChild($1) ; $$->addChild($3); }69 | MINUS Expression %prec NEG { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opScalar,"neg") ; $$->addChild($2); }70 | Expression POWER Expression { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarScalar,"pow") ; $$->addChild($1) ; $$->addChild($3); }71 | LEFT_PARENTHESIS Expression RIGHT_PARENTHESIS { $$=$2; }72 | ID LEFT_PARENTHESIS Expression RIGHT_PARENTHESIS { $$ =new CSimpleNodeExpr(CSimpleNodeExpr::opScalar,$1) ; $$->addChild($3) ; delete $1}64 NUMBER { $$ = new CScalarValExprNode(*$1); delete $1; } 65 | VAR { $$ = new CScalarVarExprNode(*$1); delete $1; } 66 | Expression PLUS Expression { $$ = new CScalarBinaryOpExprNode($1, "add", $3); } 67 | Expression MINUS Expression { $$ = new CScalarBinaryOpExprNode($1, "minus", $3); } 68 | Expression TIMES Expression { $$ = new CScalarBinaryOpExprNode($1, "mult", $3); } 69 | Expression DIVIDE Expression { $$ = new CScalarBinaryOpExprNode($1, "div", $3); } 70 | MINUS Expression %prec NEG { $$ = new CScalarUnaryOpExprNode("neg", $2); } 71 | Expression POWER Expression { $$ = new CScalarBinaryOpExprNode($1, "pow", $3); } 72 | LEFT_PARENTHESIS Expression RIGHT_PARENTHESIS { $$ = $2; } 73 | ID LEFT_PARENTHESIS Expression RIGHT_PARENTHESIS { $$ = new CScalarUnaryOpExprNode(*$1, $3); delete $1; } 73 74 ; 74 75 75 76 Field_expr: 76 ID { $$=new CSimpleNodeExpr(CSimpleNodeExpr::fieldInstant,$1); delete $1}77 | AVERAGE { $$=new CSimpleNodeExpr(CSimpleNodeExpr::fieldAverage,$1); delete $1}78 | Field_expr PLUS Field_expr { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldField,"add") ; $$->addChild($1) ; $$->addChild($3); }79 | Field_expr MINUS Field_expr { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldField,"minus") ; $$->addChild($1) ; $$->addChild($3); }80 | Field_expr TIMES Field_expr { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldField,"mult") ; $$->addChild($1) ; $$->addChild($3); }81 | Field_expr DIVIDE Field_expr { $$ =new CSimpleNodeExpr(CSimpleNodeExpr::opFieldField,"div") ; $$->addChild($1) ; $$->addChild($3); }82 | MINUS Field_expr %prec NEG { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opField,"neg") ; $$->addChild($2);}83 | Field_expr POWER Field_expr { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldField,"pow") ; $$->addChild($1) ; $$->addChild($3); }84 | LEFT_PARENTHESIS Field_expr RIGHT_PARENTHESIS { $$ =$2 ;}85 | Field_expr PLUS Expression { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldScalar,"add") ; $$->addChild($1) ; $$->addChild($3); }86 | Expression PLUS Field_expr { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarField,"add") ; $$->addChild($1) ; $$->addChild($3); }87 | Field_expr MINUS Expression { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldScalar,"minus") ; $$->addChild($1) ; $$->addChild($3); }88 | Expression MINUS Field_expr { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarField,"minus") ; $$->addChild($1) ; $$->addChild($3); }89 | Field_expr TIMES Expression { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldScalar,"mult") ; $$->addChild($1) ; $$->addChild($3); }90 | Expression TIMES Field_expr { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opScalarField,"mult") ; $$->addChild($1) ; $$->addChild($3); }91 | Field_expr DIVIDE Expression { $$ =new CSimpleNodeExpr(CSimpleNodeExpr::opFieldScalar,"div") ; $$->addChild($1) ; $$->addChild($3); }92 | Expression DIVIDE Field_expr { $$ =new CSimpleNodeExpr(CSimpleNodeExpr::opScalarField,"div") ; $$->addChild($1) ; $$->addChild($3); }93 | Field_expr POWER Expression { $$=new CSimpleNodeExpr(CSimpleNodeExpr::opFieldScalar,"pow") ; $$->addChild($1) ; $$->addChild($3); }94 | ID LEFT_PARENTHESIS Field_expr RIGHT_PARENTHESIS { $$ =new CSimpleNodeExpr(CSimpleNodeExpr::opField,$1) ; $$->addChild($3) ; delete $1}77 ID { $$ = new CFilterFieldExprNode(*$1); delete $1; } 78 | AVERAGE { /* TODO: Use temporal operation */ $$ = new CFilterFieldExprNode(*$1); delete $1; } 79 | Field_expr PLUS Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "add", $3); } 80 | Field_expr MINUS Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "minus", $3); } 81 | Field_expr TIMES Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "mult", $3); } 82 | Field_expr DIVIDE Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "div", $3); } 83 | MINUS Field_expr %prec NEG { $$ = new CFilterUnaryOpExprNode("neg", $2); } 84 | Field_expr POWER Field_expr { $$ = new CFilterFieldFieldOpExprNode($1, "pow", $3); } 85 | LEFT_PARENTHESIS Field_expr RIGHT_PARENTHESIS { $$ = $2; } 86 | Field_expr PLUS Expression { $$ = new CFilterFieldScalarOpExprNode($1, "add", $3); } 87 | Expression PLUS Field_expr { $$ = new CFilterScalarFieldOpExprNode($1, "add", $3); } 88 | Field_expr MINUS Expression { $$ = new CFilterFieldScalarOpExprNode($1, "minus", $3); } 89 | Expression MINUS Field_expr { $$ = new CFilterScalarFieldOpExprNode($1, "minus", $3); } 90 | Field_expr TIMES Expression { $$ = new CFilterFieldScalarOpExprNode($1, "mult", $3); } 91 | Expression TIMES Field_expr { $$ = new CFilterScalarFieldOpExprNode($1, "mult", $3); } 92 | Field_expr DIVIDE Expression { $$ = new CFilterFieldScalarOpExprNode($1, "div", $3); } 93 | Expression DIVIDE Field_expr { $$ = new CFilterScalarFieldOpExprNode($1, "div", $3); } 94 | Field_expr POWER Expression { $$ = new CFilterFieldScalarOpExprNode($1, "pow", $3); } 95 | ID LEFT_PARENTHESIS Field_expr RIGHT_PARENTHESIS { $$ = new CFilterUnaryOpExprNode(*$1, $3); delete $1; } 95 96 ; 96 97 %% … … 98 99 extern "C" 99 100 { 100 int yyerror(const char *s) 101 int yyerror(const char *s) 101 102 { 102 ERROR("int yyerror(const char *s)", << "Parsing error :"<<s<<endl) ;103 ERROR("int yyerror(const char *s)", << "Parsing error: " << s << endl); 103 104 } 104 105 } … … 106 107 namespace xios 107 108 { 108 CSimpleNodeExpr* parseExpr(const string& strExpr)109 IFilterExprNode* parseExpr(const string& strExpr) 109 110 { 110 globalInputText =strExpr;111 globalReadOffset =0;111 globalInputText = strExpr; 112 globalReadOffset = 0; 112 113 yyparse(); 113 return parsed;114 return parsed; 114 115 } 115 116 }
Note: See TracChangeset
for help on using the changeset viewer.