OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 dart2js.scanner.string_scanner; | 5 library dart2js.scanner.string_scanner; |
6 | 6 |
7 import '../../scanner/token.dart' show SyntheticStringToken, TokenType; | 7 import '../../scanner/token.dart' show SyntheticStringToken, TokenType; |
8 | 8 |
9 import '../../scanner/token.dart' as analyzer show StringToken; | 9 import '../../scanner/token.dart' as analyzer show StringToken; |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 analyzer.StringToken createSubstringToken( | 50 analyzer.StringToken createSubstringToken( |
51 TokenType type, int start, bool asciiOnly, | 51 TokenType type, int start, bool asciiOnly, |
52 [int extraOffset = 0]) { | 52 [int extraOffset = 0]) { |
53 return new StringToken.fromSubstring( | 53 return new StringToken.fromSubstring( |
54 type, string, start, scanOffset + extraOffset, tokenStart, | 54 type, string, start, scanOffset + extraOffset, tokenStart, |
55 canonicalize: true, precedingComments: comments); | 55 canonicalize: true, precedingComments: comments); |
56 } | 56 } |
57 | 57 |
58 @override | 58 @override |
59 analyzer.StringToken createSyntheticSubstringToken( | 59 analyzer.StringToken createSyntheticSubstringToken( |
60 TokenType type, int start, bool asciiOnly, String closingQuotes) { | 60 TokenType type, int start, bool asciiOnly, String syntheticChars) { |
61 String source = string.substring(start, scanOffset); | 61 String source = string.substring(start, scanOffset); |
62 return new SyntheticStringToken( | 62 return new SyntheticStringToken( |
63 type, source + closingQuotes, tokenStart, source.length); | 63 type, source + syntheticChars, tokenStart, source.length); |
64 } | 64 } |
65 | 65 |
66 @override | 66 @override |
67 CommentToken createCommentToken(TokenType type, int start, bool asciiOnly, | 67 CommentToken createCommentToken(TokenType type, int start, bool asciiOnly, |
68 [int extraOffset = 0]) { | 68 [int extraOffset = 0]) { |
69 return new CommentToken.fromSubstring( | 69 return new CommentToken.fromSubstring( |
70 type, string, start, scanOffset + extraOffset, tokenStart, | 70 type, string, start, scanOffset + extraOffset, tokenStart, |
71 canonicalize: true); | 71 canonicalize: true); |
72 } | 72 } |
73 | 73 |
(...skipping 17 matching lines...) Expand all Loading... |
91 | 91 |
92 SubStringScanner(this.baseOffset, String string, | 92 SubStringScanner(this.baseOffset, String string, |
93 {bool includeComments: false}) | 93 {bool includeComments: false}) |
94 : super(string, includeComments: includeComments); | 94 : super(string, includeComments: includeComments); |
95 | 95 |
96 @override | 96 @override |
97 void beginToken() { | 97 void beginToken() { |
98 tokenStart = baseOffset + stringOffset; | 98 tokenStart = baseOffset + stringOffset; |
99 } | 99 } |
100 } | 100 } |
OLD | NEW |