Chromium Code Reviews| Index: pkg/yaml/lib/src/parser.dart |
| diff --git a/pkg/yaml/lib/src/parser.dart b/pkg/yaml/lib/src/parser.dart |
| index 2616038ee175b0b25020af36f9b6789618742aa9..12d47a91885c9065e1c8e9c3da8b12ab32721eab 100644 |
| --- a/pkg/yaml/lib/src/parser.dart |
| +++ b/pkg/yaml/lib/src/parser.dart |
| @@ -2,7 +2,7 @@ |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| -library parser; |
| +library yaml.parser; |
| import 'dart:collection'; |
| @@ -407,23 +407,23 @@ class Parser { |
| error(String message) { |
| // Line and column should be one-based. |
| throw new SyntaxError(_line + 1, _column + 1, |
| - "$message (in $_farthestContext)"); |
| + "$message (in $_farthestContext)."); |
| } |
| /// If [result] is falsey, throws an error saying that [expected] was |
| /// expected. |
| expect(result, String expected) { |
| if (truth(result)) return result; |
| - error("expected $expected"); |
| + error("Expected $expected"); |
| } |
| /// Throws an error saying that the parse failed. Uses [_farthestLine], |
| /// [_farthestColumn], and [_farthestContext] to provide additional information. |
|
Bob Nystrom
2014/05/09 00:18:56
Long line.
nweiz
2014/05/20 00:15:07
Done.
|
| parseFailed() { |
| - var message = "invalid YAML in $_farthestContext"; |
| + var message = "Invalid YAML in $_farthestContext"; |
| var extraError = _errorAnnotations[_farthestPos]; |
| if (extraError != null) message = "$message ($extraError)"; |
| - throw new SyntaxError(_farthestLine + 1, _farthestColumn + 1, message); |
| + throw new SyntaxError(_farthestLine + 1, _farthestColumn + 1, "$message."); |
| } |
| /// Returns the number of spaces after the current position. |
| @@ -788,7 +788,7 @@ class Parser { |
| case BLOCK_KEY: |
| case FLOW_KEY: |
| return s_separateInLine(); |
| - default: throw 'invalid context "$ctx"'; |
| + default: throw 'Invalid context "$ctx".'; |
| } |
| } |
| @@ -1014,7 +1014,7 @@ class Parser { |
| var char = peek(); |
| var indicator = indicatorType(char); |
| if (indicator == C_RESERVED) { |
| - error("reserved indicators can't start a plain scalar"); |
| + error("Reserved indicators can't start a plain scalar"); |
|
Bob Nystrom
2014/05/09 00:18:56
"."
nweiz
2014/05/20 00:15:07
[error] automatically adds a period.
|
| } |
| var match = (isNonSpace(char) && indicator == null) || |
| ((indicator == C_MAPPING_KEY || |
| @@ -1037,7 +1037,7 @@ class Parser { |
| case FLOW_KEY: |
| // 129 |
| return isNonSpace(char) && !isFlowIndicator(char); |
| - default: throw 'invalid context "$ctx"'; |
| + default: throw 'Invalid context "$ctx".'; |
| } |
| } |
| @@ -1066,7 +1066,7 @@ class Parser { |
| case BLOCK_KEY: |
| case FLOW_KEY: |
| return ns_plainOneLine(ctx); |
| - default: throw 'invalid context "$ctx"'; |
| + default: throw 'Invalid context "$ctx".'; |
| } |
| }); |
| }); |
| @@ -1106,13 +1106,14 @@ class Parser { |
| // 136 |
| int inFlow(int ctx) { |
| switch (ctx) { |
| - case FLOW_OUT: |
| - case FLOW_IN: |
| - return FLOW_IN; |
| - case BLOCK_KEY: |
| - case FLOW_KEY: |
| - return FLOW_KEY; |
| + case FLOW_OUT: |
| + case FLOW_IN: |
| + return FLOW_IN; |
| + case BLOCK_KEY: |
| + case FLOW_KEY: |
| + return FLOW_KEY; |
| } |
| + throw "unreachable"; |
| } |
| // 137 |
| @@ -1434,6 +1435,7 @@ class Parser { |
| case CHOMPING_KEEP: |
| return b_asLineFeed(); |
| } |
| + throw "unreachable"; |
| } |
| // 166 |