| OLD | NEW |
| 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 // Support for parsing binary sequences encoded as readable strings | 5 // Support for parsing binary sequences encoded as readable strings |
| 6 // or ".data" files. The input format is described here: | 6 // or ".data" files. The input format is described here: |
| 7 // mojo/public/cpp/bindings/tests/validation_test_input_parser.h | 7 // mojo/public/cpp/bindings/tests/validation_test_input_parser.h |
| 8 | 8 |
| 9 define([ | 9 define("mojo/resources/validation_test_input_parser", [ |
| 10 "mojo/public/js/buffer" | 10 "mojo/public/js/buffer" |
| 11 ], function(buffer) { | 11 ], function(buffer) { |
| 12 | 12 |
| 13 // Files and Lines represent the raw text from an input string | 13 // Files and Lines represent the raw text from an input string |
| 14 // or ".data" file. | 14 // or ".data" file. |
| 15 | 15 |
| 16 function InputError(message, line) { | 16 function InputError(message, line) { |
| 17 this.name = "InputError"; |
| 17 this.message = message; | 18 this.message = message; |
| 18 this.line = line; | 19 this.line = line; |
| 19 } | 20 } |
| 20 | 21 |
| 21 InputError.prototype.toString = function() { | 22 InputError.prototype.toString = function() { |
| 22 var s = 'Error: ' + this.message; | 23 var s = 'Error: ' + this.message; |
| 23 if (this.line) | 24 if (this.line) |
| 24 s += ', at line ' + | 25 s += ', at line ' + |
| 25 (this.line.number + 1) + ': "' + this.line.contents + '"'; | 26 (this.line.number + 1) + ': "' + this.line.contents + '"'; |
| 26 return s; | 27 return s; |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 throw new InputError('no anchors for ' + names, 0); | 291 throw new InputError('no anchors for ' + names, 0); |
| 291 | 292 |
| 292 return msg; | 293 return msg; |
| 293 } | 294 } |
| 294 | 295 |
| 295 var exports = {}; | 296 var exports = {}; |
| 296 exports.parseTestMessage = parseTestMessage; | 297 exports.parseTestMessage = parseTestMessage; |
| 297 exports.InputError = InputError; | 298 exports.InputError = InputError; |
| 298 return exports; | 299 return exports; |
| 299 }); | 300 }); |
| OLD | NEW |