OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2005 Maksim Orlovich <maksim@kde.org> | 2 * Copyright 2005 Maksim Orlovich <maksim@kde.org> |
3 * Copyright (C) 2006 Apple Computer, Inc. | 3 * Copyright (C) 2006 Apple Computer, Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 class Parser { | 60 class Parser { |
61 WTF_MAKE_NONCOPYABLE(Parser); | 61 WTF_MAKE_NONCOPYABLE(Parser); |
62 STACK_ALLOCATED(); | 62 STACK_ALLOCATED(); |
63 public: | 63 public: |
64 Parser(); | 64 Parser(); |
65 ~Parser(); | 65 ~Parser(); |
66 | 66 |
67 XPathNSResolver* resolver() const { return m_resolver.get(); } | 67 XPathNSResolver* resolver() const { return m_resolver.get(); } |
68 bool expandQName(const String& qName, AtomicString& localName, AtomicString&
namespaceURI); | 68 bool expandQName(const String& qName, AtomicString& localName, AtomicString&
namespaceURI); |
69 | 69 |
70 PassOwnPtrWillBeRawPtr<Expression> parseStatement(const String& statement, P
assRefPtrWillBeRawPtr<XPathNSResolver>, ExceptionState&); | 70 Expression* parseStatement(const String& statement, XPathNSResolver*, Except
ionState&); |
71 | 71 |
72 static Parser* current() { return currentParser; } | 72 static Parser* current() { return currentParser; } |
73 | 73 |
74 int lex(void* yylval); | 74 int lex(void* yylval); |
75 | 75 |
76 RawPtrWillBeMember<Expression> m_topExpr; | 76 Member<Expression> m_topExpr; |
77 bool m_gotNamespaceError; | 77 bool m_gotNamespaceError; |
78 | 78 |
79 void registerParseNode(ParseNode*); | |
80 void unregisterParseNode(ParseNode*); | |
81 | |
82 void registerPredicateVector(WillBeHeapVector<OwnPtrWillBeMember<Predicate>
>*); | |
83 void deletePredicateVector(WillBeHeapVector<OwnPtrWillBeMember<Predicate> >*
); | |
84 | |
85 void registerExpressionVector(WillBeHeapVector<OwnPtrWillBeMember<Expression
> >*); | |
86 void deleteExpressionVector(WillBeHeapVector<OwnPtrWillBeMember<Expression>
>*); | |
87 | |
88 void registerString(String*); | 79 void registerString(String*); |
89 void deleteString(String*); | 80 void deleteString(String*); |
90 | 81 |
91 void registerNodeTest(Step::NodeTest*); | |
92 void deleteNodeTest(Step::NodeTest*); | |
93 | |
94 private: | 82 private: |
95 bool isBinaryOperatorContext() const; | 83 bool isBinaryOperatorContext() const; |
96 | 84 |
97 void skipWS(); | 85 void skipWS(); |
98 Token makeTokenAndAdvance(int type, int advance = 1); | 86 Token makeTokenAndAdvance(int type, int advance = 1); |
99 Token makeTokenAndAdvance(int type, NumericOp::Opcode, int advance = 1); | 87 Token makeTokenAndAdvance(int type, NumericOp::Opcode, int advance = 1); |
100 Token makeTokenAndAdvance(int type, EqTestOp::Opcode, int advance = 1); | 88 Token makeTokenAndAdvance(int type, EqTestOp::Opcode, int advance = 1); |
101 char peekAheadHelper(); | 89 char peekAheadHelper(); |
102 char peekCurHelper(); | 90 char peekCurHelper(); |
103 | 91 |
104 Token lexString(); | 92 Token lexString(); |
105 Token lexNumber(); | 93 Token lexNumber(); |
106 bool lexNCName(String&); | 94 bool lexNCName(String&); |
107 bool lexQName(String&); | 95 bool lexQName(String&); |
108 | 96 |
109 Token nextToken(); | 97 Token nextToken(); |
110 Token nextTokenInternal(); | 98 Token nextTokenInternal(); |
111 | 99 |
112 void reset(const String& data); | 100 void reset(const String& data); |
113 | 101 |
114 static Parser* currentParser; | 102 static Parser* currentParser; |
115 | 103 |
116 unsigned m_nextPos; | 104 unsigned m_nextPos; |
117 String m_data; | 105 String m_data; |
118 int m_lastTokenType; | 106 int m_lastTokenType; |
119 RefPtrWillBeMember<XPathNSResolver> m_resolver; | 107 Member<XPathNSResolver> m_resolver; |
120 | 108 |
121 #if !ENABLE(OILPAN) | |
122 HashSet<ParseNode*> m_parseNodes; | |
123 HashSet<Vector<OwnPtr<Predicate> >*> m_predicateVectors; | |
124 HashSet<Vector<OwnPtr<Expression> >*> m_expressionVectors; | |
125 HashSet<OwnPtr<Step::NodeTest> > m_nodeTests; | |
126 #endif | |
127 HashSet<OwnPtr<String> > m_strings; | 109 HashSet<OwnPtr<String> > m_strings; |
128 }; | 110 }; |
129 | 111 |
130 } // namespace XPath | 112 } // namespace XPath |
131 | 113 |
132 } // namespace blink | 114 } // namespace blink |
133 | 115 |
134 int xpathyyparse(blink::XPath::Parser*); | 116 int xpathyyparse(blink::XPath::Parser*); |
135 #endif | 117 #endif |
OLD | NEW |