Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: pkg/analyzer/lib/src/generated/ast.dart

Issue 632203002: More string literals getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Check strings start instead of end Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analyzer/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.ast; 8 library engine.ast;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 16027 matching lines...) Expand 10 before | Expand all | Expand 10 after
16038 */ 16038 */
16039 Element get toolkitElement => _toolkitElement; 16039 Element get toolkitElement => _toolkitElement;
16040 16040
16041 /** 16041 /**
16042 * Return the value of the literal. 16042 * Return the value of the literal.
16043 * 16043 *
16044 * @return the value of the literal 16044 * @return the value of the literal
16045 */ 16045 */
16046 String get value => _value; 16046 String get value => _value;
16047 16047
16048 /** 16048 @override
16049 * Return `true` if this string literal is a multi-line string.
16050 *
16051 * @return `true` if this string literal is a multi-line string
16052 */
16053 bool get isMultiline { 16049 bool get isMultiline {
16054 String lexeme = literal.lexeme; 16050 String lexeme = literal.lexeme;
16055 if (lexeme.length < 6) { 16051 if (lexeme.length < 6) {
Paul Berry 2014/10/07 16:30:55 Change this to "if (lexeme.length < 3)". Otherwis
scheglov 2014/10/07 18:11:09 Pushed this change into another analyzer CL: https
16056 return false; 16052 return false;
16057 } 16053 }
16058 return StringUtilities.endsWith3(lexeme, 0x22, 0x22, 0x22) || StringUtilitie s.endsWith3(lexeme, 0x27, 0x27, 0x27); 16054 // skip 'r'
16055 int offset = 0;
16056 if (lexeme.codeUnitAt(0) == 0x72) {
Paul Berry 2014/10/07 16:30:55 Nit: for readability it would be nice to change th
16057 offset = 1;
16058 }
16059 // check prefix
16060 return StringUtilities.startsWith3(lexeme, offset, 0x22, 0x22, 0x22) ||
16061 StringUtilities.startsWith3(lexeme, offset, 0x27, 0x27, 0x27);
16059 } 16062 }
16060 16063
16064 @override
16061 bool get isRaw => literal.lexeme.codeUnitAt(0) == 0x72; 16065 bool get isRaw => literal.lexeme.codeUnitAt(0) == 0x72;
16062 16066
16063 @override 16067 @override
16068 bool get isSingleQuoted {
16069 String lexeme = literal.lexeme;
16070 if (lexeme.isEmpty) {
16071 return false;
16072 }
16073 int codeZero = lexeme.codeUnitAt(0);
16074 if (codeZero == 0x72) {
16075 return lexeme.length > 1 && lexeme.codeUnitAt(1) == 0x27;
16076 }
16077 return codeZero == 0x27;
16078 }
16079
16080 @override
16064 bool get isSynthetic => literal.isSynthetic; 16081 bool get isSynthetic => literal.isSynthetic;
16065 16082
16066 /** 16083 /**
16067 * Set the toolkit specific, non-Dart, element associated with this literal. 16084 * Set the toolkit specific, non-Dart, element associated with this literal.
16068 * 16085 *
16069 * @param element the toolkit specific element to be associated with this lite ral 16086 * @param element the toolkit specific element to be associated with this lite ral
16070 */ 16087 */
16071 void set toolkitElement(Element element) { 16088 void set toolkitElement(Element element) {
16072 _toolkitElement = element; 16089 _toolkitElement = element;
16073 } 16090 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
16174 return element.contentsOffset; 16191 return element.contentsOffset;
16175 } 16192 }
16176 16193
16177 @override 16194 @override
16178 int get contentsEnd { 16195 int get contentsEnd {
16179 InterpolationString element = _elements.last; 16196 InterpolationString element = _elements.last;
16180 return element.contentsEnd; 16197 return element.contentsEnd;
16181 } 16198 }
16182 16199
16183 @override 16200 @override
16201 bool get isMultiline {
16202 InterpolationString element = _elements.first;
16203 String lexeme = element._contents.lexeme;
16204 if (lexeme.length < 3) {
16205 return false;
16206 }
16207 return StringUtilities.startsWith3(lexeme, 0, 0x22, 0x22, 0x22) ||
16208 StringUtilities.startsWith3(lexeme, 0, 0x27, 0x27, 0x27);
16209 }
16210
16211 @override
16184 bool get isRaw => false; 16212 bool get isRaw => false;
16213
16214
16215 @override
16216 bool get isSingleQuoted {
16217 InterpolationString lastString = _elements.first;
16218 String lexeme = lastString._contents.lexeme;
16219 return StringUtilities.startsWithChar(lexeme, 0x27);
16220 }
16185 } 16221 }
16186 16222
16187 /** 16223 /**
16188 * Instances of the class `StringLiteral` represent a string literal expression. 16224 * Instances of the class `StringLiteral` represent a string literal expression.
16189 * 16225 *
16190 * <pre> 16226 * <pre>
16191 * stringLiteral ::= 16227 * stringLiteral ::=
16192 * [SimpleStringLiteral] 16228 * [SimpleStringLiteral]
16193 * | [AdjacentStrings] 16229 * | [AdjacentStrings]
16194 * | [StringInterpolation] 16230 * | [StringInterpolation]
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
16236 * Return the offset of the first contents character. 16272 * Return the offset of the first contents character.
16237 */ 16273 */
16238 int get contentsOffset; 16274 int get contentsOffset;
16239 16275
16240 /** 16276 /**
16241 * Return the offset of the after-last contents character. 16277 * Return the offset of the after-last contents character.
16242 */ 16278 */
16243 int get contentsEnd; 16279 int get contentsEnd;
16244 16280
16245 /** 16281 /**
16282 * Return `true` if this string literal is a multi-line string.
16283 */
16284 bool get isMultiline;
16285
16286 /**
16246 * Return `true` if this string literal is a raw string. 16287 * Return `true` if this string literal is a raw string.
16247 */ 16288 */
16248 bool get isRaw; 16289 bool get isRaw;
16290
16291 /**
16292 * Return `true` if this string literal uses single qoutes (' or ''').
16293 * Return `false` if this string literal uses double qoutes (" or """).
16294 */
16295 bool get isSingleQuoted;
16249 } 16296 }
16250 16297
16251 /** 16298 /**
16252 * Instances of the class `SuperConstructorInvocation` represent the invocation of a 16299 * Instances of the class `SuperConstructorInvocation` represent the invocation of a
16253 * superclass' constructor from within a constructor's initialization list. 16300 * superclass' constructor from within a constructor's initialization list.
16254 * 16301 *
16255 * <pre> 16302 * <pre>
16256 * superInvocation ::= 16303 * superInvocation ::=
16257 * 'super' ('.' [SimpleIdentifier])? [ArgumentList] 16304 * 'super' ('.' [SimpleIdentifier])? [ArgumentList]
16258 * </pre> 16305 * </pre>
(...skipping 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after
19661 _elements[index] = node; 19708 _elements[index] = node;
19662 } 19709 }
19663 void clear() { 19710 void clear() {
19664 _elements = <E> []; 19711 _elements = <E> [];
19665 } 19712 }
19666 int get length => _elements.length; 19713 int get length => _elements.length;
19667 void set length(int value) { 19714 void set length(int value) {
19668 throw new UnsupportedError("Cannot resize NodeList."); 19715 throw new UnsupportedError("Cannot resize NodeList.");
19669 } 19716 }
19670 } 19717 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698