| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Simple interactive debugger shell that connects to the Dart VM's debugger | 5 // Simple interactive debugger shell that connects to the Dart VM's debugger |
| 6 // connection port. | 6 // connection port. |
| 7 | 7 |
| 8 #import("dart:io"); | 8 #import("dart:io"); |
| 9 #import("dart:json"); | 9 #import("dart:json"); |
| 10 #import("dart:math", prefix: "Math"); | 10 #import("dart:math", prefix: "Math"); |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 if (char != " " && char != "\n" && char != "\r" && char != "\t") break; | 448 if (char != " " && char != "\n" && char != "\r" && char != "\t") break; |
| 449 index++; | 449 index++; |
| 450 } | 450 } |
| 451 return index; | 451 return index; |
| 452 } | 452 } |
| 453 int skipString(int index) { | 453 int skipString(int index) { |
| 454 assert(string[index - 1] == '"'); | 454 assert(string[index - 1] == '"'); |
| 455 while (index < string.length) { | 455 while (index < string.length) { |
| 456 String char = string[index]; | 456 String char = string[index]; |
| 457 if (char == '"') return index + 1; | 457 if (char == '"') return index + 1; |
| 458 if (char == @'\') index++; | 458 if (char == r'\') index++; |
| 459 if (index == string.length) return index; | 459 if (index == string.length) return index; |
| 460 index++; | 460 index++; |
| 461 } | 461 } |
| 462 return index; | 462 return index; |
| 463 } | 463 } |
| 464 int index = 0; | 464 int index = 0; |
| 465 index = skipWhitespace(index); | 465 index = skipWhitespace(index); |
| 466 // Bail out if the first non-whitespace character isn't '{'. | 466 // Bail out if the first non-whitespace character isn't '{'. |
| 467 if (index == string.length || string[index] != '{') return 0; | 467 if (index == string.length || string[index] != '{') return 0; |
| 468 int nexting = 0; | 468 int nexting = 0; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 497 }; | 497 }; |
| 498 vmInStream.onError = (err) { | 498 vmInStream.onError = (err) { |
| 499 print("Error in debug connection: $err"); | 499 print("Error in debug connection: $err"); |
| 500 quitShell(); | 500 quitShell(); |
| 501 }; | 501 }; |
| 502 vmInStream.onClosed = () { | 502 vmInStream.onClosed = () { |
| 503 print("VM debugger connection closed"); | 503 print("VM debugger connection closed"); |
| 504 quitShell(); | 504 quitShell(); |
| 505 }; | 505 }; |
| 506 } | 506 } |
| OLD | NEW |