| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2005 Frerich Raabe <raabe@kde.org> | 2 * Copyright 2005 Frerich Raabe <raabe@kde.org> |
| 3 * Copyright (C) 2006 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| 11 * notice, this list of conditions and the following disclaimer. | 11 * notice, this list of conditions and the following disclaimer. |
| 12 * 2. Redistributions in binary form must reproduce the above copyright | 12 * 2. Redistributions in binary form must reproduce the above copyright |
| 13 * notice, this list of conditions and the following disclaimer in the | 13 * notice, this list of conditions and the following disclaimer in the |
| 14 * documentation and/or other materials provided with the distribution. | 14 * documentation and/or other materials provided with the distribution. |
| 15 * | 15 * |
| 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 55 %parse-param { blink::XPath::Parser* parser } | 55 %parse-param { blink::XPath::Parser* parser } |
| 56 | 56 |
| 57 %union | 57 %union |
| 58 { | 58 { |
| 59 blink::XPath::Step::Axis axis; | 59 blink::XPath::Step::Axis axis; |
| 60 blink::XPath::Step::NodeTest* nodeTest; | 60 blink::XPath::Step::NodeTest* nodeTest; |
| 61 blink::XPath::NumericOp::Opcode numop; | 61 blink::XPath::NumericOp::Opcode numop; |
| 62 blink::XPath::EqTestOp::Opcode eqop; | 62 blink::XPath::EqTestOp::Opcode eqop; |
| 63 String* str; | 63 String* str; |
| 64 blink::XPath::Expression* expr; | 64 blink::XPath::Expression* expr; |
| 65 WillBeHeapVector<OwnPtrWillBeMember<blink::XPath::Predicate> >* predList; | 65 blink::HeapVector<blink::Member<blink::XPath::Predicate> >* predList; |
| 66 WillBeHeapVector<OwnPtrWillBeMember<blink::XPath::Expression> >* argList; | 66 blink::HeapVector<blink::Member<blink::XPath::Expression> >* argList; |
| 67 blink::XPath::Step* step; | 67 blink::XPath::Step* step; |
| 68 blink::XPath::LocationPath* locationPath; | 68 blink::XPath::LocationPath* locationPath; |
| 69 } | 69 } |
| 70 | 70 |
| 71 %{ | 71 %{ |
| 72 | 72 |
| 73 static int xpathyylex(YYSTYPE* yylval) { return Parser::current()->lex(yylval);
} | 73 static int xpathyylex(YYSTYPE* yylval) { return Parser::current()->lex(yylval);
} |
| 74 static void xpathyyerror(void*, const char*) { } | 74 static void xpathyyerror(void*, const char*) { } |
| 75 | 75 |
| 76 %} | 76 %} |
| 77 | 77 |
| 78 %left <numop> MULOP | 78 %left <numop> MULOP |
| 79 %left <eqop> EQOP RELOP | 79 %left <eqop> EQOP RELOP |
| 80 %left PLUS MINUS | 80 %left PLUS MINUS |
| 81 %left OR AND | 81 %left OR AND |
| 82 %token <axis> AXISNAME | 82 %token <axis> AXISNAME |
| 83 %token <str> NODETYPE PI FUNCTIONNAME LITERAL | 83 %token <str> NODETYPE PI FUNCTIONNAME LITERAL |
| 84 %token <str> VARIABLEREFERENCE NUMBER | 84 %token <str> VARIABLEREFERENCE NUMBER |
| 85 %token DOTDOT SLASHSLASH | 85 %token DOTDOT SLASHSLASH |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 AbsoluteLocationPath | 131 AbsoluteLocationPath |
| 132 { | 132 { |
| 133 $$->setAbsolute(true); | 133 $$->setAbsolute(true); |
| 134 } | 134 } |
| 135 ; | 135 ; |
| 136 | 136 |
| 137 AbsoluteLocationPath: | 137 AbsoluteLocationPath: |
| 138 '/' | 138 '/' |
| 139 { | 139 { |
| 140 $$ = new LocationPath; | 140 $$ = new LocationPath; |
| 141 parser->registerParseNode($$); | |
| 142 } | 141 } |
| 143 | | 142 | |
| 144 '/' RelativeLocationPath | 143 '/' RelativeLocationPath |
| 145 { | 144 { |
| 146 $$ = $2; | 145 $$ = $2; |
| 147 } | 146 } |
| 148 | | 147 | |
| 149 DescendantOrSelf RelativeLocationPath | 148 DescendantOrSelf RelativeLocationPath |
| 150 { | 149 { |
| 151 $$ = $2; | 150 $$ = $2; |
| 152 $$->insertFirstStep($1); | 151 $$->insertFirstStep($1); |
| 153 parser->unregisterParseNode($1); | |
| 154 } | 152 } |
| 155 ; | 153 ; |
| 156 | 154 |
| 157 RelativeLocationPath: | 155 RelativeLocationPath: |
| 158 Step | 156 Step |
| 159 { | 157 { |
| 160 $$ = new LocationPath; | 158 $$ = new LocationPath; |
| 161 $$->appendStep($1); | 159 $$->appendStep($1); |
| 162 parser->unregisterParseNode($1); | |
| 163 parser->registerParseNode($$); | |
| 164 } | 160 } |
| 165 | | 161 | |
| 166 RelativeLocationPath '/' Step | 162 RelativeLocationPath '/' Step |
| 167 { | 163 { |
| 168 $$->appendStep($3); | 164 $$->appendStep($3); |
| 169 parser->unregisterParseNode($3); | |
| 170 } | 165 } |
| 171 | | 166 | |
| 172 RelativeLocationPath DescendantOrSelf Step | 167 RelativeLocationPath DescendantOrSelf Step |
| 173 { | 168 { |
| 174 $$->appendStep($2); | 169 $$->appendStep($2); |
| 175 $$->appendStep($3); | 170 $$->appendStep($3); |
| 176 parser->unregisterParseNode($2); | |
| 177 parser->unregisterParseNode($3); | |
| 178 } | 171 } |
| 179 ; | 172 ; |
| 180 | 173 |
| 181 Step: | 174 Step: |
| 182 NodeTest OptionalPredicateList | 175 NodeTest OptionalPredicateList |
| 183 { | 176 { |
| 184 if ($2) { | 177 if ($2) |
| 185 $$ = new Step(Step::ChildAxis, *$1, *$2); | 178 $$ = new Step(Step::ChildAxis, *$1, *$2); |
| 186 parser->deletePredicateVector($2); | 179 else |
| 187 } else | |
| 188 $$ = new Step(Step::ChildAxis, *$1); | 180 $$ = new Step(Step::ChildAxis, *$1); |
| 189 parser->deleteNodeTest($1); | |
| 190 parser->registerParseNode($$); | |
| 191 } | 181 } |
| 192 | | 182 | |
| 193 NAMETEST OptionalPredicateList | 183 NAMETEST OptionalPredicateList |
| 194 { | 184 { |
| 195 AtomicString localName; | 185 AtomicString localName; |
| 196 AtomicString namespaceURI; | 186 AtomicString namespaceURI; |
| 197 if (!parser->expandQName(*$1, localName, namespaceURI)) { | 187 if (!parser->expandQName(*$1, localName, namespaceURI)) { |
| 198 parser->m_gotNamespaceError = true; | 188 parser->m_gotNamespaceError = true; |
| 199 YYABORT; | 189 YYABORT; |
| 200 } | 190 } |
| 201 | 191 |
| 202 if ($2) { | 192 if ($2) |
| 203 $$ = new Step(Step::ChildAxis, Step::NodeTest(Step::NodeTest::NameTe
st, localName, namespaceURI), *$2); | 193 $$ = new Step(Step::ChildAxis, Step::NodeTest(Step::NodeTest::NameTe
st, localName, namespaceURI), *$2); |
| 204 parser->deletePredicateVector($2); | 194 else |
| 205 } else | |
| 206 $$ = new Step(Step::ChildAxis, Step::NodeTest(Step::NodeTest::NameTe
st, localName, namespaceURI)); | 195 $$ = new Step(Step::ChildAxis, Step::NodeTest(Step::NodeTest::NameTe
st, localName, namespaceURI)); |
| 207 parser->deleteString($1); | 196 parser->deleteString($1); |
| 208 parser->registerParseNode($$); | |
| 209 } | 197 } |
| 210 | | 198 | |
| 211 AxisSpecifier NodeTest OptionalPredicateList | 199 AxisSpecifier NodeTest OptionalPredicateList |
| 212 { | 200 { |
| 213 if ($3) { | 201 if ($3) |
| 214 $$ = new Step($1, *$2, *$3); | 202 $$ = new Step($1, *$2, *$3); |
| 215 parser->deletePredicateVector($3); | 203 else |
| 216 } else | |
| 217 $$ = new Step($1, *$2); | 204 $$ = new Step($1, *$2); |
| 218 parser->deleteNodeTest($2); | |
| 219 parser->registerParseNode($$); | |
| 220 } | 205 } |
| 221 | | 206 | |
| 222 AxisSpecifier NAMETEST OptionalPredicateList | 207 AxisSpecifier NAMETEST OptionalPredicateList |
| 223 { | 208 { |
| 224 AtomicString localName; | 209 AtomicString localName; |
| 225 AtomicString namespaceURI; | 210 AtomicString namespaceURI; |
| 226 if (!parser->expandQName(*$2, localName, namespaceURI)) { | 211 if (!parser->expandQName(*$2, localName, namespaceURI)) { |
| 227 parser->m_gotNamespaceError = true; | 212 parser->m_gotNamespaceError = true; |
| 228 YYABORT; | 213 YYABORT; |
| 229 } | 214 } |
| 230 | 215 |
| 231 if ($3) { | 216 if ($3) |
| 232 $$ = new Step($1, Step::NodeTest(Step::NodeTest::NameTest, localName
, namespaceURI), *$3); | 217 $$ = new Step($1, Step::NodeTest(Step::NodeTest::NameTest, localName
, namespaceURI), *$3); |
| 233 parser->deletePredicateVector($3); | 218 else |
| 234 } else | |
| 235 $$ = new Step($1, Step::NodeTest(Step::NodeTest::NameTest, localName
, namespaceURI)); | 219 $$ = new Step($1, Step::NodeTest(Step::NodeTest::NameTest, localName
, namespaceURI)); |
| 236 parser->deleteString($2); | 220 parser->deleteString($2); |
| 237 parser->registerParseNode($$); | |
| 238 } | 221 } |
| 239 | | 222 | |
| 240 AbbreviatedStep | 223 AbbreviatedStep |
| 241 ; | 224 ; |
| 242 | 225 |
| 243 AxisSpecifier: | 226 AxisSpecifier: |
| 244 AXISNAME | 227 AXISNAME |
| 245 | | 228 | |
| 246 '@' | 229 '@' |
| 247 { | 230 { |
| 248 $$ = Step::AttributeAxis; | 231 $$ = Step::AttributeAxis; |
| 249 } | 232 } |
| 250 ; | 233 ; |
| 251 | 234 |
| 252 NodeTest: | 235 NodeTest: |
| 253 NODETYPE '(' ')' | 236 NODETYPE '(' ')' |
| 254 { | 237 { |
| 255 if (*$1 == "node") | 238 if (*$1 == "node") |
| 256 $$ = new Step::NodeTest(Step::NodeTest::AnyNodeTest); | 239 $$ = new Step::NodeTest(Step::NodeTest::AnyNodeTest); |
| 257 else if (*$1 == "text") | 240 else if (*$1 == "text") |
| 258 $$ = new Step::NodeTest(Step::NodeTest::TextNodeTest); | 241 $$ = new Step::NodeTest(Step::NodeTest::TextNodeTest); |
| 259 else if (*$1 == "comment") | 242 else if (*$1 == "comment") |
| 260 $$ = new Step::NodeTest(Step::NodeTest::CommentNodeTest); | 243 $$ = new Step::NodeTest(Step::NodeTest::CommentNodeTest); |
| 261 | 244 |
| 262 parser->deleteString($1); | 245 parser->deleteString($1); |
| 263 parser->registerNodeTest($$); | |
| 264 } | 246 } |
| 265 | | 247 | |
| 266 PI '(' ')' | 248 PI '(' ')' |
| 267 { | 249 { |
| 268 $$ = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest); | 250 $$ = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest); |
| 269 parser->deleteString($1); | 251 parser->deleteString($1); |
| 270 parser->registerNodeTest($$); | |
| 271 } | 252 } |
| 272 | | 253 | |
| 273 PI '(' LITERAL ')' | 254 PI '(' LITERAL ')' |
| 274 { | 255 { |
| 275 $$ = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest, $
3->stripWhiteSpace()); | 256 $$ = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest, $
3->stripWhiteSpace()); |
| 276 parser->deleteString($1); | 257 parser->deleteString($1); |
| 277 parser->deleteString($3); | 258 parser->deleteString($3); |
| 278 parser->registerNodeTest($$); | |
| 279 } | 259 } |
| 280 ; | 260 ; |
| 281 | 261 |
| 282 OptionalPredicateList: | 262 OptionalPredicateList: |
| 283 /* empty */ | 263 /* empty */ |
| 284 { | 264 { |
| 285 $$ = 0; | 265 $$ = 0; |
| 286 } | 266 } |
| 287 | | 267 | |
| 288 PredicateList | 268 PredicateList |
| 289 ; | 269 ; |
| 290 | 270 |
| 291 PredicateList: | 271 PredicateList: |
| 292 Predicate | 272 Predicate |
| 293 { | 273 { |
| 294 $$ = new WillBeHeapVector<OwnPtrWillBeMember<Predicate> >; | 274 $$ = new blink::HeapVector<blink::Member<Predicate> >; |
| 295 $$->append(adoptPtrWillBeNoop(new Predicate(adoptPtrWillBeNoop($1)))); | 275 $$->append(new Predicate($1)); |
| 296 parser->unregisterParseNode($1); | |
| 297 parser->registerPredicateVector($$); | |
| 298 } | 276 } |
| 299 | | 277 | |
| 300 PredicateList Predicate | 278 PredicateList Predicate |
| 301 { | 279 { |
| 302 $$->append(adoptPtrWillBeNoop(new Predicate(adoptPtrWillBeNoop($2)))); | 280 $$->append(new Predicate($2)); |
| 303 parser->unregisterParseNode($2); | |
| 304 } | 281 } |
| 305 ; | 282 ; |
| 306 | 283 |
| 307 Predicate: | 284 Predicate: |
| 308 '[' Expr ']' | 285 '[' Expr ']' |
| 309 { | 286 { |
| 310 $$ = $2; | 287 $$ = $2; |
| 311 } | 288 } |
| 312 ; | 289 ; |
| 313 | 290 |
| 314 DescendantOrSelf: | 291 DescendantOrSelf: |
| 315 SLASHSLASH | 292 SLASHSLASH |
| 316 { | 293 { |
| 317 $$ = new Step(Step::DescendantOrSelfAxis, Step::NodeTest(Step::NodeTest:
:AnyNodeTest)); | 294 $$ = new Step(Step::DescendantOrSelfAxis, Step::NodeTest(Step::NodeTest:
:AnyNodeTest)); |
| 318 parser->registerParseNode($$); | |
| 319 } | 295 } |
| 320 ; | 296 ; |
| 321 | 297 |
| 322 AbbreviatedStep: | 298 AbbreviatedStep: |
| 323 '.' | 299 '.' |
| 324 { | 300 { |
| 325 $$ = new Step(Step::SelfAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest
)); | 301 $$ = new Step(Step::SelfAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest
)); |
| 326 parser->registerParseNode($$); | |
| 327 } | 302 } |
| 328 | | 303 | |
| 329 DOTDOT | 304 DOTDOT |
| 330 { | 305 { |
| 331 $$ = new Step(Step::ParentAxis, Step::NodeTest(Step::NodeTest::AnyNodeTe
st)); | 306 $$ = new Step(Step::ParentAxis, Step::NodeTest(Step::NodeTest::AnyNodeTe
st)); |
| 332 parser->registerParseNode($$); | |
| 333 } | 307 } |
| 334 ; | 308 ; |
| 335 | 309 |
| 336 PrimaryExpr: | 310 PrimaryExpr: |
| 337 VARIABLEREFERENCE | 311 VARIABLEREFERENCE |
| 338 { | 312 { |
| 339 $$ = new VariableReference(*$1); | 313 $$ = new VariableReference(*$1); |
| 340 parser->deleteString($1); | 314 parser->deleteString($1); |
| 341 parser->registerParseNode($$); | |
| 342 } | 315 } |
| 343 | | 316 | |
| 344 '(' Expr ')' | 317 '(' Expr ')' |
| 345 { | 318 { |
| 346 $$ = $2; | 319 $$ = $2; |
| 347 } | 320 } |
| 348 | | 321 | |
| 349 LITERAL | 322 LITERAL |
| 350 { | 323 { |
| 351 $$ = new StringExpression(*$1); | 324 $$ = new StringExpression(*$1); |
| 352 parser->deleteString($1); | 325 parser->deleteString($1); |
| 353 parser->registerParseNode($$); | |
| 354 } | 326 } |
| 355 | | 327 | |
| 356 NUMBER | 328 NUMBER |
| 357 { | 329 { |
| 358 $$ = new Number($1->toDouble()); | 330 $$ = new Number($1->toDouble()); |
| 359 parser->deleteString($1); | 331 parser->deleteString($1); |
| 360 parser->registerParseNode($$); | |
| 361 } | 332 } |
| 362 | | 333 | |
| 363 FunctionCall | 334 FunctionCall |
| 364 ; | 335 ; |
| 365 | 336 |
| 366 FunctionCall: | 337 FunctionCall: |
| 367 FUNCTIONNAME '(' ')' | 338 FUNCTIONNAME '(' ')' |
| 368 { | 339 { |
| 369 $$ = createFunction(*$1); | 340 $$ = createFunction(*$1); |
| 370 if (!$$) | 341 if (!$$) |
| 371 YYABORT; | 342 YYABORT; |
| 372 parser->deleteString($1); | 343 parser->deleteString($1); |
| 373 parser->registerParseNode($$); | |
| 374 } | 344 } |
| 375 | | 345 | |
| 376 FUNCTIONNAME '(' ArgumentList ')' | 346 FUNCTIONNAME '(' ArgumentList ')' |
| 377 { | 347 { |
| 378 $$ = createFunction(*$1, *$3); | 348 $$ = createFunction(*$1, *$3); |
| 379 if (!$$) | 349 if (!$$) |
| 380 YYABORT; | 350 YYABORT; |
| 381 parser->deleteString($1); | 351 parser->deleteString($1); |
| 382 parser->deleteExpressionVector($3); | |
| 383 parser->registerParseNode($$); | |
| 384 } | 352 } |
| 385 ; | 353 ; |
| 386 | 354 |
| 387 ArgumentList: | 355 ArgumentList: |
| 388 Argument | 356 Argument |
| 389 { | 357 { |
| 390 $$ = new WillBeHeapVector<OwnPtrWillBeMember<Expression> >; | 358 $$ = new blink::HeapVector<blink::Member<Expression> >; |
| 391 $$->append(adoptPtrWillBeNoop($1)); | 359 $$->append($1); |
| 392 parser->unregisterParseNode($1); | |
| 393 parser->registerExpressionVector($$); | |
| 394 } | 360 } |
| 395 | | 361 | |
| 396 ArgumentList ',' Argument | 362 ArgumentList ',' Argument |
| 397 { | 363 { |
| 398 $$->append(adoptPtrWillBeNoop($3)); | 364 $$->append($3); |
| 399 parser->unregisterParseNode($3); | |
| 400 } | 365 } |
| 401 ; | 366 ; |
| 402 | 367 |
| 403 Argument: | 368 Argument: |
| 404 Expr | 369 Expr |
| 405 ; | 370 ; |
| 406 | 371 |
| 407 UnionExpr: | 372 UnionExpr: |
| 408 PathExpr | 373 PathExpr |
| 409 | | 374 | |
| 410 UnionExpr '|' PathExpr | 375 UnionExpr '|' PathExpr |
| 411 { | 376 { |
| 412 $$ = new Union; | 377 $$ = new Union; |
| 413 $$->addSubExpression(adoptPtrWillBeNoop($1)); | 378 $$->addSubExpression($1); |
| 414 $$->addSubExpression(adoptPtrWillBeNoop($3)); | 379 $$->addSubExpression($3); |
| 415 parser->unregisterParseNode($1); | |
| 416 parser->unregisterParseNode($3); | |
| 417 parser->registerParseNode($$); | |
| 418 } | 380 } |
| 419 ; | 381 ; |
| 420 | 382 |
| 421 PathExpr: | 383 PathExpr: |
| 422 LocationPath | 384 LocationPath |
| 423 { | 385 { |
| 424 $$ = $1; | 386 $$ = $1; |
| 425 } | 387 } |
| 426 | | 388 | |
| 427 FilterExpr | 389 FilterExpr |
| 428 | | 390 | |
| 429 FilterExpr '/' RelativeLocationPath | 391 FilterExpr '/' RelativeLocationPath |
| 430 { | 392 { |
| 431 $3->setAbsolute(true); | 393 $3->setAbsolute(true); |
| 432 $$ = new Path($1, $3); | 394 $$ = new Path($1, $3); |
| 433 parser->unregisterParseNode($1); | |
| 434 parser->unregisterParseNode($3); | |
| 435 parser->registerParseNode($$); | |
| 436 } | 395 } |
| 437 | | 396 | |
| 438 FilterExpr DescendantOrSelf RelativeLocationPath | 397 FilterExpr DescendantOrSelf RelativeLocationPath |
| 439 { | 398 { |
| 440 $3->insertFirstStep($2); | 399 $3->insertFirstStep($2); |
| 441 $3->setAbsolute(true); | 400 $3->setAbsolute(true); |
| 442 $$ = new Path($1, $3); | 401 $$ = new Path($1, $3); |
| 443 parser->unregisterParseNode($1); | |
| 444 parser->unregisterParseNode($2); | |
| 445 parser->unregisterParseNode($3); | |
| 446 parser->registerParseNode($$); | |
| 447 } | 402 } |
| 448 ; | 403 ; |
| 449 | 404 |
| 450 FilterExpr: | 405 FilterExpr: |
| 451 PrimaryExpr | 406 PrimaryExpr |
| 452 | | 407 | |
| 453 PrimaryExpr PredicateList | 408 PrimaryExpr PredicateList |
| 454 { | 409 { |
| 455 $$ = new Filter(adoptPtrWillBeNoop($1), *$2); | 410 $$ = new Filter($1, *$2); |
| 456 parser->unregisterParseNode($1); | |
| 457 parser->deletePredicateVector($2); | |
| 458 parser->registerParseNode($$); | |
| 459 } | 411 } |
| 460 ; | 412 ; |
| 461 | 413 |
| 462 OrExpr: | 414 OrExpr: |
| 463 AndExpr | 415 AndExpr |
| 464 | | 416 | |
| 465 OrExpr OR AndExpr | 417 OrExpr OR AndExpr |
| 466 { | 418 { |
| 467 $$ = new LogicalOp(LogicalOp::OP_Or, adoptPtrWillBeNoop($1), adoptPtrWil
lBeNoop($3)); | 419 $$ = new LogicalOp(LogicalOp::OP_Or, $1, $3); |
| 468 parser->unregisterParseNode($1); | |
| 469 parser->unregisterParseNode($3); | |
| 470 parser->registerParseNode($$); | |
| 471 } | 420 } |
| 472 ; | 421 ; |
| 473 | 422 |
| 474 AndExpr: | 423 AndExpr: |
| 475 EqualityExpr | 424 EqualityExpr |
| 476 | | 425 | |
| 477 AndExpr AND EqualityExpr | 426 AndExpr AND EqualityExpr |
| 478 { | 427 { |
| 479 $$ = new LogicalOp(LogicalOp::OP_And, adoptPtrWillBeNoop($1), adoptPtrWi
llBeNoop($3)); | 428 $$ = new LogicalOp(LogicalOp::OP_And, $1, $3); |
| 480 parser->unregisterParseNode($1); | |
| 481 parser->unregisterParseNode($3); | |
| 482 parser->registerParseNode($$); | |
| 483 } | 429 } |
| 484 ; | 430 ; |
| 485 | 431 |
| 486 EqualityExpr: | 432 EqualityExpr: |
| 487 RelationalExpr | 433 RelationalExpr |
| 488 | | 434 | |
| 489 EqualityExpr EQOP RelationalExpr | 435 EqualityExpr EQOP RelationalExpr |
| 490 { | 436 { |
| 491 $$ = new EqTestOp($2, adoptPtrWillBeNoop($1), adoptPtrWillBeNoop($3)); | 437 $$ = new EqTestOp($2, $1, $3); |
| 492 parser->unregisterParseNode($1); | |
| 493 parser->unregisterParseNode($3); | |
| 494 parser->registerParseNode($$); | |
| 495 } | 438 } |
| 496 ; | 439 ; |
| 497 | 440 |
| 498 RelationalExpr: | 441 RelationalExpr: |
| 499 AdditiveExpr | 442 AdditiveExpr |
| 500 | | 443 | |
| 501 RelationalExpr RELOP AdditiveExpr | 444 RelationalExpr RELOP AdditiveExpr |
| 502 { | 445 { |
| 503 $$ = new EqTestOp($2, adoptPtrWillBeNoop($1), adoptPtrWillBeNoop($3)); | 446 $$ = new EqTestOp($2, $1, $3); |
| 504 parser->unregisterParseNode($1); | |
| 505 parser->unregisterParseNode($3); | |
| 506 parser->registerParseNode($$); | |
| 507 } | 447 } |
| 508 ; | 448 ; |
| 509 | 449 |
| 510 AdditiveExpr: | 450 AdditiveExpr: |
| 511 MultiplicativeExpr | 451 MultiplicativeExpr |
| 512 | | 452 | |
| 513 AdditiveExpr PLUS MultiplicativeExpr | 453 AdditiveExpr PLUS MultiplicativeExpr |
| 514 { | 454 { |
| 515 $$ = new NumericOp(NumericOp::OP_Add, adoptPtrWillBeNoop($1), adoptPtrWi
llBeNoop($3)); | 455 $$ = new NumericOp(NumericOp::OP_Add, $1, $3); |
| 516 parser->unregisterParseNode($1); | |
| 517 parser->unregisterParseNode($3); | |
| 518 parser->registerParseNode($$); | |
| 519 } | 456 } |
| 520 | | 457 | |
| 521 AdditiveExpr MINUS MultiplicativeExpr | 458 AdditiveExpr MINUS MultiplicativeExpr |
| 522 { | 459 { |
| 523 $$ = new NumericOp(NumericOp::OP_Sub, adoptPtrWillBeNoop($1), adoptPtrWi
llBeNoop($3)); | 460 $$ = new NumericOp(NumericOp::OP_Sub, $1, $3); |
| 524 parser->unregisterParseNode($1); | |
| 525 parser->unregisterParseNode($3); | |
| 526 parser->registerParseNode($$); | |
| 527 } | 461 } |
| 528 ; | 462 ; |
| 529 | 463 |
| 530 MultiplicativeExpr: | 464 MultiplicativeExpr: |
| 531 UnaryExpr | 465 UnaryExpr |
| 532 | | 466 | |
| 533 MultiplicativeExpr MULOP UnaryExpr | 467 MultiplicativeExpr MULOP UnaryExpr |
| 534 { | 468 { |
| 535 $$ = new NumericOp($2, adoptPtrWillBeNoop($1), adoptPtrWillBeNoop($3)); | 469 $$ = new NumericOp($2, $1, $3); |
| 536 parser->unregisterParseNode($1); | |
| 537 parser->unregisterParseNode($3); | |
| 538 parser->registerParseNode($$); | |
| 539 } | 470 } |
| 540 ; | 471 ; |
| 541 | 472 |
| 542 UnaryExpr: | 473 UnaryExpr: |
| 543 UnionExpr | 474 UnionExpr |
| 544 | | 475 | |
| 545 MINUS UnaryExpr | 476 MINUS UnaryExpr |
| 546 { | 477 { |
| 547 $$ = new Negative; | 478 $$ = new Negative; |
| 548 $$->addSubExpression(adoptPtrWillBeNoop($2)); | 479 $$->addSubExpression($2); |
| 549 parser->unregisterParseNode($2); | |
| 550 parser->registerParseNode($$); | |
| 551 } | 480 } |
| 552 ; | 481 ; |
| 553 | 482 |
| 554 %% | 483 %% |
| OLD | NEW |