| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library fasta.quote; | 5 library fasta.quote; |
| 6 | 6 |
| 7 import 'errors.dart' show inputError, internalError; | 7 import 'errors.dart' show inputError, internalError; |
| 8 | 8 |
| 9 import 'scanner/characters.dart' | 9 import 'scanner/characters.dart' |
| 10 show | 10 show |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 case Quote.RawSingle: | 153 case Quote.RawSingle: |
| 154 case Quote.RawDouble: | 154 case Quote.RawDouble: |
| 155 return string; | 155 return string; |
| 156 | 156 |
| 157 case Quote.RawMultiLineSingle: | 157 case Quote.RawMultiLineSingle: |
| 158 case Quote.RawMultiLineDouble: | 158 case Quote.RawMultiLineDouble: |
| 159 return !string.contains("\r") | 159 return !string.contains("\r") |
| 160 ? string | 160 ? string |
| 161 : unescapeCodeUnits(string.codeUnits, true); | 161 : unescapeCodeUnits(string.codeUnits, true); |
| 162 } | 162 } |
| 163 return internalError("Unhandled string quote: $quote"); | 163 return internalError("Internal error: Unexpected quote: $quote."); |
| 164 } | 164 } |
| 165 | 165 |
| 166 const String incompleteSequence = "Incomplete escape sequence."; | 166 const String incompleteSequence = "Incomplete escape sequence."; |
| 167 | 167 |
| 168 const String invalidCharacter = "Invalid character in escape sequence."; | 168 const String invalidCharacter = "Invalid character in escape sequence."; |
| 169 | 169 |
| 170 const String invalidCodePoint = "Invalid code point."; | 170 const String invalidCodePoint = "Invalid code point."; |
| 171 | 171 |
| 172 // Note: based on | 172 // Note: based on |
| 173 // [StringValidator.validateString](pkg/compiler/lib/src/string_validator.dart). | 173 // [StringValidator.validateString](pkg/compiler/lib/src/string_validator.dart). |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 245 } |
| 246 } else { | 246 } else { |
| 247 // Nothing, escaped character is passed through; | 247 // Nothing, escaped character is passed through; |
| 248 } | 248 } |
| 249 if (code > 0x10FFFF) return error(i, invalidCodePoint); | 249 if (code > 0x10FFFF) return error(i, invalidCodePoint); |
| 250 } | 250 } |
| 251 result[resultOffset++] = code; | 251 result[resultOffset++] = code; |
| 252 } | 252 } |
| 253 return new String.fromCharCodes(result, 0, resultOffset); | 253 return new String.fromCharCodes(result, 0, resultOffset); |
| 254 } | 254 } |
| OLD | NEW |