diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-08-25 19:20:41 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:30:55 +0000 |
commit | 6882a04fb36642862b11efe514251d32070c3d65 (patch) | |
tree | b7959826000b061fd5ccc7512035c7478742f7b0 /Source/WebCore/xml/XPathParser.h | |
parent | ab6df191029eeeb0b0f16f127d553265659f739e (diff) | |
download | qtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz |
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebCore/xml/XPathParser.h')
-rw-r--r-- | Source/WebCore/xml/XPathParser.h | 70 |
1 files changed, 14 insertions, 56 deletions
diff --git a/Source/WebCore/xml/XPathParser.h b/Source/WebCore/xml/XPathParser.h index e58c444e1..e55ddbbb7 100644 --- a/Source/WebCore/xml/XPathParser.h +++ b/Source/WebCore/xml/XPathParser.h @@ -1,6 +1,6 @@ /* * Copyright 2005 Maksim Orlovich <maksim@kde.org> - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,6 +30,8 @@ #include "XPathStep.h" #include "XPathPredicate.h" +union YYSTYPE; + namespace WebCore { typedef int ExceptionCode; @@ -38,58 +40,20 @@ namespace WebCore { namespace XPath { - class Expression; - class ParseNode; - class Predicate; - - struct Token { - int type; - String str; - Step::Axis axis; - NumericOp::Opcode numop; - EqTestOp::Opcode eqop; - - Token(int t) : type(t) {} - Token(int t, const String& v): type(t), str(v) {} - Token(int t, Step::Axis v): type(t), axis(v) {} - Token(int t, NumericOp::Opcode v): type(t), numop(v) {} - Token(int t, EqTestOp::Opcode v): type(t), eqop(v) {} - }; - class Parser { WTF_MAKE_NONCOPYABLE(Parser); public: - Parser(); - ~Parser(); - - XPathNSResolver* resolver() const { return m_resolver.get(); } - bool expandQName(const String& qName, String& localName, String& namespaceURI); - - Expression* parseStatement(const String& statement, PassRefPtr<XPathNSResolver>, ExceptionCode&); - - static Parser* current() { return currentParser; } - - int lex(void* yylval); + static std::unique_ptr<Expression> parseStatement(const String& statement, XPathNSResolver*, ExceptionCode&); - Expression* m_topExpr; - bool m_gotNamespaceError; + int lex(YYSTYPE&); + bool expandQualifiedName(const String& qualifiedName, String& localName, String& namespaceURI); + void setParseResult(std::unique_ptr<Expression> expression) { m_result = WTFMove(expression); } - void registerParseNode(ParseNode*); - void unregisterParseNode(ParseNode*); - - void registerPredicateVector(Vector<Predicate*>*); - void deletePredicateVector(Vector<Predicate*>*); - - void registerExpressionVector(Vector<Expression*>*); - void deleteExpressionVector(Vector<Expression*>*); - - void registerString(String*); - void deleteString(String*); + private: + Parser(const String&, XPathNSResolver*); - void registerNodeTest(Step::NodeTest*); - void deleteNodeTest(Step::NodeTest*); + struct Token; - private: bool isBinaryOperatorContext() const; void skipWS(); @@ -107,20 +71,14 @@ namespace WebCore { Token nextToken(); Token nextTokenInternal(); - void reset(const String& data); - - static Parser* currentParser; + const String& m_data; + XPathNSResolver* m_resolver; unsigned m_nextPos; - String m_data; int m_lastTokenType; - RefPtr<XPathNSResolver> m_resolver; - HashSet<ParseNode*> m_parseNodes; - HashSet<Vector<Predicate*>*> m_predicateVectors; - HashSet<Vector<Expression*>*> m_expressionVectors; - HashSet<String*> m_strings; - HashSet<Step::NodeTest*> m_nodeTests; + std::unique_ptr<Expression> m_result; + bool m_sawNamespaceError; }; } |