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

Side by Side Diff: Source/core/css/parser/CSSParserTokenRange.h

Issue 1192983003: CSS Custom Properties (Variables) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CSSParserTokenRange_h 5 #ifndef CSSParserTokenRange_h
6 #define CSSParserTokenRange_h 6 #define CSSParserTokenRange_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/css/parser/CSSParserToken.h" 9 #include "core/css/parser/CSSParserToken.h"
10 #include "wtf/Vector.h" 10 #include "wtf/Vector.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 CORE_EXPORT extern const CSSParserToken& staticEOFToken; 14 CORE_EXPORT extern const CSSParserToken& staticEOFToken;
15 15
16 class CSSTokenizer;
17 class CSSTokenizerScope;
18
16 // A CSSParserTokenRange is an iterator over a subrange of a vector of CSSParser Tokens. 19 // A CSSParserTokenRange is an iterator over a subrange of a vector of CSSParser Tokens.
17 // Accessing outside of the range will return an endless stream of EOF tokens. 20 // Accessing outside of the range will return an endless stream of EOF tokens.
18 // This class refers to half-open intervals [first, last). 21 // This class refers to half-open intervals [first, last).
19 class CORE_EXPORT CSSParserTokenRange { 22 class CORE_EXPORT CSSParserTokenRange {
20 public: 23 public:
21 CSSParserTokenRange(const Vector<CSSParserToken>& vector) 24 CSSParserTokenRange(const Vector<CSSParserToken>& vector, const CSSTokenizer Scope* scope)
22 : m_first(vector.begin()) 25 : m_first(vector.begin())
23 , m_last(vector.end()) 26 , m_last(vector.end())
27 , m_scope(scope)
24 { 28 {
25 } 29 }
26 30
27 // This should be called on a range with tokens returned by that range. 31 // This should be called on a range with tokens returned by that range.
28 CSSParserTokenRange makeSubRange(const CSSParserToken* first, const CSSParse rToken* last) const; 32 CSSParserTokenRange makeSubRange(const CSSParserToken* first, const CSSParse rToken* last) const;
29 33
30 bool atEnd() const { return m_first == m_last; } 34 bool atEnd() const { return m_first == m_last; }
31 const CSSParserToken* end() const { return m_last; } 35 const CSSParserToken* end() const { return m_last; }
32 36
33 const CSSParserToken& peek(unsigned offset = 0) const 37 const CSSParserToken& peek(unsigned offset = 0) const
(...skipping 23 matching lines...) Expand all
57 void consumeComponentValue(); 61 void consumeComponentValue();
58 62
59 void consumeWhitespace() 63 void consumeWhitespace()
60 { 64 {
61 while (peek().type() == WhitespaceToken) 65 while (peek().type() == WhitespaceToken)
62 ++m_first; 66 ++m_first;
63 } 67 }
64 68
65 String serialize() const; 69 String serialize() const;
66 70
71 const CSSTokenizerScope* scope() const { return m_scope; }
72
67 // This is only for the inspector integration 73 // This is only for the inspector integration
68 const CSSParserToken* begin() const { return m_first; } 74 const CSSParserToken* begin() const { return m_first; }
69 75
70 static void initStaticEOFToken(); 76 static void initStaticEOFToken();
71 77
72 private: 78 private:
73 CSSParserTokenRange(const CSSParserToken* first, const CSSParserToken* last) 79 CSSParserTokenRange(const CSSParserToken* first, const CSSParserToken* last, const CSSTokenizerScope* scope)
74 : m_first(first) 80 : m_first(first)
75 , m_last(last) 81 , m_last(last)
82 , m_scope(scope)
76 { } 83 { }
77 84
78 const CSSParserToken* m_first; 85 const CSSParserToken* m_first;
79 const CSSParserToken* m_last; 86 const CSSParserToken* m_last;
87 const CSSTokenizerScope* m_scope;
80 }; 88 };
81 89
82 } // namespace 90 } // namespace
83 91
84 #endif // CSSParserTokenRange_h 92 #endif // CSSParserTokenRange_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698