| 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.scanner; | 8 library engine.scanner; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 /** | 181 /** |
| 182 * Initialize a newly created error code to have the given message and correct
ion. | 182 * Initialize a newly created error code to have the given message and correct
ion. |
| 183 * | 183 * |
| 184 * @param message the template used to create the message to be displayed for
the error | 184 * @param message the template used to create the message to be displayed for
the error |
| 185 * @param correction the template used to create the correction to be displaye
d for the error | 185 * @param correction the template used to create the correction to be displaye
d for the error |
| 186 */ | 186 */ |
| 187 ScannerErrorCode.con2(String name, int ordinal, this.message, String correctio
n) : super(name, ordinal) { | 187 ScannerErrorCode.con2(String name, int ordinal, this.message, String correctio
n) : super(name, ordinal) { |
| 188 this.correction10 = correction; | 188 this.correction10 = correction; |
| 189 } | 189 } |
| 190 | 190 |
| 191 @override |
| 191 String get correction => correction10; | 192 String get correction => correction10; |
| 192 | 193 |
| 194 @override |
| 193 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; | 195 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; |
| 194 | 196 |
| 197 @override |
| 195 ErrorType get type => ErrorType.SYNTACTIC_ERROR; | 198 ErrorType get type => ErrorType.SYNTACTIC_ERROR; |
| 196 } | 199 } |
| 197 | 200 |
| 198 /** | 201 /** |
| 199 * Instances of the class `SubSequenceReader` implement a [CharacterReader] that
reads | 202 * Instances of the class `SubSequenceReader` implement a [CharacterReader] that
reads |
| 200 * characters from a character sequence, but adds a delta when reporting the cur
rent character | 203 * characters from a character sequence, but adds a delta when reporting the cur
rent character |
| 201 * offset so that the character sequence can be a subsequence from a larger sequ
ence. | 204 * offset so that the character sequence can be a subsequence from a larger sequ
ence. |
| 202 */ | 205 */ |
| 203 class SubSequenceReader extends CharSequenceReader { | 206 class SubSequenceReader extends CharSequenceReader { |
| 204 /** | 207 /** |
| 205 * The offset from the beginning of the file to the beginning of the source be
ing scanned. | 208 * The offset from the beginning of the file to the beginning of the source be
ing scanned. |
| 206 */ | 209 */ |
| 207 int _offsetDelta = 0; | 210 int _offsetDelta = 0; |
| 208 | 211 |
| 209 /** | 212 /** |
| 210 * Initialize a newly created reader to read the characters in the given seque
nce. | 213 * Initialize a newly created reader to read the characters in the given seque
nce. |
| 211 * | 214 * |
| 212 * @param sequence the sequence from which characters will be read | 215 * @param sequence the sequence from which characters will be read |
| 213 * @param offsetDelta the offset from the beginning of the file to the beginni
ng of the source | 216 * @param offsetDelta the offset from the beginning of the file to the beginni
ng of the source |
| 214 * being scanned | 217 * being scanned |
| 215 */ | 218 */ |
| 216 SubSequenceReader(String sequence, int offsetDelta) : super(sequence) { | 219 SubSequenceReader(String sequence, int offsetDelta) : super(sequence) { |
| 217 this._offsetDelta = offsetDelta; | 220 this._offsetDelta = offsetDelta; |
| 218 } | 221 } |
| 219 | 222 |
| 223 @override |
| 220 int get offset => _offsetDelta + super.offset; | 224 int get offset => _offsetDelta + super.offset; |
| 221 | 225 |
| 226 @override |
| 222 String getString(int start, int endDelta) => super.getString(start - _offsetDe
lta, endDelta); | 227 String getString(int start, int endDelta) => super.getString(start - _offsetDe
lta, endDelta); |
| 223 | 228 |
| 229 @override |
| 224 void set offset(int offset) { | 230 void set offset(int offset) { |
| 225 super.offset = offset - _offsetDelta; | 231 super.offset = offset - _offsetDelta; |
| 226 } | 232 } |
| 227 } | 233 } |
| 228 | 234 |
| 229 /** | 235 /** |
| 230 * Instances of the class `TokenWithComment` represent a string token that is pr
eceded by | 236 * Instances of the class `TokenWithComment` represent a string token that is pr
eceded by |
| 231 * comments. | 237 * comments. |
| 232 */ | 238 */ |
| 233 class StringTokenWithComment extends StringToken { | 239 class StringTokenWithComment extends StringToken { |
| 234 /** | 240 /** |
| 235 * The first comment in the list of comments that precede this token. | 241 * The first comment in the list of comments that precede this token. |
| 236 */ | 242 */ |
| 237 Token _precedingComment; | 243 Token _precedingComment; |
| 238 | 244 |
| 239 /** | 245 /** |
| 240 * Initialize a newly created token to have the given type and offset and to b
e preceded by the | 246 * Initialize a newly created token to have the given type and offset and to b
e preceded by the |
| 241 * comments reachable from the given comment. | 247 * comments reachable from the given comment. |
| 242 * | 248 * |
| 243 * @param type the type of the token | 249 * @param type the type of the token |
| 244 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 250 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 245 * @param precedingComment the first comment in the list of comments that prec
ede this token | 251 * @param precedingComment the first comment in the list of comments that prec
ede this token |
| 246 */ | 252 */ |
| 247 StringTokenWithComment(TokenType type, String value, int offset, Token precedi
ngComment) : super(type, value, offset) { | 253 StringTokenWithComment(TokenType type, String value, int offset, Token precedi
ngComment) : super(type, value, offset) { |
| 248 this._precedingComment = precedingComment; | 254 this._precedingComment = precedingComment; |
| 249 } | 255 } |
| 250 | 256 |
| 257 @override |
| 251 Token copy() => new StringTokenWithComment(type, lexeme, offset, copyComments(
_precedingComment)); | 258 Token copy() => new StringTokenWithComment(type, lexeme, offset, copyComments(
_precedingComment)); |
| 252 | 259 |
| 260 @override |
| 253 Token get precedingComments => _precedingComment; | 261 Token get precedingComments => _precedingComment; |
| 254 | 262 |
| 263 @override |
| 255 void applyDelta(int delta) { | 264 void applyDelta(int delta) { |
| 256 super.applyDelta(delta); | 265 super.applyDelta(delta); |
| 257 Token token = _precedingComment; | 266 Token token = _precedingComment; |
| 258 while (token != null) { | 267 while (token != null) { |
| 259 token.applyDelta(delta); | 268 token.applyDelta(delta); |
| 260 token = token.next; | 269 token = token.next; |
| 261 } | 270 } |
| 262 } | 271 } |
| 263 } | 272 } |
| 264 | 273 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 * Initialize a newly created reader to read the characters in the given seque
nce. | 510 * Initialize a newly created reader to read the characters in the given seque
nce. |
| 502 * | 511 * |
| 503 * @param sequence the sequence from which characters will be read | 512 * @param sequence the sequence from which characters will be read |
| 504 */ | 513 */ |
| 505 CharSequenceReader(String sequence) { | 514 CharSequenceReader(String sequence) { |
| 506 this._sequence = sequence; | 515 this._sequence = sequence; |
| 507 this._stringLength = sequence.length; | 516 this._stringLength = sequence.length; |
| 508 this._charOffset = -1; | 517 this._charOffset = -1; |
| 509 } | 518 } |
| 510 | 519 |
| 520 @override |
| 511 int advance() { | 521 int advance() { |
| 512 if (_charOffset + 1 >= _stringLength) { | 522 if (_charOffset + 1 >= _stringLength) { |
| 513 return -1; | 523 return -1; |
| 514 } | 524 } |
| 515 return _sequence.codeUnitAt(++_charOffset); | 525 return _sequence.codeUnitAt(++_charOffset); |
| 516 } | 526 } |
| 517 | 527 |
| 528 @override |
| 518 int get offset => _charOffset; | 529 int get offset => _charOffset; |
| 519 | 530 |
| 531 @override |
| 520 String getString(int start, int endDelta) => _sequence.substring(start, _charO
ffset + 1 + endDelta).toString(); | 532 String getString(int start, int endDelta) => _sequence.substring(start, _charO
ffset + 1 + endDelta).toString(); |
| 521 | 533 |
| 534 @override |
| 522 int peek() { | 535 int peek() { |
| 523 if (_charOffset + 1 >= _sequence.length) { | 536 if (_charOffset + 1 >= _sequence.length) { |
| 524 return -1; | 537 return -1; |
| 525 } | 538 } |
| 526 return _sequence.codeUnitAt(_charOffset + 1); | 539 return _sequence.codeUnitAt(_charOffset + 1); |
| 527 } | 540 } |
| 528 | 541 |
| 542 @override |
| 529 void set offset(int offset) { | 543 void set offset(int offset) { |
| 530 _charOffset = offset; | 544 _charOffset = offset; |
| 531 } | 545 } |
| 532 } | 546 } |
| 533 | 547 |
| 534 /** | 548 /** |
| 535 * Synthetic `StringToken` represent a token whose value is independent of it's
type. | 549 * Synthetic `StringToken` represent a token whose value is independent of it's
type. |
| 536 */ | 550 */ |
| 537 class SyntheticStringToken extends StringToken { | 551 class SyntheticStringToken extends StringToken { |
| 538 /** | 552 /** |
| 539 * Initialize a newly created token to represent a token of the given type wit
h the given value. | 553 * Initialize a newly created token to represent a token of the given type wit
h the given value. |
| 540 * | 554 * |
| 541 * @param type the type of the token | 555 * @param type the type of the token |
| 542 * @param value the lexeme represented by this token | 556 * @param value the lexeme represented by this token |
| 543 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 557 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 544 */ | 558 */ |
| 545 SyntheticStringToken(TokenType type, String value, int offset) : super(type, v
alue, offset); | 559 SyntheticStringToken(TokenType type, String value, int offset) : super(type, v
alue, offset); |
| 546 | 560 |
| 561 @override |
| 547 bool get isSynthetic => true; | 562 bool get isSynthetic => true; |
| 548 } | 563 } |
| 549 | 564 |
| 550 /** | 565 /** |
| 551 * Instances of the class `IncrementalScanner` implement a scanner that scans a
subset of a | 566 * Instances of the class `IncrementalScanner` implement a scanner that scans a
subset of a |
| 552 * string and inserts the resulting tokens into the middle of an existing token
stream. | 567 * string and inserts the resulting tokens into the middle of an existing token
stream. |
| 553 */ | 568 */ |
| 554 class IncrementalScanner extends Scanner { | 569 class IncrementalScanner extends Scanner { |
| 555 /** | 570 /** |
| 556 * The reader used to access the characters in the source. | 571 * The reader used to access the characters in the source. |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 * Initialize a newly created token to represent a token of the given type wit
h the given value. | 1873 * Initialize a newly created token to represent a token of the given type wit
h the given value. |
| 1859 * | 1874 * |
| 1860 * @param type the type of the token | 1875 * @param type the type of the token |
| 1861 * @param value the lexeme represented by this token | 1876 * @param value the lexeme represented by this token |
| 1862 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 1877 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 1863 */ | 1878 */ |
| 1864 StringToken(TokenType type, String value, int offset) : super(type, offset) { | 1879 StringToken(TokenType type, String value, int offset) : super(type, offset) { |
| 1865 this._value = StringUtilities.intern(value); | 1880 this._value = StringUtilities.intern(value); |
| 1866 } | 1881 } |
| 1867 | 1882 |
| 1883 @override |
| 1868 Token copy() => new StringToken(type, _value, offset); | 1884 Token copy() => new StringToken(type, _value, offset); |
| 1869 | 1885 |
| 1886 @override |
| 1870 String get lexeme => _value; | 1887 String get lexeme => _value; |
| 1871 | 1888 |
| 1889 @override |
| 1872 String value() => _value; | 1890 String value() => _value; |
| 1873 } | 1891 } |
| 1874 | 1892 |
| 1875 /** | 1893 /** |
| 1876 * Instances of the class `TokenWithComment` represent a normal token that is pr
eceded by | 1894 * Instances of the class `TokenWithComment` represent a normal token that is pr
eceded by |
| 1877 * comments. | 1895 * comments. |
| 1878 */ | 1896 */ |
| 1879 class TokenWithComment extends Token { | 1897 class TokenWithComment extends Token { |
| 1880 /** | 1898 /** |
| 1881 * The first comment in the list of comments that precede this token. | 1899 * The first comment in the list of comments that precede this token. |
| 1882 */ | 1900 */ |
| 1883 Token _precedingComment; | 1901 Token _precedingComment; |
| 1884 | 1902 |
| 1885 /** | 1903 /** |
| 1886 * Initialize a newly created token to have the given type and offset and to b
e preceded by the | 1904 * Initialize a newly created token to have the given type and offset and to b
e preceded by the |
| 1887 * comments reachable from the given comment. | 1905 * comments reachable from the given comment. |
| 1888 * | 1906 * |
| 1889 * @param type the type of the token | 1907 * @param type the type of the token |
| 1890 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 1908 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 1891 * @param precedingComment the first comment in the list of comments that prec
ede this token | 1909 * @param precedingComment the first comment in the list of comments that prec
ede this token |
| 1892 */ | 1910 */ |
| 1893 TokenWithComment(TokenType type, int offset, Token precedingComment) : super(t
ype, offset) { | 1911 TokenWithComment(TokenType type, int offset, Token precedingComment) : super(t
ype, offset) { |
| 1894 this._precedingComment = precedingComment; | 1912 this._precedingComment = precedingComment; |
| 1895 } | 1913 } |
| 1896 | 1914 |
| 1915 @override |
| 1897 Token copy() => new TokenWithComment(type, offset, _precedingComment); | 1916 Token copy() => new TokenWithComment(type, offset, _precedingComment); |
| 1898 | 1917 |
| 1918 @override |
| 1899 Token get precedingComments => _precedingComment; | 1919 Token get precedingComments => _precedingComment; |
| 1900 } | 1920 } |
| 1901 | 1921 |
| 1902 /** | 1922 /** |
| 1903 * Instances of the class `Token` represent a token that was scanned from the in
put. Each | 1923 * Instances of the class `Token` represent a token that was scanned from the in
put. Each |
| 1904 * token knows which token follows it, acting as the head of a linked list of to
kens. | 1924 * token knows which token follows it, acting as the head of a linked list of to
kens. |
| 1905 */ | 1925 */ |
| 1906 class Token { | 1926 class Token { |
| 1907 /** | 1927 /** |
| 1908 * The type of the token. | 1928 * The type of the token. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2036 * previous token for the given token. | 2056 * previous token for the given token. |
| 2037 * | 2057 * |
| 2038 * @param token the next token in the token stream | 2058 * @param token the next token in the token stream |
| 2039 * @return the token that was passed in | 2059 * @return the token that was passed in |
| 2040 */ | 2060 */ |
| 2041 Token setNextWithoutSettingPrevious(Token token) { | 2061 Token setNextWithoutSettingPrevious(Token token) { |
| 2042 _next = token; | 2062 _next = token; |
| 2043 return token; | 2063 return token; |
| 2044 } | 2064 } |
| 2045 | 2065 |
| 2066 @override |
| 2046 String toString() => lexeme; | 2067 String toString() => lexeme; |
| 2047 | 2068 |
| 2048 /** | 2069 /** |
| 2049 * Return the value of this token. For keyword tokens, this is the keyword ass
ociated with the | 2070 * Return the value of this token. For keyword tokens, this is the keyword ass
ociated with the |
| 2050 * token, for other tokens it is the lexeme associated with the token. | 2071 * token, for other tokens it is the lexeme associated with the token. |
| 2051 * | 2072 * |
| 2052 * @return the value of this token | 2073 * @return the value of this token |
| 2053 */ | 2074 */ |
| 2054 Object value() => type.lexeme; | 2075 Object value() => type.lexeme; |
| 2055 | 2076 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2146 * comments reachable from the given comment. | 2167 * comments reachable from the given comment. |
| 2147 * | 2168 * |
| 2148 * @param type the type of the token | 2169 * @param type the type of the token |
| 2149 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 2170 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 2150 * @param precedingComment the first comment in the list of comments that prec
ede this token | 2171 * @param precedingComment the first comment in the list of comments that prec
ede this token |
| 2151 */ | 2172 */ |
| 2152 BeginTokenWithComment(TokenType type, int offset, Token precedingComment) : su
per(type, offset) { | 2173 BeginTokenWithComment(TokenType type, int offset, Token precedingComment) : su
per(type, offset) { |
| 2153 this._precedingComment = precedingComment; | 2174 this._precedingComment = precedingComment; |
| 2154 } | 2175 } |
| 2155 | 2176 |
| 2177 @override |
| 2156 Token copy() => new BeginTokenWithComment(type, offset, copyComments(_precedin
gComment)); | 2178 Token copy() => new BeginTokenWithComment(type, offset, copyComments(_precedin
gComment)); |
| 2157 | 2179 |
| 2180 @override |
| 2158 Token get precedingComments => _precedingComment; | 2181 Token get precedingComments => _precedingComment; |
| 2159 | 2182 |
| 2183 @override |
| 2160 void applyDelta(int delta) { | 2184 void applyDelta(int delta) { |
| 2161 super.applyDelta(delta); | 2185 super.applyDelta(delta); |
| 2162 Token token = _precedingComment; | 2186 Token token = _precedingComment; |
| 2163 while (token != null) { | 2187 while (token != null) { |
| 2164 token.applyDelta(delta); | 2188 token.applyDelta(delta); |
| 2165 token = token.next; | 2189 token = token.next; |
| 2166 } | 2190 } |
| 2167 } | 2191 } |
| 2168 } | 2192 } |
| 2169 | 2193 |
| 2170 /** | 2194 /** |
| 2171 * Instances of the class `KeywordToken` represent a keyword in the language. | 2195 * Instances of the class `KeywordToken` represent a keyword in the language. |
| 2172 */ | 2196 */ |
| 2173 class KeywordToken extends Token { | 2197 class KeywordToken extends Token { |
| 2174 /** | 2198 /** |
| 2175 * The keyword being represented by this token. | 2199 * The keyword being represented by this token. |
| 2176 */ | 2200 */ |
| 2177 final Keyword keyword; | 2201 final Keyword keyword; |
| 2178 | 2202 |
| 2179 /** | 2203 /** |
| 2180 * Initialize a newly created token to represent the given keyword. | 2204 * Initialize a newly created token to represent the given keyword. |
| 2181 * | 2205 * |
| 2182 * @param keyword the keyword being represented by this token | 2206 * @param keyword the keyword being represented by this token |
| 2183 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 2207 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 2184 */ | 2208 */ |
| 2185 KeywordToken(this.keyword, int offset) : super(TokenType.KEYWORD, offset); | 2209 KeywordToken(this.keyword, int offset) : super(TokenType.KEYWORD, offset); |
| 2186 | 2210 |
| 2211 @override |
| 2187 Token copy() => new KeywordToken(keyword, offset); | 2212 Token copy() => new KeywordToken(keyword, offset); |
| 2188 | 2213 |
| 2214 @override |
| 2189 String get lexeme => keyword.syntax; | 2215 String get lexeme => keyword.syntax; |
| 2190 | 2216 |
| 2217 @override |
| 2191 Keyword value() => keyword; | 2218 Keyword value() => keyword; |
| 2192 } | 2219 } |
| 2193 | 2220 |
| 2194 /** | 2221 /** |
| 2195 * Instances of the class `BeginToken` represent the opening half of a grouping
pair of | 2222 * Instances of the class `BeginToken` represent the opening half of a grouping
pair of |
| 2196 * tokens. This is used for curly brackets ('{'), parentheses ('('), and square
brackets ('['). | 2223 * tokens. This is used for curly brackets ('{'), parentheses ('('), and square
brackets ('['). |
| 2197 */ | 2224 */ |
| 2198 class BeginToken extends Token { | 2225 class BeginToken extends Token { |
| 2199 /** | 2226 /** |
| 2200 * The token that corresponds to this token. | 2227 * The token that corresponds to this token. |
| 2201 */ | 2228 */ |
| 2202 Token endToken; | 2229 Token endToken; |
| 2203 | 2230 |
| 2204 /** | 2231 /** |
| 2205 * Initialize a newly created token representing the opening half of a groupin
g pair of tokens. | 2232 * Initialize a newly created token representing the opening half of a groupin
g pair of tokens. |
| 2206 * | 2233 * |
| 2207 * @param type the type of the token | 2234 * @param type the type of the token |
| 2208 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 2235 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 2209 */ | 2236 */ |
| 2210 BeginToken(TokenType type, int offset) : super(type, offset) { | 2237 BeginToken(TokenType type, int offset) : super(type, offset) { |
| 2211 assert((identical(type, TokenType.OPEN_CURLY_BRACKET) || identical(type, Tok
enType.OPEN_PAREN) || identical(type, TokenType.OPEN_SQUARE_BRACKET) || identica
l(type, TokenType.STRING_INTERPOLATION_EXPRESSION))); | 2238 assert((identical(type, TokenType.OPEN_CURLY_BRACKET) || identical(type, Tok
enType.OPEN_PAREN) || identical(type, TokenType.OPEN_SQUARE_BRACKET) || identica
l(type, TokenType.STRING_INTERPOLATION_EXPRESSION))); |
| 2212 } | 2239 } |
| 2213 | 2240 |
| 2241 @override |
| 2214 Token copy() => new BeginToken(type, offset); | 2242 Token copy() => new BeginToken(type, offset); |
| 2215 } | 2243 } |
| 2216 | 2244 |
| 2217 /** | 2245 /** |
| 2218 * The enumeration `TokenClass` represents classes (or groups) of tokens with a
similar use. | 2246 * The enumeration `TokenClass` represents classes (or groups) of tokens with a
similar use. |
| 2219 */ | 2247 */ |
| 2220 class TokenClass extends Enum<TokenClass> { | 2248 class TokenClass extends Enum<TokenClass> { |
| 2221 /** | 2249 /** |
| 2222 * A value used to indicate that the token type is not part of any specific cl
ass of token. | 2250 * A value used to indicate that the token type is not part of any specific cl
ass of token. |
| 2223 */ | 2251 */ |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2352 * comments reachable from the given comment. | 2380 * comments reachable from the given comment. |
| 2353 * | 2381 * |
| 2354 * @param keyword the keyword being represented by this token | 2382 * @param keyword the keyword being represented by this token |
| 2355 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 2383 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 2356 * @param precedingComment the first comment in the list of comments that prec
ede this token | 2384 * @param precedingComment the first comment in the list of comments that prec
ede this token |
| 2357 */ | 2385 */ |
| 2358 KeywordTokenWithComment(Keyword keyword, int offset, Token precedingComment) :
super(keyword, offset) { | 2386 KeywordTokenWithComment(Keyword keyword, int offset, Token precedingComment) :
super(keyword, offset) { |
| 2359 this._precedingComment = precedingComment; | 2387 this._precedingComment = precedingComment; |
| 2360 } | 2388 } |
| 2361 | 2389 |
| 2390 @override |
| 2362 Token copy() => new KeywordTokenWithComment(keyword, offset, copyComments(_pre
cedingComment)); | 2391 Token copy() => new KeywordTokenWithComment(keyword, offset, copyComments(_pre
cedingComment)); |
| 2363 | 2392 |
| 2393 @override |
| 2364 Token get precedingComments => _precedingComment; | 2394 Token get precedingComments => _precedingComment; |
| 2365 | 2395 |
| 2396 @override |
| 2366 void applyDelta(int delta) { | 2397 void applyDelta(int delta) { |
| 2367 super.applyDelta(delta); | 2398 super.applyDelta(delta); |
| 2368 Token token = _precedingComment; | 2399 Token token = _precedingComment; |
| 2369 while (token != null) { | 2400 while (token != null) { |
| 2370 token.applyDelta(delta); | 2401 token.applyDelta(delta); |
| 2371 token = token.next; | 2402 token = token.next; |
| 2372 } | 2403 } |
| 2373 } | 2404 } |
| 2374 } | 2405 } |
| 2375 | 2406 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2708 * Return `true` if this token type represents an operator that can be defined
by users. | 2739 * Return `true` if this token type represents an operator that can be defined
by users. |
| 2709 * | 2740 * |
| 2710 * @return `true` if this token type represents an operator that can be define
d by users | 2741 * @return `true` if this token type represents an operator that can be define
d by users |
| 2711 */ | 2742 */ |
| 2712 bool get isUserDefinableOperator => identical(_lexeme, "==") || identical(_lex
eme, "~") || identical(_lexeme, "[]") || identical(_lexeme, "[]=") || identical(
_lexeme, "*") || identical(_lexeme, "/") || identical(_lexeme, "%") || identical
(_lexeme, "~/") || identical(_lexeme, "+") || identical(_lexeme, "-") || identic
al(_lexeme, "<<") || identical(_lexeme, ">>") || identical(_lexeme, ">=") || ide
ntical(_lexeme, ">") || identical(_lexeme, "<=") || identical(_lexeme, "<") || i
dentical(_lexeme, "&") || identical(_lexeme, "^") || identical(_lexeme, "|"); | 2743 bool get isUserDefinableOperator => identical(_lexeme, "==") || identical(_lex
eme, "~") || identical(_lexeme, "[]") || identical(_lexeme, "[]=") || identical(
_lexeme, "*") || identical(_lexeme, "/") || identical(_lexeme, "%") || identical
(_lexeme, "~/") || identical(_lexeme, "+") || identical(_lexeme, "-") || identic
al(_lexeme, "<<") || identical(_lexeme, ">>") || identical(_lexeme, ">=") || ide
ntical(_lexeme, ">") || identical(_lexeme, "<=") || identical(_lexeme, "<") || i
dentical(_lexeme, "&") || identical(_lexeme, "^") || identical(_lexeme, "|"); |
| 2713 } | 2744 } |
| 2714 | 2745 |
| 2715 class TokenType_EOF extends TokenType { | 2746 class TokenType_EOF extends TokenType { |
| 2716 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.
con2(name, ordinal, arg0, arg1); | 2747 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.
con2(name, ordinal, arg0, arg1); |
| 2717 | 2748 |
| 2749 @override |
| 2718 String toString() => "-eof-"; | 2750 String toString() => "-eof-"; |
| 2719 } | 2751 } |
| OLD | NEW |