diff options
Diffstat (limited to 'Source/WebCore/xml/XPathGrammar.y')
-rw-r--r-- | Source/WebCore/xml/XPathGrammar.y | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/Source/WebCore/xml/XPathGrammar.y b/Source/WebCore/xml/XPathGrammar.y index a340a6929..4eb20b92a 100644 --- a/Source/WebCore/xml/XPathGrammar.y +++ b/Source/WebCore/xml/XPathGrammar.y @@ -32,8 +32,14 @@ #include "XPathFunctions.h" #include "XPathParser.h" #include "XPathPath.h" +#include "XPathStep.h" #include "XPathVariableReference.h" +#if COMPILER(MSVC) +// See https://msdn.microsoft.com/en-us/library/1wea5zwe.aspx +#pragma warning(disable: 4701) +#endif + #define YYMALLOC fastMalloc #define YYFREE fastFree @@ -47,50 +53,54 @@ using namespace XPath; %} -%pure_parser +%pure-parser %lex-param { parser } %parse-param { Parser& parser } -%union { NumericOp::Opcode numericOpcode; } +%union { + NumericOp::Opcode numericOpcode; + EqTestOp::Opcode equalityTestOpcode; + StringImpl* string; + Step::Axis axis; + LocationPath* locationPath; + Step::NodeTest* nodeTest; + Vector<std::unique_ptr<Expression>>* expressionVector; + Step* step; + Expression* expression; +} %left <numericOpcode> MULOP -%union { EqTestOp::Opcode equalityTestOpcode; } %left <equalityTestOpcode> EQOP RELOP %left PLUS MINUS %left OR AND -%union { StringImpl* string; } %token <string> FUNCTIONNAME LITERAL NAMETEST NUMBER NODETYPE VARIABLEREFERENCE %destructor { if ($$) $$->deref(); } FUNCTIONNAME LITERAL NAMETEST NUMBER NODETYPE VARIABLEREFERENCE -%union { Step::Axis axis; } %token <axis> AXISNAME %type <axis> AxisSpecifier -%token COMMENT DOTDOT PI NODE SLASHSLASH TEXT XPATH_ERROR +%token COMMENT DOTDOT PI NODE SLASHSLASH TEXT_ XPATH_ERROR -%union { LocationPath* locationPath; } %type <locationPath> LocationPath AbsoluteLocationPath RelativeLocationPath %destructor { delete $$; } LocationPath AbsoluteLocationPath RelativeLocationPath -%union { Step::NodeTest* nodeTest; } %type <nodeTest> NodeTest %destructor { delete $$; } NodeTest -%union { Vector<std::unique_ptr<Expression>>* expressionVector; } %type <expressionVector> ArgumentList PredicateList OptionalPredicateList %destructor { delete $$; } ArgumentList PredicateList OptionalPredicateList -%union { Step* step; } %type <step> Step AbbreviatedStep DescendantOrSelf %destructor { delete $$; } Step AbbreviatedStep DescendantOrSelf -%union { Expression* expression; } %type <expression> AdditiveExpr AndExpr Argument EqualityExpr Expr FilterExpr FunctionCall MultiplicativeExpr OrExpr PathExpr Predicate PrimaryExpr RelationalExpr UnaryExpr UnionExpr %destructor { delete $$; } AdditiveExpr AndExpr Argument EqualityExpr Expr FilterExpr FunctionCall MultiplicativeExpr OrExpr PathExpr Predicate PrimaryExpr RelationalExpr UnaryExpr UnionExpr + + %{ static int xpathyylex(YYSTYPE* yylval, Parser& parser) { return parser.lex(*yylval); } @@ -166,9 +176,9 @@ Step: std::unique_ptr<Step::NodeTest> nodeTest($1); std::unique_ptr<Vector<std::unique_ptr<Expression>>> predicateList($2); if (predicateList) - $$ = new Step(Step::ChildAxis, std::move(*nodeTest), std::move(*predicateList)); + $$ = new Step(Step::ChildAxis, WTFMove(*nodeTest), WTFMove(*predicateList)); else - $$ = new Step(Step::ChildAxis, std::move(*nodeTest)); + $$ = new Step(Step::ChildAxis, WTFMove(*nodeTest)); } | NAMETEST OptionalPredicateList @@ -184,7 +194,7 @@ Step: } if (predicateList) - $$ = new Step(Step::ChildAxis, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI), std::move(*predicateList)); + $$ = new Step(Step::ChildAxis, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI), WTFMove(*predicateList)); else $$ = new Step(Step::ChildAxis, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI)); } @@ -195,9 +205,9 @@ Step: std::unique_ptr<Vector<std::unique_ptr<Expression>>> predicateList($3); if (predicateList) - $$ = new Step($1, std::move(*nodeTest), std::move(*predicateList)); + $$ = new Step($1, WTFMove(*nodeTest), WTFMove(*predicateList)); else - $$ = new Step($1, std::move(*nodeTest)); + $$ = new Step($1, WTFMove(*nodeTest)); } | AxisSpecifier NAMETEST OptionalPredicateList @@ -213,7 +223,7 @@ Step: } if (predicateList) - $$ = new Step($1, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI), std::move(*predicateList)); + $$ = new Step($1, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI), WTFMove(*predicateList)); else $$ = new Step($1, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI)); } @@ -236,7 +246,7 @@ NodeTest: $$ = new Step::NodeTest(Step::NodeTest::AnyNodeTest); } | - TEXT '(' ')' + TEXT_ '(' ')' { $$ = new Step::NodeTest(Step::NodeTest::TextNodeTest); } @@ -322,7 +332,7 @@ PrimaryExpr: LITERAL { String literal = adoptRef($1); - $$ = new StringExpression(std::move(literal)); + $$ = new StringExpression(WTFMove(literal)); } | NUMBER @@ -347,7 +357,7 @@ FunctionCall: { String name = adoptRef($1); std::unique_ptr<Vector<std::unique_ptr<Expression>>> argumentList($3); - $$ = XPath::Function::create(name, std::move(*argumentList)).release(); + $$ = XPath::Function::create(name, WTFMove(*argumentList)).release(); if (!$$) YYABORT; } @@ -408,7 +418,7 @@ FilterExpr: PrimaryExpr PredicateList { std::unique_ptr<Vector<std::unique_ptr<Expression>>> predicateList($2); - $$ = new Filter(std::unique_ptr<Expression>($1), std::move(*predicateList)); + $$ = new Filter(std::unique_ptr<Expression>($1), WTFMove(*predicateList)); } ; |