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

Side by Side Diff: Source/core/css/parser/CSSTokenizerTest.cpp

Issue 646893003: CSS Tokenizer: Comprehensive unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « Source/core/css/parser/CSSParserToken.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "config.h" 5 #include "config.h"
6 #include "core/css/parser/CSSTokenizer.h" 6 #include "core/css/parser/CSSTokenizer.h"
7 7
8 #include "core/css/parser/MediaQueryBlockWatcher.h" 8 #include "core/css/parser/MediaQueryBlockWatcher.h"
9 #include "wtf/PassOwnPtr.h" 9 #include "wtf/PassOwnPtr.h"
10 #include <gtest/gtest.h> 10 #include <gtest/gtest.h>
11 11
12 namespace blink { 12 namespace blink {
13 13
14 // This let's us see the line numbers of failing tests
15 #define TEST_TOKENS(string, tokens...) { \
16 String s = string; \
17 SCOPED_TRACE(s.ascii().data()); \
18 testTokens(string, tokens); \
19 }
20
21 void testTokens(const String& string, const CSSParserToken& token1, const CSSPar serToken& token2 = CSSParserToken(EOFToken), const CSSParserToken& token3 = CSSP arserToken(EOFToken))
22 {
23 Vector<CSSParserToken> expectedTokens;
24 expectedTokens.append(token1);
25 if (token2.type() != EOFToken) {
26 expectedTokens.append(token2);
27 if (token3.type() != EOFToken)
28 expectedTokens.append(token3);
29 }
30
Yoav Weiss 2014/10/23 06:37:14 This might be slightly more readable if split out
Timothy Loh 2014/10/23 16:17:58 Pulled out token comparison into a separate functi
31 Vector<CSSParserToken> actualTokens;
32 CSSTokenizer::tokenize(string, actualTokens);
33 ASSERT_FALSE(actualTokens.isEmpty());
34 ASSERT_EQ(EOFToken, actualTokens.last().type());
35 actualTokens.removeLast();
36
37 ASSERT_EQ(expectedTokens.size(), actualTokens.size());
38 for (size_t i = 0; i < expectedTokens.size(); ++i) {
39 const CSSParserToken& expected = expectedTokens[i];
40 const CSSParserToken& actual = actualTokens[i];
41 ASSERT_EQ(expected.type(), actual.type());
42 switch (expected.type()) {
43 case DelimiterToken:
44 ASSERT_EQ(expected.delimiter(), actual.delimiter());
45 break;
46 case IdentToken:
47 case FunctionToken:
48 case StringToken:
49 ASSERT_EQ(expected.value(), actual.value());
50 break;
51 case DimensionToken:
52 ASSERT_EQ(expected.value(), actual.value());
53 // fallthrough
54 case NumberToken:
55 case PercentageToken:
56 ASSERT_EQ(expected.numericValueType(), actual.numericValueType());
57 ASSERT_DOUBLE_EQ(expected.numericValue(), actual.numericValue());
58 break;
59 default:
60 break;
61 }
62 }
63 }
64
65 static CSSParserToken ident(const String& string) { return CSSParserToken(IdentT oken, string); }
66 static CSSParserToken string(const String& string) { return CSSParserToken(Strin gToken, string); }
67 static CSSParserToken function(const String& string) { return CSSParserToken(Fun ctionToken, string); }
68 static CSSParserToken delim(char c) { return CSSParserToken(DelimiterToken, c); }
69
70 static CSSParserToken number(NumericValueType type, double value)
71 {
72 return CSSParserToken(NumberToken, value, type);
73 }
74
75 static CSSParserToken dimension(NumericValueType type, double value, const Strin g& string)
76 {
77 CSSParserToken token = number(type, value);
78 token.convertToDimensionWithUnit(string);
79 return token;
80 }
81
82 static CSSParserToken percentage(NumericValueType type, double value)
83 {
84 CSSParserToken token = number(type, value);
85 token.convertToPercentage();
86 return token;
87 }
88
89 static const CSSParserToken whitespace(WhitespaceToken);
Yoav Weiss 2014/10/23 06:37:14 This fails to build. I think I've resolved somethi
Timothy Loh 2014/10/23 16:17:58 Done. It compiled fine on g++ :/
90 static const CSSParserToken colon(ColonToken);
91 static const CSSParserToken semicolon(SemicolonToken);
92 static const CSSParserToken comma(CommaToken);
93 static const CSSParserToken leftParenthesis(LeftParenthesisToken);
94 static const CSSParserToken rightParenthesis(RightParenthesisToken);
95 static const CSSParserToken leftBracket(LeftBracketToken);
96 static const CSSParserToken rightBracket(RightBracketToken);
97 static const CSSParserToken leftBrace(LeftBraceToken);
98 static const CSSParserToken rightBrace(RightBraceToken);
99 static const CSSParserToken badString(BadStringToken);
100 static const CSSParserToken comment(CommentToken);
101
102 String fromUChar32(UChar32 c)
103 {
104 StringBuilder input;
105 input.append(c);
106 return input.toString();
107 }
108
109 TEST(CSSTokenizerTest, SingleCharacterTokens)
110 {
111 TEST_TOKENS("(", leftParenthesis);
112 TEST_TOKENS(")", rightParenthesis);
113 TEST_TOKENS("[", leftBracket);
114 TEST_TOKENS("]", rightBracket);
115 TEST_TOKENS(",", comma);
116 TEST_TOKENS(":", colon);
117 TEST_TOKENS(";", semicolon);
118 TEST_TOKENS(")[", rightParenthesis, leftBracket);
119 TEST_TOKENS("[)", leftBracket, rightParenthesis);
120 TEST_TOKENS("{}", leftBrace, rightBrace);
121 TEST_TOKENS(",,", comma, comma);
122 }
123
124 TEST(CSSTokenizerTest, DelimiterToken)
125 {
126 TEST_TOKENS("*", delim('*'));
127 TEST_TOKENS("%", delim('%'));
128 TEST_TOKENS("~", delim('~'));
129 TEST_TOKENS("&", delim('&'));
130 TEST_TOKENS("\x7f", delim('\x7f'));
131 TEST_TOKENS("\1", delim('\x1'));
132 }
133
134 TEST(CSSTokenizerTest, WhitespaceTokens)
135 {
136 TEST_TOKENS(" ", whitespace);
137 TEST_TOKENS("\n\rS", whitespace, ident("S"));
138 TEST_TOKENS(" *", whitespace, delim('*'));
139 TEST_TOKENS("\r\n\f\t2", whitespace, number(IntegerValueType, 2));
140 }
141
142 TEST(CSSTokenizerTest, Escapes)
143 {
144 TEST_TOKENS("hel\\6Co", ident("hello"));
145 TEST_TOKENS("\\26 B", ident("&B"));
146 TEST_TOKENS("'hel\\6c o'", string("hello"));
147 TEST_TOKENS("'spac\\65\r\ns'", string("spaces"));
148 TEST_TOKENS("spac\\65\n\rs", ident("space"), whitespace, ident("s"));
Yoav Weiss 2014/10/23 06:37:14 "spac\\65\r\ns" as ident("spaces") would be intere
Timothy Loh 2014/10/23 16:17:58 Done.
149 TEST_TOKENS("sp\\61\tc\\65\fs", ident("spaces"));
150 TEST_TOKENS("hel\\6c o", ident("hell"), whitespace, ident("o"));
151 TEST_TOKENS("test\\\n", ident("test"), delim('\\'), whitespace);
152 TEST_TOKENS("eof\\", ident("eof"), delim('\\'));
153 TEST_TOKENS("test\\D799", ident("test" + fromUChar32(0xD799)));
154 TEST_TOKENS("\\E000", ident(fromUChar32(0xE000)));
155 TEST_TOKENS("te\\s\\t", ident("test"));
156 TEST_TOKENS("spaces\\ in\\\tident", ident("spaces in\tident"));
157 TEST_TOKENS("\\.\\,\\:\\!", ident(".,:!"));
158 // FIXME: We don't correctly return replacement characters
159 // String replacement = fromUChar32(0xFFFD);
160 // TEST_TOKENS("null\\0", ident("null" + replacement));
161 // TEST_TOKENS("null\\0000", ident("null" + replacement));
162 // TEST_TOKENS("large\\110000", ident("large" + replacement));
163 // TEST_TOKENS("surrogate\\D800", ident("surrogate" + replacement));
164 // TEST_TOKENS("surrogate\\0DABC", ident("surrogate" + replacement));
165 // TEST_TOKENS("\\00DFFFsurrogate", ident(replacement + "surrogate"));
166 // FIXME: We don't correctly return supplementary plane characters
167 // TEST_TOKENS("\\10fFfF", ident(fromUChar32(0x10ffff) + "0"));
168 // TEST_TOKENS("\\10000000", ident(fromUChar32(0x100000) + "000"));
169 // FIXME: We don't correctly match newlines (normally handled in preprocessi ng)
170 // TEST_TOKENS("\\\r", delim('\\'), whitespace);
171 // TEST_TOKENS("\\\f", delim('\\'), whitespace);
172 // TEST_TOKENS("\\\r\n", delim('\\'), whitespace);
173 }
174
175 TEST(CSSTokenizerTest, IdentToken)
176 {
177 TEST_TOKENS("simple-ident", ident("simple-ident"));
178 TEST_TOKENS("testing123", ident("testing123"));
179 TEST_TOKENS("hello!", ident("hello"), delim('!'));
180 TEST_TOKENS("world\5", ident("world"), delim('\5'));
181 TEST_TOKENS("_under score", ident("_under"), whitespace, ident("score"));
182 TEST_TOKENS("-_underscore", ident("-_underscore"));
183 TEST_TOKENS("-text", ident("-text"));
184 TEST_TOKENS("-\\6d", ident("-m"));
185 TEST_TOKENS(fromUChar32(0x2003), ident(fromUChar32(0x2003))); // em-space
186 TEST_TOKENS(fromUChar32(0xA0), ident(fromUChar32(0xA0))); // non-breaking sp ace
187 TEST_TOKENS(fromUChar32(0x1234), ident(fromUChar32(0x1234)));
188 TEST_TOKENS(fromUChar32(0x12345), ident(fromUChar32(0x12345)));
189 // FIXME: These are idents in the editor's draft
190 // TEST_TOKENS("--abc", ident("--abc"));
191 // TEST_TOKENS("--", ident("--"));
192 // TEST_TOKENS("---", ident("---"));
193 // FIXME: Preprocessing is supposed to replace U+0000 with U+FFFD
194 // TEST_TOKENS("\0", ident(fromUChar32(0xFFFD)));
195 }
196
197 TEST(CSSTokenizerTest, FunctionToken)
198 {
199 TEST_TOKENS("scale(2)", function("scale"), number(IntegerValueType, 2), righ tParenthesis);
200 TEST_TOKENS("foo-bar\\ baz(", function("foo-bar baz"));
201 TEST_TOKENS("fun\\(ction(", function("fun(ction"));
202 }
203
204 TEST(CSSTokenizerTest, StringToken)
205 {
206 TEST_TOKENS("'text'", string("text"));
207 TEST_TOKENS("\"text\"", string("text"));
208 TEST_TOKENS("'testing, 123!'", string("testing, 123!"));
209 TEST_TOKENS("'es\\'ca\\\"pe'", string("es'ca\"pe"));
210 TEST_TOKENS("'\"quotes\"'", string("\"quotes\""));
211 TEST_TOKENS("\"'quotes'\"", string("'quotes'"));
212 TEST_TOKENS("'text\5\t\13'", string("text\5\t\13"));
213 TEST_TOKENS("\"end on eof", string("end on eof"));
214 TEST_TOKENS("'esca\\\nped'", string("escaped"));
215 TEST_TOKENS("\"esc\\\faped\"", string("escaped"));
216 TEST_TOKENS("'new\\\rline'", string("newline"));
217 TEST_TOKENS("'bad\nstring", badString, whitespace, ident("string"));
218 TEST_TOKENS("'bad\rstring", badString, whitespace, ident("string"));
219 TEST_TOKENS("'bad\r\nstring", badString, whitespace, ident("string"));
220 TEST_TOKENS("'bad\fstring", badString, whitespace, ident("string"));
221 // FIXME: Preprocessing is supposed to replace U+0000 with U+FFFD
222 // TEST_TOKENS("'\0'", string(fromUChar32(0xFFFD)));
223 // FIXME: We don't correctly match newlines (normally handled in preprocessi ng)
224 // TEST_TOKENS("\"new\\\r\nline\"", string("newline"));
225 }
226
227 TEST(CSSTokenizerTest, NumberToken)
228 {
229 TEST_TOKENS("10", number(IntegerValueType, 10));
230 TEST_TOKENS("12.0", number(NumberValueType, 12));
231 TEST_TOKENS("+45.6", number(NumberValueType, 45.6));
232 TEST_TOKENS("-7", number(IntegerValueType, -7));
233 TEST_TOKENS("010", number(IntegerValueType, 10));
234 TEST_TOKENS("10e0", number(NumberValueType, 10));
235 TEST_TOKENS("12e3", number(NumberValueType, 12000));
236 TEST_TOKENS("3e+1", number(NumberValueType, 30));
237 TEST_TOKENS("12E-1", number(NumberValueType, 1.2));
238 TEST_TOKENS(".7", number(NumberValueType, 0.7));
239 TEST_TOKENS("-.3", number(NumberValueType, -0.3));
240 TEST_TOKENS("+637.54e-2", number(NumberValueType, 6.3754));
241 TEST_TOKENS("-12.34E+2", number(NumberValueType, -1234));
Yoav Weiss 2014/10/23 06:37:13 Can you add tests for something like "1." and "1.e
Timothy Loh 2014/10/23 16:17:58 There's already a test "13.", but I've added "1.e2
242
243 TEST_TOKENS("+ 5", delim('+'), whitespace, number(IntegerValueType, 5));
244 TEST_TOKENS("--11", delim('-'), number(IntegerValueType, -11));
245 TEST_TOKENS("-+12", delim('-'), number(IntegerValueType, 12));
246 TEST_TOKENS("+-21", delim('+'), number(IntegerValueType, -21));
247 TEST_TOKENS("++22", delim('+'), number(IntegerValueType, 22));
248 TEST_TOKENS("13.", number(IntegerValueType, 13), delim('.'));
249 }
250
251 TEST(CSSTokenizerTest, DimensionToken)
252 {
253 TEST_TOKENS("10px", dimension(IntegerValueType, 10, "px"));
254 TEST_TOKENS("12.0em", dimension(NumberValueType, 12, "em"));
255 TEST_TOKENS("-12.0em", dimension(NumberValueType, -12, "em"));
256 TEST_TOKENS("+45.6__qem", dimension(NumberValueType, 45.6, "__qem"));
257 TEST_TOKENS("5e", dimension(IntegerValueType, 5, "e"));
258 TEST_TOKENS("5px-2px", dimension(IntegerValueType, 5, "px-2px"));
259 TEST_TOKENS("5\\ ", dimension(IntegerValueType, 5, " "));
260 TEST_TOKENS("40\\70\\78", dimension(IntegerValueType, 40, "px"));
261 TEST_TOKENS("4e3e2", dimension(NumberValueType, 4000, "e2"));
262 TEST_TOKENS("0x10px", dimension(IntegerValueType, 0, "x1px"));
263 TEST_TOKENS("4unit ", dimension(IntegerValueType, 4, "unit"), whitespace);
264 TEST_TOKENS("5e+", dimension(IntegerValueType, 5, "e"), delim('+'));
265 }
266
267 TEST(CSSTokenizerTest, PercentageToken)
268 {
269 TEST_TOKENS("10%", percentage(IntegerValueType, 10));
270 TEST_TOKENS("+12.0%", percentage(NumberValueType, 12));
271 TEST_TOKENS("-48.99%", percentage(NumberValueType, -48.99));
272 TEST_TOKENS("6e-1%", percentage(NumberValueType, 0.6));
273 TEST_TOKENS("5%%", percentage(IntegerValueType, 5), delim('%'));
274 }
275
276 TEST(CSSTokenizerTest, CommentToken)
277 {
278 TEST_TOKENS("/*comment*/", comment);
279 TEST_TOKENS("/**\\2f**/", comment);
280 TEST_TOKENS("/**y*a*y**/", comment);
281 TEST_TOKENS("/* \n :) \n */", comment);
282 TEST_TOKENS("/*/*/", comment);
283 TEST_TOKENS("/**/*", comment, delim('*'));
284 // FIXME: Should an EOF-terminated comment get a token?
285 // TEST_TOKENS("/******", comment);
286 }
287
288
14 typedef struct { 289 typedef struct {
15 const char* input; 290 const char* input;
16 const char* output;
17 } TestCase;
18
19 typedef struct {
20 const char* input;
21 const unsigned maxLevel; 291 const unsigned maxLevel;
22 const unsigned finalLevel; 292 const unsigned finalLevel;
23 } BlockTestCase; 293 } BlockTestCase;
24 294
25 TEST(CSSTokenizerTest, Basic)
26 {
27 TestCase testCases[] = {
28 { "(max-width: 50px)", "(max-width: 50px)" },
29 { "(max-width: 1e+2px)", "(max-width: 100.000000px)" },
30 { "(max-width: 1e2px)", "(max-width: 100.000000px)" },
31 { "(max-width: 1000e-1px)", "(max-width: 100.000000px)" },
32 { "(max-width: 50\\70\\78)", "(max-width: 50px)" },
33 { "(max-width: /* comment */50px)", "(max-width: 50px)" },
34 { "(max-width: /** *commen*t */60px)", "(max-width: 60px)" },
35 { "(max-width: /** *commen*t **/70px)", "(max-width: 70px)" },
36 { "(max-width: /** *commen*t **//**/80px)", "(max-width: 80px)" },
37 { "(max-width: /*/ **/90px)", "(max-width: 90px)" },
38 { "(max-width: /*/ **/*100px)", "(max-width: '*'100px)" },
39 { "(max-width: 110px/*)", "(max-width: 110px" },
40 { "(max-width: 120px)/*", "(max-width: 120px)" },
41 { "(max-width: 130px)/**", "(max-width: 130px)" },
42 { "(max-width: /***/140px)/**/", "(max-width: 140px)" },
43 { "(max-width: '40px')", "(max-width: 40px)" },
44 { "(max-width: '40px", "(max-width: 40px" },
45 { "(max-width: '40px\n", "(max-width: " },
46 { "(max-width: '40px\\", "(max-width: 40px" },
47 { "(max-width: '40px\\\n", "(max-width: 40px" },
48 { "(max-width: '40px\\\n')", "(max-width: 40px)" },
49 { "(max-width: '40\\70\\78')", "(max-width: 40px)" },
50 { "(max-width: '40\\\npx')", "(max-width: 40px)" },
51 { "(max-aspect-ratio: 5)", "(max-aspect-ratio: 5)" },
52 { "(max-aspect-ratio: +5)", "(max-aspect-ratio: 5)" },
53 { "(max-aspect-ratio: -5)", "(max-aspect-ratio: -5)" },
54 { "(max-aspect-ratio: -+5)", "(max-aspect-ratio: '-'5)" },
55 { "(max-aspect-ratio: +-5)", "(max-aspect-ratio: '+'-5)" },
56 { "(max-aspect-ratio: +bla5)", "(max-aspect-ratio: '+'bla5)" },
57 { "(max-aspect-ratio: +5bla)", "(max-aspect-ratio: 5other)" },
58 { "(max-aspect-ratio: -bla)", "(max-aspect-ratio: -bla)" },
59 { "(max-aspect-ratio: --bla)", "(max-aspect-ratio: '-'-bla)" },
60 { "5e0", "5.000000" },
61 { "5.0", "5.000000" },
62 { "5.", "5'.'" },
63 { "5.0e-1", "0.500000" },
64 { "5.e-1", "5'.'e-1" },
65 { "hel\\6co", "hello" },
66 { "wor\\6c d", "world" },
67 { "wor\\6c\r\nd wor\\6c\n\rd", "world worl d" },
68 { "cod\\65point esca\\70\fe \\74\test", "codepoint escape test" },
69 { "esca\\70\f\te \\74 \nest", "escap e t est" },
70 { 0, 0 } // Do not remove the terminator line.
71 };
72
73 for (int i = 0; testCases[i].input; ++i) {
74 Vector<CSSParserToken> tokens;
75 CSSTokenizer::tokenize(testCases[i].input, tokens);
76 StringBuilder output;
77 for (size_t j = 0; j < tokens.size(); ++j)
78 output.append(tokens[j].textForUnitTests());
79 ASSERT_STREQ(testCases[i].output, output.toString().ascii().data());
80 }
81 }
82
83 TEST(CSSTokenizerBlockTest, Basic) 295 TEST(CSSTokenizerBlockTest, Basic)
84 { 296 {
85 BlockTestCase testCases[] = { 297 BlockTestCase testCases[] = {
86 {"(max-width: 800px()), (max-width: 800px)", 2, 0}, 298 {"(max-width: 800px()), (max-width: 800px)", 2, 0},
87 {"(max-width: 900px(()), (max-width: 900px)", 3, 1}, 299 {"(max-width: 900px(()), (max-width: 900px)", 3, 1},
88 {"(max-width: 600px(())))), (max-width: 600px)", 3, 0}, 300 {"(max-width: 600px(())))), (max-width: 600px)", 3, 0},
89 {"(max-width: 500px(((((((((())))), (max-width: 500px)", 11, 6}, 301 {"(max-width: 500px(((((((((())))), (max-width: 500px)", 11, 6},
90 {"(max-width: 800px[]), (max-width: 800px)", 2, 0}, 302 {"(max-width: 800px[]), (max-width: 800px)", 2, 0},
91 {"(max-width: 900px[[]), (max-width: 900px)", 3, 2}, 303 {"(max-width: 900px[[]), (max-width: 900px)", 3, 2},
92 {"(max-width: 600px[[]]]]), (max-width: 600px)", 3, 0}, 304 {"(max-width: 600px[[]]]]), (max-width: 600px)", 3, 0},
(...skipping 28 matching lines...) Expand all
121 for (size_t j = 0; j < tokens.size(); ++j) { 333 for (size_t j = 0; j < tokens.size(); ++j) {
122 blockWatcher.handleToken(tokens[j]); 334 blockWatcher.handleToken(tokens[j]);
123 level = blockWatcher.blockLevel(); 335 level = blockWatcher.blockLevel();
124 maxLevel = std::max(level, maxLevel); 336 maxLevel = std::max(level, maxLevel);
125 } 337 }
126 ASSERT_EQ(testCases[i].maxLevel, maxLevel); 338 ASSERT_EQ(testCases[i].maxLevel, maxLevel);
127 ASSERT_EQ(testCases[i].finalLevel, level); 339 ASSERT_EQ(testCases[i].finalLevel, level);
128 } 340 }
129 } 341 }
130 342
131 void testToken(UChar c, CSSParserTokenType tokenType)
132 {
133 Vector<CSSParserToken> tokens;
134 StringBuilder input;
135 input.append(c);
136 CSSTokenizer::tokenize(input.toString(), tokens);
137 ASSERT_EQ(tokens[0].type(), tokenType);
138 }
139
140 TEST(CSSTokenizerCodepointsTest, Basic)
141 {
142 for (UChar c = 0; c <= 1000; ++c) {
143 if (isASCIIDigit(c))
144 testToken(c, NumberToken);
145 else if (isASCIIAlpha(c))
146 testToken(c, IdentToken);
147 else if (c == '_')
148 testToken(c, IdentToken);
149 else if (c == '\r' || c == ' ' || c == '\n' || c == '\t' || c == '\f')
150 testToken(c, WhitespaceToken);
151 else if (c == '(')
152 testToken(c, LeftParenthesisToken);
153 else if (c == ')')
154 testToken(c, RightParenthesisToken);
155 else if (c == '[')
156 testToken(c, LeftBracketToken);
157 else if (c == ']')
158 testToken(c, RightBracketToken);
159 else if (c == '{')
160 testToken(c, LeftBraceToken);
161 else if (c == '}')
162 testToken(c, RightBraceToken);
163 else if (c == '.' || c == '+' || c == '-' || c == '/' || c == '\\')
164 testToken(c, DelimiterToken);
165 else if (c == '\'' || c == '"')
166 testToken(c, StringToken);
167 else if (c == ',')
168 testToken(c, CommaToken);
169 else if (c == ':')
170 testToken(c, ColonToken);
171 else if (c == ';')
172 testToken(c, SemicolonToken);
173 else if (!c)
174 testToken(c, EOFToken);
175 else if (c > SCHAR_MAX)
176 testToken(c, IdentToken);
177 else
178 testToken(c, DelimiterToken);
179 }
180 testToken(USHRT_MAX, IdentToken);
181 }
182
183 } // namespace 343 } // namespace
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSParserToken.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698