| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/inspector_protocol/Parser.h" | 5 #include "platform/inspector_protocol/Parser.h" |
| 6 | 6 |
| 7 #include "platform/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
| 8 #include "platform/inspector_protocol/Values.h" | 8 #include "platform/inspector_protocol/Values.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 // Block comment must close before end-of-input. | 193 // Block comment must close before end-of-input. |
| 194 return false; | 194 return false; |
| 195 } | 195 } |
| 196 | 196 |
| 197 return false; | 197 return false; |
| 198 } | 198 } |
| 199 | 199 |
| 200 void skipWhitespaceAndComments(const UChar* start, const UChar* end, const UChar
** whitespaceEnd) | 200 void skipWhitespaceAndComments(const UChar* start, const UChar* end, const UChar
** whitespaceEnd) |
| 201 { | 201 { |
| 202 while (start < end) { | 202 while (start < end) { |
| 203 if (isSpaceOrNewline(*start)) { | 203 if (protocol::isSpaceOrNewLine(*start)) { |
| 204 ++start; | 204 ++start; |
| 205 } else if (*start == '/') { | 205 } else if (*start == '/') { |
| 206 const UChar* commentEnd; | 206 const UChar* commentEnd; |
| 207 if (!skipComment(start, end, &commentEnd)) | 207 if (!skipComment(start, end, &commentEnd)) |
| 208 break; | 208 break; |
| 209 start = commentEnd; | 209 start = commentEnd; |
| 210 } else { | 210 } else { |
| 211 break; | 211 break; |
| 212 } | 212 } |
| 213 } | 213 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 result = Value::null(); | 372 result = Value::null(); |
| 373 break; | 373 break; |
| 374 case BoolTrue: | 374 case BoolTrue: |
| 375 result = FundamentalValue::create(true); | 375 result = FundamentalValue::create(true); |
| 376 break; | 376 break; |
| 377 case BoolFalse: | 377 case BoolFalse: |
| 378 result = FundamentalValue::create(false); | 378 result = FundamentalValue::create(false); |
| 379 break; | 379 break; |
| 380 case Number: { | 380 case Number: { |
| 381 bool ok; | 381 bool ok; |
| 382 double value = String16::charactersToDouble(tokenStart, tokenEnd - token
Start, &ok); | 382 double value = protocol::string16CharactersToDouble(tokenStart, tokenEnd
- tokenStart, &ok); |
| 383 if (!ok) | 383 if (!ok) |
| 384 return nullptr; | 384 return nullptr; |
| 385 int number = static_cast<int>(value); | 385 int number = static_cast<int>(value); |
| 386 if (number == value) | 386 if (number == value) |
| 387 result = FundamentalValue::create(number); | 387 result = FundamentalValue::create(number); |
| 388 else | 388 else |
| 389 result = FundamentalValue::create(value); | 389 result = FundamentalValue::create(value); |
| 390 break; | 390 break; |
| 391 } | 391 } |
| 392 case StringLiteral: { | 392 case StringLiteral: { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 490 |
| 491 std::unique_ptr<Value> parseJSON(const String16& json) | 491 std::unique_ptr<Value> parseJSON(const String16& json) |
| 492 { | 492 { |
| 493 if (json.isEmpty()) | 493 if (json.isEmpty()) |
| 494 return nullptr; | 494 return nullptr; |
| 495 return parseJSONInternal(json.characters16(), json.length()); | 495 return parseJSONInternal(json.characters16(), json.length()); |
| 496 } | 496 } |
| 497 | 497 |
| 498 } // namespace protocol | 498 } // namespace protocol |
| 499 } // namespace blink | 499 } // namespace blink |
| OLD | NEW |