wok view webkit-r/stuff/bison26.u @ rev 18200
Up tazinst (61)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Jul 12 22:00:23 2015 +0200 (2015-07-12) |
parents | |
children |
line source
1 --- Source/WebCore/css/CSSGrammar.y
2 +++ Source/WebCore/css/CSSGrammar.y
3 @@ -53,14 +53,13 @@
4 #define YYMAXDEPTH 10000
5 #define YYDEBUG 0
7 -// FIXME: Replace with %parse-param { CSSParser* parser } once we can depend on bison 2.x
8 -#define YYPARSE_PARAM parser
9 -#define YYLEX_PARAM parser
10 -
11 %}
13 %pure_parser
15 +%parse-param { CSSParser* parser }
16 +%lex-param { CSSParser* parser }
17 +
18 %union {
19 bool boolean;
20 char character;
21 @@ -88,7 +87,7 @@
23 %{
25 -static inline int cssyyerror(const char*)
26 +static inline int cssyyerror(void*, const char*)
27 {
28 return 1;
29 }
30 --- Source/WebCore/css/CSSParser.cpp
31 +++ Source/WebCore/css/CSSParser.cpp
32 @@ -96,7 +96,7 @@
33 extern int cssyydebug;
34 #endif
36 -extern int cssyyparse(void* parser);
37 +extern int cssyyparse(WebCore::CSSParser*);
39 using namespace std;
40 using namespace WTF;
41 --- Source/WebCore/xml/XPathGrammar.y
42 +++ Source/WebCore/xml/XPathGrammar.y
43 @@ -34,6 +34,7 @@
44 #include "XPathParser.h"
45 #include "XPathPath.h"
46 #include "XPathPredicate.h"
47 +#include "XPathStep.h"
48 #include "XPathVariableReference.h"
49 #include <wtf/FastMalloc.h>
51 @@ -44,8 +45,6 @@
52 #define YYLTYPE_IS_TRIVIAL 1
53 #define YYDEBUG 0
54 #define YYMAXDEPTH 10000
55 -#define YYPARSE_PARAM parserParameter
56 -#define PARSER static_cast<Parser*>(parserParameter)
58 using namespace WebCore;
59 using namespace XPath;
60 @@ -53,6 +52,7 @@
61 %}
63 %pure_parser
64 +%parse-param { WebCore::XPath::Parser* parser }
66 %union
67 {
68 @@ -71,7 +71,7 @@
69 %{
71 static int xpathyylex(YYSTYPE* yylval) { return Parser::current()->lex(yylval); }
72 -static void xpathyyerror(const char*) { }
73 +static void xpathyyerror(void*, const char*) { }
75 %}
77 @@ -118,7 +118,7 @@
78 Expr:
79 OrExpr
80 {
81 - PARSER->m_topExpr = $1;
82 + parser->m_topExpr = $1;
83 }
84 ;
86 @@ -138,7 +138,7 @@
87 '/'
88 {
89 $$ = new LocationPath;
90 - PARSER->registerParseNode($$);
91 + parser->registerParseNode($$);
92 }
93 |
94 '/' RelativeLocationPath
95 @@ -150,7 +150,7 @@
96 {
97 $$ = $2;
98 $$->insertFirstStep($1);
99 - PARSER->unregisterParseNode($1);
100 + parser->unregisterParseNode($1);
101 }
102 ;
104 @@ -159,22 +159,22 @@
105 {
106 $$ = new LocationPath;
107 $$->appendStep($1);
108 - PARSER->unregisterParseNode($1);
109 - PARSER->registerParseNode($$);
110 + parser->unregisterParseNode($1);
111 + parser->registerParseNode($$);
112 }
113 |
114 RelativeLocationPath '/' Step
115 {
116 $$->appendStep($3);
117 - PARSER->unregisterParseNode($3);
118 + parser->unregisterParseNode($3);
119 }
120 |
121 RelativeLocationPath DescendantOrSelf Step
122 {
123 $$->appendStep($2);
124 $$->appendStep($3);
125 - PARSER->unregisterParseNode($2);
126 - PARSER->unregisterParseNode($3);
127 + parser->unregisterParseNode($2);
128 + parser->unregisterParseNode($3);
129 }
130 ;
132 @@ -183,58 +183,58 @@
133 {
134 if ($2) {
135 $$ = new Step(Step::ChildAxis, *$1, *$2);
136 - PARSER->deletePredicateVector($2);
137 + parser->deletePredicateVector($2);
138 } else
139 $$ = new Step(Step::ChildAxis, *$1);
140 - PARSER->deleteNodeTest($1);
141 - PARSER->registerParseNode($$);
142 + parser->deleteNodeTest($1);
143 + parser->registerParseNode($$);
144 }
145 |
146 NAMETEST OptionalPredicateList
147 {
148 String localName;
149 String namespaceURI;
150 - if (!PARSER->expandQName(*$1, localName, namespaceURI)) {
151 - PARSER->m_gotNamespaceError = true;
152 + if (!parser->expandQName(*$1, localName, namespaceURI)) {
153 + parser->m_gotNamespaceError = true;
154 YYABORT;
155 }
157 if ($2) {
158 $$ = new Step(Step::ChildAxis, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI), *$2);
159 - PARSER->deletePredicateVector($2);
160 + parser->deletePredicateVector($2);
161 } else
162 $$ = new Step(Step::ChildAxis, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI));
163 - PARSER->deleteString($1);
164 - PARSER->registerParseNode($$);
165 + parser->deleteString($1);
166 + parser->registerParseNode($$);
167 }
168 |
169 AxisSpecifier NodeTest OptionalPredicateList
170 {
171 if ($3) {
172 $$ = new Step($1, *$2, *$3);
173 - PARSER->deletePredicateVector($3);
174 + parser->deletePredicateVector($3);
175 } else
176 $$ = new Step($1, *$2);
177 - PARSER->deleteNodeTest($2);
178 - PARSER->registerParseNode($$);
179 + parser->deleteNodeTest($2);
180 + parser->registerParseNode($$);
181 }
182 |
183 AxisSpecifier NAMETEST OptionalPredicateList
184 {
185 String localName;
186 String namespaceURI;
187 - if (!PARSER->expandQName(*$2, localName, namespaceURI)) {
188 - PARSER->m_gotNamespaceError = true;
189 + if (!parser->expandQName(*$2, localName, namespaceURI)) {
190 + parser->m_gotNamespaceError = true;
191 YYABORT;
192 }
194 if ($3) {
195 $$ = new Step($1, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI), *$3);
196 - PARSER->deletePredicateVector($3);
197 + parser->deletePredicateVector($3);
198 } else
199 $$ = new Step($1, Step::NodeTest(Step::NodeTest::NameTest, localName, namespaceURI));
200 - PARSER->deleteString($2);
201 - PARSER->registerParseNode($$);
202 + parser->deleteString($2);
203 + parser->registerParseNode($$);
204 }
205 |
206 AbbreviatedStep
207 @@ -259,23 +259,23 @@
208 else if (*$1 == "comment")
209 $$ = new Step::NodeTest(Step::NodeTest::CommentNodeTest);
211 - PARSER->deleteString($1);
212 - PARSER->registerNodeTest($$);
213 + parser->deleteString($1);
214 + parser->registerNodeTest($$);
215 }
216 |
217 PI '(' ')'
218 {
219 $$ = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest);
220 - PARSER->deleteString($1);
221 - PARSER->registerNodeTest($$);
222 + parser->deleteString($1);
223 + parser->registerNodeTest($$);
224 }
225 |
226 PI '(' LITERAL ')'
227 {
228 $$ = new Step::NodeTest(Step::NodeTest::ProcessingInstructionNodeTest, $3->stripWhiteSpace());
229 - PARSER->deleteString($1);
230 - PARSER->deleteString($3);
231 - PARSER->registerNodeTest($$);
232 + parser->deleteString($1);
233 + parser->deleteString($3);
234 + parser->registerNodeTest($$);
235 }
236 ;
238 @@ -293,14 +293,14 @@
239 {
240 $$ = new Vector<Predicate*>;
241 $$->append(new Predicate($1));
242 - PARSER->unregisterParseNode($1);
243 - PARSER->registerPredicateVector($$);
244 + parser->unregisterParseNode($1);
245 + parser->registerPredicateVector($$);
246 }
247 |
248 PredicateList Predicate
249 {
250 $$->append(new Predicate($2));
251 - PARSER->unregisterParseNode($2);
252 + parser->unregisterParseNode($2);
253 }
254 ;
256 @@ -315,7 +315,7 @@
257 SLASHSLASH
258 {
259 $$ = new Step(Step::DescendantOrSelfAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest));
260 - PARSER->registerParseNode($$);
261 + parser->registerParseNode($$);
262 }
263 ;
265 @@ -323,13 +323,13 @@
266 '.'
267 {
268 $$ = new Step(Step::SelfAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest));
269 - PARSER->registerParseNode($$);
270 + parser->registerParseNode($$);
271 }
272 |
273 DOTDOT
274 {
275 $$ = new Step(Step::ParentAxis, Step::NodeTest(Step::NodeTest::AnyNodeTest));
276 - PARSER->registerParseNode($$);
277 + parser->registerParseNode($$);
278 }
279 ;
281 @@ -337,8 +337,8 @@
282 VARIABLEREFERENCE
283 {
284 $$ = new VariableReference(*$1);
285 - PARSER->deleteString($1);
286 - PARSER->registerParseNode($$);
287 + parser->deleteString($1);
288 + parser->registerParseNode($$);
289 }
290 |
291 '(' Expr ')'
292 @@ -349,15 +349,15 @@
293 LITERAL
294 {
295 $$ = new StringExpression(*$1);
296 - PARSER->deleteString($1);
297 - PARSER->registerParseNode($$);
298 + parser->deleteString($1);
299 + parser->registerParseNode($$);
300 }
301 |
302 NUMBER
303 {
304 $$ = new Number($1->toDouble());
305 - PARSER->deleteString($1);
306 - PARSER->registerParseNode($$);
307 + parser->deleteString($1);
308 + parser->registerParseNode($$);
309 }
310 |
311 FunctionCall
312 @@ -369,8 +369,8 @@
313 $$ = createFunction(*$1);
314 if (!$$)
315 YYABORT;
316 - PARSER->deleteString($1);
317 - PARSER->registerParseNode($$);
318 + parser->deleteString($1);
319 + parser->registerParseNode($$);
320 }
321 |
322 FUNCTIONNAME '(' ArgumentList ')'
323 @@ -378,9 +378,9 @@
324 $$ = createFunction(*$1, *$3);
325 if (!$$)
326 YYABORT;
327 - PARSER->deleteString($1);
328 - PARSER->deleteExpressionVector($3);
329 - PARSER->registerParseNode($$);
330 + parser->deleteString($1);
331 + parser->deleteExpressionVector($3);
332 + parser->registerParseNode($$);
333 }
334 ;
336 @@ -389,14 +389,14 @@
337 {
338 $$ = new Vector<Expression*>;
339 $$->append($1);
340 - PARSER->unregisterParseNode($1);
341 - PARSER->registerExpressionVector($$);
342 + parser->unregisterParseNode($1);
343 + parser->registerExpressionVector($$);
344 }
345 |
346 ArgumentList ',' Argument
347 {
348 $$->append($3);
349 - PARSER->unregisterParseNode($3);
350 + parser->unregisterParseNode($3);
351 }
352 ;
354 @@ -412,9 +412,9 @@
355 $$ = new Union;
356 $$->addSubExpression($1);
357 $$->addSubExpression($3);
358 - PARSER->unregisterParseNode($1);
359 - PARSER->unregisterParseNode($3);
360 - PARSER->registerParseNode($$);
361 + parser->unregisterParseNode($1);
362 + parser->unregisterParseNode($3);
363 + parser->registerParseNode($$);
364 }
365 ;
367 @@ -430,9 +430,9 @@
368 {
369 $3->setAbsolute(true);
370 $$ = new Path(static_cast<Filter*>($1), $3);
371 - PARSER->unregisterParseNode($1);
372 - PARSER->unregisterParseNode($3);
373 - PARSER->registerParseNode($$);
374 + parser->unregisterParseNode($1);
375 + parser->unregisterParseNode($3);
376 + parser->registerParseNode($$);
377 }
378 |
379 FilterExpr DescendantOrSelf RelativeLocationPath
380 @@ -440,10 +440,10 @@
381 $3->insertFirstStep($2);
382 $3->setAbsolute(true);
383 $$ = new Path(static_cast<Filter*>($1), $3);
384 - PARSER->unregisterParseNode($1);
385 - PARSER->unregisterParseNode($2);
386 - PARSER->unregisterParseNode($3);
387 - PARSER->registerParseNode($$);
388 + parser->unregisterParseNode($1);
389 + parser->unregisterParseNode($2);
390 + parser->unregisterParseNode($3);
391 + parser->registerParseNode($$);
392 }
393 ;
395 @@ -453,9 +453,9 @@
396 PrimaryExpr PredicateList
397 {
398 $$ = new Filter($1, *$2);
399 - PARSER->unregisterParseNode($1);
400 - PARSER->deletePredicateVector($2);
401 - PARSER->registerParseNode($$);
402 + parser->unregisterParseNode($1);
403 + parser->deletePredicateVector($2);
404 + parser->registerParseNode($$);
405 }
406 ;
408 @@ -465,9 +465,9 @@
409 OrExpr OR AndExpr
410 {
411 $$ = new LogicalOp(LogicalOp::OP_Or, $1, $3);
412 - PARSER->unregisterParseNode($1);
413 - PARSER->unregisterParseNode($3);
414 - PARSER->registerParseNode($$);
415 + parser->unregisterParseNode($1);
416 + parser->unregisterParseNode($3);
417 + parser->registerParseNode($$);
418 }
419 ;
421 @@ -477,9 +477,9 @@
422 AndExpr AND EqualityExpr
423 {
424 $$ = new LogicalOp(LogicalOp::OP_And, $1, $3);
425 - PARSER->unregisterParseNode($1);
426 - PARSER->unregisterParseNode($3);
427 - PARSER->registerParseNode($$);
428 + parser->unregisterParseNode($1);
429 + parser->unregisterParseNode($3);
430 + parser->registerParseNode($$);
431 }
432 ;
434 @@ -489,9 +489,9 @@
435 EqualityExpr EQOP RelationalExpr
436 {
437 $$ = new EqTestOp($2, $1, $3);
438 - PARSER->unregisterParseNode($1);
439 - PARSER->unregisterParseNode($3);
440 - PARSER->registerParseNode($$);
441 + parser->unregisterParseNode($1);
442 + parser->unregisterParseNode($3);
443 + parser->registerParseNode($$);
444 }
445 ;
447 @@ -501,9 +501,9 @@
448 RelationalExpr RELOP AdditiveExpr
449 {
450 $$ = new EqTestOp($2, $1, $3);
451 - PARSER->unregisterParseNode($1);
452 - PARSER->unregisterParseNode($3);
453 - PARSER->registerParseNode($$);
454 + parser->unregisterParseNode($1);
455 + parser->unregisterParseNode($3);
456 + parser->registerParseNode($$);
457 }
458 ;
460 @@ -513,17 +513,17 @@
461 AdditiveExpr PLUS MultiplicativeExpr
462 {
463 $$ = new NumericOp(NumericOp::OP_Add, $1, $3);
464 - PARSER->unregisterParseNode($1);
465 - PARSER->unregisterParseNode($3);
466 - PARSER->registerParseNode($$);
467 + parser->unregisterParseNode($1);
468 + parser->unregisterParseNode($3);
469 + parser->registerParseNode($$);
470 }
471 |
472 AdditiveExpr MINUS MultiplicativeExpr
473 {
474 $$ = new NumericOp(NumericOp::OP_Sub, $1, $3);
475 - PARSER->unregisterParseNode($1);
476 - PARSER->unregisterParseNode($3);
477 - PARSER->registerParseNode($$);
478 + parser->unregisterParseNode($1);
479 + parser->unregisterParseNode($3);
480 + parser->registerParseNode($$);
481 }
482 ;
484 @@ -533,9 +533,9 @@
485 MultiplicativeExpr MULOP UnaryExpr
486 {
487 $$ = new NumericOp($2, $1, $3);
488 - PARSER->unregisterParseNode($1);
489 - PARSER->unregisterParseNode($3);
490 - PARSER->registerParseNode($$);
491 + parser->unregisterParseNode($1);
492 + parser->unregisterParseNode($3);
493 + parser->registerParseNode($$);
494 }
495 ;
497 @@ -546,8 +546,8 @@
498 {
499 $$ = new Negative;
500 $$->addSubExpression($2);
501 - PARSER->unregisterParseNode($2);
502 - PARSER->registerParseNode($$);
503 + parser->unregisterParseNode($2);
504 + parser->registerParseNode($$);
505 }
506 ;
508 --- Source/WebCore/xml/XPathParser.cpp
509 +++ Source/WebCore/xml/XPathParser.cpp.NEW
510 @@ -32,20 +32,17 @@
511 #include "XPathEvaluator.h"
512 #include "XPathException.h"
513 #include "XPathNSResolver.h"
514 +#include "XPathPath.h"
515 #include "XPathStep.h"
516 #include <wtf/StdLibExtras.h>
517 #include <wtf/text/StringHash.h>
519 -int xpathyyparse(void*);
520 -
521 +using namespace WebCore;
522 using namespace WTF;
523 using namespace Unicode;
524 +using namespace XPath;
526 -namespace WebCore {
527 -namespace XPath {
528 -
529 -class LocationPath;
530 -
531 +extern int xpathyyparse(WebCore::XPath::Parser*);
532 #include "XPathGrammar.h"
534 Parser* Parser::currentParser = 0;
535 @@ -630,5 +627,3 @@
536 delete t;
537 }
539 -}
540 -}