Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 10423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10434 * | 10434 * |
| 10435 * @param string the value of the literal | 10435 * @param string the value of the literal |
| 10436 */ | 10436 */ |
| 10437 void set value(String string) { | 10437 void set value(String string) { |
| 10438 _value = string; | 10438 _value = string; |
| 10439 } | 10439 } |
| 10440 | 10440 |
| 10441 @override | 10441 @override |
| 10442 void visitChildren(AstVisitor visitor) { | 10442 void visitChildren(AstVisitor visitor) { |
| 10443 } | 10443 } |
| 10444 | |
| 10445 /** | |
| 10446 * Return the offset of the after-last contents character. | |
| 10447 */ | |
| 10448 int get contentsEnd { | |
| 10449 int end = _contents.end; | |
| 10450 String lexeme = _contents.lexeme; | |
| 10451 if (StringUtilities.endsWith3(lexeme, 0x22, 0x22, 0x22) || | |
| 10452 StringUtilities.endsWith3(lexeme, 0x27, 0x27, 0x27)) { | |
| 10453 end -= 3; | |
| 10454 } else { | |
| 10455 end -= 1; | |
| 10456 } | |
| 10457 return end; | |
| 10458 } | |
| 10459 | |
| 10460 /** | |
| 10461 * Return the offset of the first contents character. | |
| 10462 */ | |
| 10463 int get contentsOffset { | |
| 10464 int offset = _contents.offset; | |
| 10465 String lexeme = _contents.lexeme; | |
| 10466 if (lexeme.codeUnitAt(0) == 0x72) { | |
| 10467 offset += 1; | |
| 10468 } | |
| 10469 if (StringUtilities.startsWith3(lexeme, offset, 0x22, 0x22, 0x22) || | |
| 10470 StringUtilities.startsWith3(lexeme, offset, 0x27, 0x27, 0x27)) { | |
| 10471 offset += 3; | |
| 10472 } else { | |
| 10473 offset += 1; | |
| 10474 } | |
| 10475 return offset; | |
| 10476 } | |
| 10444 } | 10477 } |
| 10445 | 10478 |
| 10446 /** | 10479 /** |
| 10447 * Instances of the class `IsExpression` represent an is expression. | 10480 * Instances of the class `IsExpression` represent an is expression. |
| 10448 * | 10481 * |
| 10449 * <pre> | 10482 * <pre> |
| 10450 * isExpression ::= | 10483 * isExpression ::= |
| 10451 * [Expression] 'is' '!'? [TypeName] | 10484 * [Expression] 'is' '!'? [TypeName] |
| 10452 * </pre> | 10485 * </pre> |
| 10453 */ | 10486 */ |
| (...skipping 5481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15935 * | 15968 * |
| 15936 * multiLineStringLiteral ::= | 15969 * multiLineStringLiteral ::= |
| 15937 * "'''" characters "'''" | 15970 * "'''" characters "'''" |
| 15938 * | '"""' characters '"""' | 15971 * | '"""' characters '"""' |
| 15939 * | 15972 * |
| 15940 * singleLineStringLiteral ::= | 15973 * singleLineStringLiteral ::= |
| 15941 * "'" characters "'" | 15974 * "'" characters "'" |
| 15942 * '"' characters '"' | 15975 * '"' characters '"' |
| 15943 * </pre> | 15976 * </pre> |
| 15944 */ | 15977 */ |
| 15945 class SimpleStringLiteral extends StringLiteral { | 15978 class SimpleStringLiteral extends SingleStringLiteral { |
| 15946 /** | 15979 /** |
| 15947 * The token representing the literal. | 15980 * The token representing the literal. |
| 15948 */ | 15981 */ |
| 15949 Token literal; | 15982 Token literal; |
| 15950 | 15983 |
| 15951 /** | 15984 /** |
| 15952 * The value of the literal. | 15985 * The value of the literal. |
| 15953 */ | 15986 */ |
| 15954 String _value; | 15987 String _value; |
| 15955 | 15988 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 15968 this._value = StringUtilities.intern(value); | 16001 this._value = StringUtilities.intern(value); |
| 15969 } | 16002 } |
| 15970 | 16003 |
| 15971 @override | 16004 @override |
| 15972 accept(AstVisitor visitor) => visitor.visitSimpleStringLiteral(this); | 16005 accept(AstVisitor visitor) => visitor.visitSimpleStringLiteral(this); |
| 15973 | 16006 |
| 15974 @override | 16007 @override |
| 15975 Token get beginToken => literal; | 16008 Token get beginToken => literal; |
| 15976 | 16009 |
| 15977 @override | 16010 @override |
| 16011 int get contentsOffset { | |
| 16012 int contentsOffset = 0; | |
| 16013 if (isRaw) { | |
| 16014 contentsOffset += 1; | |
| 16015 } | |
| 16016 if (isMultiline) { | |
| 16017 contentsOffset += 3; | |
| 16018 } else { | |
| 16019 contentsOffset += 1; | |
| 16020 } | |
| 16021 return offset + contentsOffset; | |
| 16022 } | |
| 16023 | |
| 16024 @override | |
| 16025 int get contentsEnd { | |
| 16026 return contentsOffset + value.length; | |
| 16027 } | |
| 16028 | |
| 16029 @override | |
| 15978 Token get endToken => literal; | 16030 Token get endToken => literal; |
| 15979 | 16031 |
| 15980 /** | 16032 /** |
| 15981 * Return the toolkit specific, non-Dart, element associated with this literal , or `null`. | 16033 * Return the toolkit specific, non-Dart, element associated with this literal , or `null`. |
| 15982 * | 16034 * |
| 15983 * @return the element associated with this literal | 16035 * @return the element associated with this literal |
| 15984 */ | 16036 */ |
| 15985 Element get toolkitElement => _toolkitElement; | 16037 Element get toolkitElement => _toolkitElement; |
| 15986 | 16038 |
| 15987 /** | 16039 /** |
| 15988 * Return the value of the literal. | 16040 * Return the value of the literal. |
| 15989 * | 16041 * |
| 15990 * @return the value of the literal | 16042 * @return the value of the literal |
| 15991 */ | 16043 */ |
| 15992 String get value => _value; | 16044 String get value => _value; |
| 15993 | 16045 |
| 15994 /** | 16046 /** |
| 15995 * Return the offset of the first value character. | |
| 15996 * | |
| 15997 * @return the offset of the first value character | |
| 15998 */ | |
| 15999 int get valueOffset { | |
| 16000 int valueOffset = 0; | |
| 16001 if (isRaw) { | |
| 16002 valueOffset += 1; | |
| 16003 } | |
| 16004 if (isMultiline) { | |
| 16005 valueOffset += 3; | |
| 16006 } else { | |
| 16007 valueOffset += 1; | |
| 16008 } | |
| 16009 return offset + valueOffset; | |
| 16010 } | |
| 16011 | |
| 16012 /** | |
| 16013 * Return `true` if this string literal is a multi-line string. | 16047 * Return `true` if this string literal is a multi-line string. |
| 16014 * | 16048 * |
| 16015 * @return `true` if this string literal is a multi-line string | 16049 * @return `true` if this string literal is a multi-line string |
| 16016 */ | 16050 */ |
| 16017 bool get isMultiline { | 16051 bool get isMultiline { |
| 16018 String lexeme = literal.lexeme; | 16052 String lexeme = literal.lexeme; |
| 16019 if (lexeme.length < 6) { | 16053 if (lexeme.length < 6) { |
| 16020 return false; | 16054 return false; |
| 16021 } | 16055 } |
| 16022 return StringUtilities.endsWith3(lexeme, 0x22, 0x22, 0x22) || StringUtilitie s.endsWith3(lexeme, 0x27, 0x27, 0x27); | 16056 return StringUtilities.endsWith3(lexeme, 0x22, 0x22, 0x22) || StringUtilitie s.endsWith3(lexeme, 0x27, 0x27, 0x27); |
| 16023 } | 16057 } |
| 16024 | 16058 |
| 16025 /** | |
| 16026 * Return `true` if this string literal is a raw string. | |
| 16027 * | |
| 16028 * @return `true` if this string literal is a raw string | |
| 16029 */ | |
| 16030 bool get isRaw => literal.lexeme.codeUnitAt(0) == 0x72; | 16059 bool get isRaw => literal.lexeme.codeUnitAt(0) == 0x72; |
| 16031 | 16060 |
| 16032 @override | 16061 @override |
| 16033 bool get isSynthetic => literal.isSynthetic; | 16062 bool get isSynthetic => literal.isSynthetic; |
| 16034 | 16063 |
| 16035 /** | 16064 /** |
| 16036 * Set the toolkit specific, non-Dart, element associated with this literal. | 16065 * Set the toolkit specific, non-Dart, element associated with this literal. |
| 16037 * | 16066 * |
| 16038 * @param element the toolkit specific element to be associated with this lite ral | 16067 * @param element the toolkit specific element to be associated with this lite ral |
| 16039 */ | 16068 */ |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16088 | 16117 |
| 16089 /** | 16118 /** |
| 16090 * Instances of the class `StringInterpolation` represent a string interpolation literal. | 16119 * Instances of the class `StringInterpolation` represent a string interpolation literal. |
| 16091 * | 16120 * |
| 16092 * <pre> | 16121 * <pre> |
| 16093 * stringInterpolation ::= | 16122 * stringInterpolation ::= |
| 16094 * ''' [InterpolationElement]* ''' | 16123 * ''' [InterpolationElement]* ''' |
| 16095 * | '"' [InterpolationElement]* '"' | 16124 * | '"' [InterpolationElement]* '"' |
| 16096 * </pre> | 16125 * </pre> |
| 16097 */ | 16126 */ |
| 16098 class StringInterpolation extends StringLiteral { | 16127 class StringInterpolation extends SingleStringLiteral { |
| 16099 /** | 16128 /** |
| 16100 * The elements that will be composed to produce the resulting string. | 16129 * The elements that will be composed to produce the resulting string. |
| 16101 */ | 16130 */ |
| 16102 NodeList<InterpolationElement> _elements; | 16131 NodeList<InterpolationElement> _elements; |
| 16103 | 16132 |
| 16104 /** | 16133 /** |
| 16105 * Initialize a newly created string interpolation expression. | 16134 * Initialize a newly created string interpolation expression. |
| 16106 * | 16135 * |
| 16107 * @param elements the elements that will be composed to produce the resulting string | 16136 * @param elements the elements that will be composed to produce the resulting string |
| 16108 */ | 16137 */ |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 16129 | 16158 |
| 16130 @override | 16159 @override |
| 16131 void visitChildren(AstVisitor visitor) { | 16160 void visitChildren(AstVisitor visitor) { |
| 16132 _elements.accept(visitor); | 16161 _elements.accept(visitor); |
| 16133 } | 16162 } |
| 16134 | 16163 |
| 16135 @override | 16164 @override |
| 16136 void appendStringValue(JavaStringBuilder builder) { | 16165 void appendStringValue(JavaStringBuilder builder) { |
| 16137 throw new IllegalArgumentException(); | 16166 throw new IllegalArgumentException(); |
| 16138 } | 16167 } |
| 16168 | |
| 16169 @override | |
| 16170 int get contentsOffset { | |
| 16171 InterpolationString element = _elements.first; | |
| 16172 return element.contentsOffset; | |
| 16173 } | |
| 16174 | |
| 16175 @override | |
| 16176 int get contentsEnd { | |
| 16177 InterpolationString element = _elements.last; | |
| 16178 return element.contentsEnd; | |
| 16179 } | |
| 16180 | |
| 16181 @override | |
| 16182 bool get isRaw => false; | |
| 16139 } | 16183 } |
| 16140 | 16184 |
| 16141 /** | 16185 /** |
| 16142 * Instances of the class `StringLiteral` represent a string literal expression. | 16186 * Instances of the class `StringLiteral` represent a string literal expression. |
| 16143 * | 16187 * |
| 16144 * <pre> | 16188 * <pre> |
| 16145 * stringLiteral ::= | 16189 * stringLiteral ::= |
| 16146 * [SimpleStringLiteral] | 16190 * [SimpleStringLiteral] |
| 16147 * | [AdjacentStrings] | 16191 * | [AdjacentStrings] |
| 16148 * | [StringInterpolation] | 16192 * | [StringInterpolation] |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 16169 * Append the value of the given string literal to the given string builder. | 16213 * Append the value of the given string literal to the given string builder. |
| 16170 * | 16214 * |
| 16171 * @param builder the builder to which the string's value is to be appended | 16215 * @param builder the builder to which the string's value is to be appended |
| 16172 * @throws IllegalArgumentException if the string is not a constant string wit hout any string | 16216 * @throws IllegalArgumentException if the string is not a constant string wit hout any string |
| 16173 * interpolation | 16217 * interpolation |
| 16174 */ | 16218 */ |
| 16175 void appendStringValue(JavaStringBuilder builder); | 16219 void appendStringValue(JavaStringBuilder builder); |
| 16176 } | 16220 } |
| 16177 | 16221 |
| 16178 /** | 16222 /** |
| 16223 * Instances of the class [SingleStringLiteral] represent a single string | |
| 16224 * literal expression. | |
| 16225 * | |
| 16226 * <pre> | |
| 16227 * singleStringLiteral ::= | |
| 16228 * [SimpleStringLiteral] | |
| 16229 * | [StringInterpolation] | |
| 16230 * </pre> | |
| 16231 */ | |
| 16232 abstract class SingleStringLiteral extends StringLiteral { | |
|
Brian Wilkerson
2014/10/06 21:59:26
GeneralizingAstVisitor should have a visitSingleSt
scheglov
2014/10/07 00:53:34
Done.
| |
| 16233 /** | |
| 16234 * Return the offset of the first contents character. | |
| 16235 */ | |
| 16236 int get contentsOffset; | |
| 16237 | |
| 16238 /** | |
| 16239 * Return the offset of the after-last contents character. | |
| 16240 */ | |
| 16241 int get contentsEnd; | |
| 16242 | |
| 16243 /** | |
| 16244 * Return `true` if this string literal is a raw string. | |
| 16245 */ | |
| 16246 bool get isRaw; | |
| 16247 } | |
| 16248 | |
| 16249 /** | |
| 16179 * Instances of the class `SuperConstructorInvocation` represent the invocation of a | 16250 * Instances of the class `SuperConstructorInvocation` represent the invocation of a |
| 16180 * superclass' constructor from within a constructor's initialization list. | 16251 * superclass' constructor from within a constructor's initialization list. |
| 16181 * | 16252 * |
| 16182 * <pre> | 16253 * <pre> |
| 16183 * superInvocation ::= | 16254 * superInvocation ::= |
| 16184 * 'super' ('.' [SimpleIdentifier])? [ArgumentList] | 16255 * 'super' ('.' [SimpleIdentifier])? [ArgumentList] |
| 16185 * </pre> | 16256 * </pre> |
| 16186 */ | 16257 */ |
| 16187 class SuperConstructorInvocation extends ConstructorInitializer { | 16258 class SuperConstructorInvocation extends ConstructorInitializer { |
| 16188 /** | 16259 /** |
| (...skipping 3399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 19588 _elements[index] = node; | 19659 _elements[index] = node; |
| 19589 } | 19660 } |
| 19590 void clear() { | 19661 void clear() { |
| 19591 _elements = <E> []; | 19662 _elements = <E> []; |
| 19592 } | 19663 } |
| 19593 int get length => _elements.length; | 19664 int get length => _elements.length; |
| 19594 void set length(int value) { | 19665 void set length(int value) { |
| 19595 throw new UnsupportedError("Cannot resize NodeList."); | 19666 throw new UnsupportedError("Cannot resize NodeList."); |
| 19596 } | 19667 } |
| 19597 } | 19668 } |
| OLD | NEW |