Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: third_party/WebKit/Source/core/xml/XPathGrammar.y

Issue 2329463004: ABANDONED CL: Changes needed to make things compile after running rewrite_to_chrome_style tool. (Closed)
Patch Set: More fixes - things build fine at this point. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 20 matching lines...) Expand all
31 #include "core/xml/XPathNSResolver.h" 31 #include "core/xml/XPathNSResolver.h"
32 #include "core/xml/XPathParser.h" 32 #include "core/xml/XPathParser.h"
33 #include "core/xml/XPathPath.h" 33 #include "core/xml/XPathPath.h"
34 #include "core/xml/XPathPredicate.h" 34 #include "core/xml/XPathPredicate.h"
35 #include "core/xml/XPathStep.h" 35 #include "core/xml/XPathStep.h"
36 #include "core/xml/XPathVariableReference.h" 36 #include "core/xml/XPathVariableReference.h"
37 #include "wtf/allocator/Partitions.h" 37 #include "wtf/allocator/Partitions.h"
38 38
39 void* yyFastMalloc(size_t size) 39 void* yyFastMalloc(size_t size)
40 { 40 {
41 return WTF::Partitions::fastMalloc(size, nullptr); 41 return WTF::Partitions::FastMalloc(size, nullptr);
42 } 42 }
43 43
44 #define YYMALLOC yyFastMalloc 44 #define YYMALLOC yyFastMalloc
45 #define YYFREE WTF::Partitions::fastFree 45 #define YYFREE WTF::Partitions::FastFree
46 46
47 #define YYENABLE_NLS 0 47 #define YYENABLE_NLS 0
48 #define YYLTYPE_IS_TRIVIAL 1 48 #define YYLTYPE_IS_TRIVIAL 1
49 #define YYDEBUG 0 49 #define YYDEBUG 0
50 #define YYMAXDEPTH 10000 50 #define YYMAXDEPTH 10000
51 51
52 using namespace blink; 52 using namespace blink;
53 using namespace XPath; 53 using namespace XPath;
54 54
55 %} 55 %}
(...skipping 10 matching lines...) Expand all
66 String* str; 66 String* str;
67 blink::XPath::Expression* expr; 67 blink::XPath::Expression* expr;
68 blink::HeapVector<blink::Member<blink::XPath::Predicate>>* predList; 68 blink::HeapVector<blink::Member<blink::XPath::Predicate>>* predList;
69 blink::HeapVector<blink::Member<blink::XPath::Expression>>* argList; 69 blink::HeapVector<blink::Member<blink::XPath::Expression>>* argList;
70 blink::XPath::Step* step; 70 blink::XPath::Step* step;
71 blink::XPath::LocationPath* locationPath; 71 blink::XPath::LocationPath* locationPath;
72 } 72 }
73 73
74 %{ 74 %{
75 75
76 static int xpathyylex(YYSTYPE* yylval) { return Parser::current()->lex(yylval); } 76 static int xpathyylex(YYSTYPE* yylval) { return Parser::Current()->Lex(yylval); }
77 static void xpathyyerror(void*, const char*) { } 77 static void xpathyyerror(void*, const char*) { }
78 78
79 %} 79 %}
80 80
81 %left <numop> MULOP 81 %left <numop> MULOP
82 %left <eqop> EQOP RELOP 82 %left <eqop> EQOP RELOP
83 %left PLUS MINUS 83 %left PLUS MINUS
84 %left OR AND 84 %left OR AND
85 %token <axis> AXISNAME 85 %token <axis> AXISNAME
86 %token <str> NODETYPE PI FUNCTIONNAME LITERAL 86 %token <str> NODETYPE PI FUNCTIONNAME LITERAL
(...skipping 27 matching lines...) Expand all
114 %type <expr> RelationalExpr 114 %type <expr> RelationalExpr
115 %type <expr> AdditiveExpr 115 %type <expr> AdditiveExpr
116 %type <expr> MultiplicativeExpr 116 %type <expr> MultiplicativeExpr
117 %type <expr> UnaryExpr 117 %type <expr> UnaryExpr
118 118
119 %% 119 %%
120 120
121 Expr: 121 Expr:
122 OrExpr 122 OrExpr
123 { 123 {
124 parser->m_topExpr = $1; 124 parser->top_expr_ = $1;
125 } 125 }
126 ; 126 ;
127 127
128 LocationPath: 128 LocationPath:
129 RelativeLocationPath 129 RelativeLocationPath
130 { 130 {
131 $$->setAbsolute(false); 131 $$->SetAbsolute(false);
132 } 132 }
133 | 133 |
134 AbsoluteLocationPath 134 AbsoluteLocationPath
135 { 135 {
136 $$->setAbsolute(true); 136 $$->SetAbsolute(true);
137 } 137 }
138 ; 138 ;
139 139
140 AbsoluteLocationPath: 140 AbsoluteLocationPath:
141 '/' 141 '/'
142 { 142 {
143 $$ = new LocationPath; 143 $$ = new LocationPath;
144 } 144 }
145 | 145 |
146 '/' RelativeLocationPath 146 '/' RelativeLocationPath
147 { 147 {
148 $$ = $2; 148 $$ = $2;
149 } 149 }
150 | 150 |
151 DescendantOrSelf RelativeLocationPath 151 DescendantOrSelf RelativeLocationPath
152 { 152 {
153 $$ = $2; 153 $$ = $2;
154 $$->insertFirstStep($1); 154 $$->InsertFirstStep($1);
155 } 155 }
156 ; 156 ;
157 157
158 RelativeLocationPath: 158 RelativeLocationPath:
159 Step 159 Step
160 { 160 {
161 $$ = new LocationPath; 161 $$ = new LocationPath;
162 $$->appendStep($1); 162 $$->AppendStep($1);
163 } 163 }
164 | 164 |
165 RelativeLocationPath '/' Step 165 RelativeLocationPath '/' Step
166 { 166 {
167 $$->appendStep($3); 167 $$->AppendStep($3);
168 } 168 }
169 | 169 |
170 RelativeLocationPath DescendantOrSelf Step 170 RelativeLocationPath DescendantOrSelf Step
171 { 171 {
172 $$->appendStep($2); 172 $$->AppendStep($2);
173 $$->appendStep($3); 173 $$->AppendStep($3);
174 } 174 }
175 ; 175 ;
176 176
177 Step: 177 Step:
178 NodeTest OptionalPredicateList 178 NodeTest OptionalPredicateList
179 { 179 {
180 if ($2) 180 if ($2)
181 $$ = new Step(Step::ChildAxis, *$1, *$2); 181 $$ = new Step(Step::kChildAxis, *$1, *$2);
182 else 182 else
183 $$ = new Step(Step::ChildAxis, *$1); 183 $$ = new Step(Step::kChildAxis, *$1);
184 } 184 }
185 | 185 |
186 NAMETEST OptionalPredicateList 186 NAMETEST OptionalPredicateList
187 { 187 {
188 AtomicString localName; 188 AtomicString localName;
189 AtomicString namespaceURI; 189 AtomicString namespaceURI;
190 if (!parser->expandQName(*$1, localName, namespaceURI)) { 190 if (!parser->ExpandQName(*$1, localName, namespaceURI)) {
191 parser->m_gotNamespaceError = true; 191 parser->got_namespace_error_ = true;
192 YYABORT; 192 YYABORT;
193 } 193 }
194 194
195 if ($2) 195 if ($2)
196 $$ = new Step(Step::ChildAxis, Step::NodeTest(Step::NodeTest::NameTe st, localName, namespaceURI), *$2); 196 $$ = new Step(Step::kChildAxis, Step::NodeTest(Step::NodeTest::kName Test, localName, namespaceURI), *$2);
197 else 197 else
198 $$ = new Step(Step::ChildAxis, Step::NodeTest(Step::NodeTest::NameTe st, localName, namespaceURI)); 198 $$ = new Step(Step::kChildAxis, Step::NodeTest(Step::NodeTest::kName Test, localName, namespaceURI));
199 parser->deleteString($1); 199 parser->DeleteString($1);
200 } 200 }
201 | 201 |
202 AxisSpecifier NodeTest OptionalPredicateList 202 AxisSpecifier NodeTest OptionalPredicateList
203 { 203 {
204 if ($3) 204 if ($3)
205 $$ = new Step($1, *$2, *$3); 205 $$ = new Step($1, *$2, *$3);
206 else 206 else
207 $$ = new Step($1, *$2); 207 $$ = new Step($1, *$2);
208 } 208 }
209 | 209 |
210 AxisSpecifier NAMETEST OptionalPredicateList 210 AxisSpecifier NAMETEST OptionalPredicateList
211 { 211 {
212 AtomicString localName; 212 AtomicString localName;
213 AtomicString namespaceURI; 213 AtomicString namespaceURI;
214 if (!parser->expandQName(*$2, localName, namespaceURI)) { 214 if (!parser->ExpandQName(*$2, localName, namespaceURI)) {
215 parser->m_gotNamespaceError = true; 215 parser->got_namespace_error_ = true;
216 YYABORT; 216 YYABORT;
217 } 217 }
218 218
219 if ($3) 219 if ($3)
220 $$ = new Step($1, Step::NodeTest(Step::NodeTest::NameTest, localName , namespaceURI), *$3); 220 $$ = new Step($1, Step::NodeTest(Step::NodeTest::kNameTest, localNam e, namespaceURI), *$3);
221 else 221 else
222 $$ = new Step($1, Step::NodeTest(Step::NodeTest::NameTest, localName , namespaceURI)); 222 $$ = new Step($1, Step::NodeTest(Step::NodeTest::kNameTest, localNam e, namespaceURI));
223 parser->deleteString($2); 223 parser->DeleteString($2);
224 } 224 }
225 | 225 |
226 AbbreviatedStep 226 AbbreviatedStep
227 ; 227 ;
228 228
229 AxisSpecifier: 229 AxisSpecifier:
230 AXISNAME 230 AXISNAME
231 | 231 |
232 '@' 232 '@'
233 { 233 {
234 $$ = Step::AttributeAxis; 234 $$ = Step::kAttributeAxis;
235 } 235 }
236 ; 236 ;
237 237
238 NodeTest: 238 NodeTest:
239 NODETYPE '(' ')' 239 NODETYPE '(' ')'
240 { 240 {
241 if (*$1 == "node") 241 if (*$1 == "node")
242 $$ = new Step::NodeTest(Step::NodeTest::AnyNodeTest); 242 $$ = new Step::NodeTest(Step::NodeTest::kAnyNodeTest);
243 else if (*$1 == "text") 243 else if (*$1 == "text")
244 $$ = new Step::NodeTest(Step::NodeTest::TextNodeTest); 244 $$ = new Step::NodeTest(Step::NodeTest::kTextNodeTest);
245 else if (*$1 == "comment") 245 else if (*$1 == "comment")
246 $$ = new Step::NodeTest(Step::NodeTest::CommentNodeTest); 246 $$ = new Step::NodeTest(Step::NodeTest::kCommentNodeTest);
247 247
248 parser->deleteString($1); 248 parser->DeleteString($1);
249 } 249 }
250 | 250 |
251 PI '(' ')' 251 PI '(' ')'
252 { 252 {
253 $$ = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest); 253 $$ = new Step::NodeTest(Step::NodeTest::kProcessingInstructionNodeTest);
254 parser->deleteString($1); 254 parser->DeleteString($1);
255 } 255 }
256 | 256 |
257 PI '(' LITERAL ')' 257 PI '(' LITERAL ')'
258 { 258 {
259 $$ = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest, $ 3->stripWhiteSpace()); 259 $$ = new Step::NodeTest(Step::NodeTest::kProcessingInstructionNodeTest, $3->StripWhiteSpace());
260 parser->deleteString($1); 260 parser->DeleteString($1);
261 parser->deleteString($3); 261 parser->DeleteString($3);
262 } 262 }
263 ; 263 ;
264 264
265 OptionalPredicateList: 265 OptionalPredicateList:
266 /* empty */ 266 /* empty */
267 { 267 {
268 $$ = 0; 268 $$ = 0;
269 } 269 }
270 | 270 |
271 PredicateList 271 PredicateList
(...skipping 15 matching lines...) Expand all
287 Predicate: 287 Predicate:
288 '[' Expr ']' 288 '[' Expr ']'
289 { 289 {
290 $$ = $2; 290 $$ = $2;
291 } 291 }
292 ; 292 ;
293 293
294 DescendantOrSelf: 294 DescendantOrSelf:
295 SLASHSLASH 295 SLASHSLASH
296 { 296 {
297 $$ = new Step(Step::DescendantOrSelfAxis, Step::NodeTest(Step::NodeTest: :AnyNodeTest)); 297 $$ = new Step(Step::kDescendantOrSelfAxis, Step::NodeTest(Step::NodeTest ::kAnyNodeTest));
298 } 298 }
299 ; 299 ;
300 300
301 AbbreviatedStep: 301 AbbreviatedStep:
302 '.' 302 '.'
303 { 303 {
304 $$ = new Step(Step::SelfAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest )); 304 $$ = new Step(Step::kSelfAxis, Step::NodeTest(Step::NodeTest::kAnyNodeTe st));
305 } 305 }
306 | 306 |
307 DOTDOT 307 DOTDOT
308 { 308 {
309 $$ = new Step(Step::ParentAxis, Step::NodeTest(Step::NodeTest::AnyNodeTe st)); 309 $$ = new Step(Step::kParentAxis, Step::NodeTest(Step::NodeTest::kAnyNode Test));
310 } 310 }
311 ; 311 ;
312 312
313 PrimaryExpr: 313 PrimaryExpr:
314 VARIABLEREFERENCE 314 VARIABLEREFERENCE
315 { 315 {
316 $$ = new VariableReference(*$1); 316 $$ = new VariableReference(*$1);
317 parser->deleteString($1); 317 parser->DeleteString($1);
318 } 318 }
319 | 319 |
320 '(' Expr ')' 320 '(' Expr ')'
321 { 321 {
322 $$ = $2; 322 $$ = $2;
323 } 323 }
324 | 324 |
325 LITERAL 325 LITERAL
326 { 326 {
327 $$ = new StringExpression(*$1); 327 $$ = new StringExpression(*$1);
328 parser->deleteString($1); 328 parser->DeleteString($1);
329 } 329 }
330 | 330 |
331 NUMBER 331 NUMBER
332 { 332 {
333 $$ = new Number($1->toDouble()); 333 $$ = new Number($1->ToDouble());
334 parser->deleteString($1); 334 parser->DeleteString($1);
335 } 335 }
336 | 336 |
337 FunctionCall 337 FunctionCall
338 ; 338 ;
339 339
340 FunctionCall: 340 FunctionCall:
341 FUNCTIONNAME '(' ')' 341 FUNCTIONNAME '(' ')'
342 { 342 {
343 $$ = createFunction(*$1); 343 $$ = CreateFunction(*$1);
344 if (!$$) 344 if (!$$)
345 YYABORT; 345 YYABORT;
346 parser->deleteString($1); 346 parser->DeleteString($1);
347 } 347 }
348 | 348 |
349 FUNCTIONNAME '(' ArgumentList ')' 349 FUNCTIONNAME '(' ArgumentList ')'
350 { 350 {
351 $$ = createFunction(*$1, *$3); 351 $$ = CreateFunction(*$1, *$3);
352 if (!$$) 352 if (!$$)
353 YYABORT; 353 YYABORT;
354 parser->deleteString($1); 354 parser->DeleteString($1);
355 } 355 }
356 ; 356 ;
357 357
358 ArgumentList: 358 ArgumentList:
359 Argument 359 Argument
360 { 360 {
361 $$ = new blink::HeapVector<blink::Member<Expression>>; 361 $$ = new blink::HeapVector<blink::Member<Expression>>;
362 $$->push_back($1); 362 $$->push_back($1);
363 } 363 }
364 | 364 |
365 ArgumentList ',' Argument 365 ArgumentList ',' Argument
366 { 366 {
367 $$->push_back($3); 367 $$->push_back($3);
368 } 368 }
369 ; 369 ;
370 370
371 Argument: 371 Argument:
372 Expr 372 Expr
373 ; 373 ;
374 374
375 UnionExpr: 375 UnionExpr:
376 PathExpr 376 PathExpr
377 | 377 |
378 UnionExpr '|' PathExpr 378 UnionExpr '|' PathExpr
379 { 379 {
380 $$ = new Union; 380 $$ = new Union;
381 $$->addSubExpression($1); 381 $$->AddSubExpression($1);
382 $$->addSubExpression($3); 382 $$->AddSubExpression($3);
383 } 383 }
384 ; 384 ;
385 385
386 PathExpr: 386 PathExpr:
387 LocationPath 387 LocationPath
388 { 388 {
389 $$ = $1; 389 $$ = $1;
390 } 390 }
391 | 391 |
392 FilterExpr 392 FilterExpr
393 | 393 |
394 FilterExpr '/' RelativeLocationPath 394 FilterExpr '/' RelativeLocationPath
395 { 395 {
396 $3->setAbsolute(true); 396 $3->SetAbsolute(true);
397 $$ = new blink::XPath::Path($1, $3); 397 $$ = new blink::XPath::Path($1, $3);
398 } 398 }
399 | 399 |
400 FilterExpr DescendantOrSelf RelativeLocationPath 400 FilterExpr DescendantOrSelf RelativeLocationPath
401 { 401 {
402 $3->insertFirstStep($2); 402 $3->InsertFirstStep($2);
403 $3->setAbsolute(true); 403 $3->SetAbsolute(true);
404 $$ = new blink::XPath::Path($1, $3); 404 $$ = new blink::XPath::Path($1, $3);
405 } 405 }
406 ; 406 ;
407 407
408 FilterExpr: 408 FilterExpr:
409 PrimaryExpr 409 PrimaryExpr
410 | 410 |
411 PrimaryExpr PredicateList 411 PrimaryExpr PredicateList
412 { 412 {
413 $$ = new blink::XPath::Filter($1, *$2); 413 $$ = new blink::XPath::Filter($1, *$2);
414 } 414 }
415 ; 415 ;
416 416
417 OrExpr: 417 OrExpr:
418 AndExpr 418 AndExpr
419 | 419 |
420 OrExpr OR AndExpr 420 OrExpr OR AndExpr
421 { 421 {
422 $$ = new LogicalOp(LogicalOp::OP_Or, $1, $3); 422 $$ = new LogicalOp(LogicalOp::kOP_Or, $1, $3);
423 } 423 }
424 ; 424 ;
425 425
426 AndExpr: 426 AndExpr:
427 EqualityExpr 427 EqualityExpr
428 | 428 |
429 AndExpr AND EqualityExpr 429 AndExpr AND EqualityExpr
430 { 430 {
431 $$ = new LogicalOp(LogicalOp::OP_And, $1, $3); 431 $$ = new LogicalOp(LogicalOp::kOP_And, $1, $3);
432 } 432 }
433 ; 433 ;
434 434
435 EqualityExpr: 435 EqualityExpr:
436 RelationalExpr 436 RelationalExpr
437 | 437 |
438 EqualityExpr EQOP RelationalExpr 438 EqualityExpr EQOP RelationalExpr
439 { 439 {
440 $$ = new EqTestOp($2, $1, $3); 440 $$ = new EqTestOp($2, $1, $3);
441 } 441 }
442 ; 442 ;
443 443
444 RelationalExpr: 444 RelationalExpr:
445 AdditiveExpr 445 AdditiveExpr
446 | 446 |
447 RelationalExpr RELOP AdditiveExpr 447 RelationalExpr RELOP AdditiveExpr
448 { 448 {
449 $$ = new EqTestOp($2, $1, $3); 449 $$ = new EqTestOp($2, $1, $3);
450 } 450 }
451 ; 451 ;
452 452
453 AdditiveExpr: 453 AdditiveExpr:
454 MultiplicativeExpr 454 MultiplicativeExpr
455 | 455 |
456 AdditiveExpr PLUS MultiplicativeExpr 456 AdditiveExpr PLUS MultiplicativeExpr
457 { 457 {
458 $$ = new NumericOp(NumericOp::OP_Add, $1, $3); 458 $$ = new NumericOp(NumericOp::kOP_Add, $1, $3);
459 } 459 }
460 | 460 |
461 AdditiveExpr MINUS MultiplicativeExpr 461 AdditiveExpr MINUS MultiplicativeExpr
462 { 462 {
463 $$ = new NumericOp(NumericOp::OP_Sub, $1, $3); 463 $$ = new NumericOp(NumericOp::kOP_Sub, $1, $3);
464 } 464 }
465 ; 465 ;
466 466
467 MultiplicativeExpr: 467 MultiplicativeExpr:
468 UnaryExpr 468 UnaryExpr
469 | 469 |
470 MultiplicativeExpr MULOP UnaryExpr 470 MultiplicativeExpr MULOP UnaryExpr
471 { 471 {
472 $$ = new NumericOp($2, $1, $3); 472 $$ = new NumericOp($2, $1, $3);
473 } 473 }
474 ; 474 ;
475 475
476 UnaryExpr: 476 UnaryExpr:
477 UnionExpr 477 UnionExpr
478 | 478 |
479 MINUS UnaryExpr 479 MINUS UnaryExpr
480 { 480 {
481 $$ = new Negative; 481 $$ = new Negative;
482 $$->addSubExpression($2); 482 $$->AddSubExpression($2);
483 } 483 }
484 ; 484 ;
485 485
486 %% 486 %%
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/timing/PerformanceObserverTest.cpp ('k') | third_party/WebKit/Source/core/xml/XPathParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698