| 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'; |
| 11 import 'java_core.dart'; | 11 import 'java_core.dart'; |
| 12 import 'java_engine.dart'; | 12 import 'java_engine.dart'; |
| 13 import 'source.dart'; | 13 import 'source.dart'; |
| 14 import 'error.dart'; | 14 import 'error.dart'; |
| 15 import 'instrumentation.dart'; | 15 import 'instrumentation.dart'; |
| 16 import 'utilities_collection.dart' show TokenMap; | 16 import 'utilities_collection.dart' show TokenMap; |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * Instances of the abstract class `KeywordState` represent a state in a state m
achine used to | 19 * Instances of the abstract class `KeywordState` represent a state in a state m
achine used to |
| 20 * scan keywords. | 20 * scan keywords. |
| 21 * | |
| 22 * @coverage dart.engine.parser | |
| 23 */ | 21 */ |
| 24 class KeywordState { | 22 class KeywordState { |
| 25 /** | 23 /** |
| 26 * An empty transition table used by leaf states. | 24 * An empty transition table used by leaf states. |
| 27 */ | 25 */ |
| 28 static List<KeywordState> _EMPTY_TABLE = new List<KeywordState>(26); | 26 static List<KeywordState> _EMPTY_TABLE = new List<KeywordState>(26); |
| 29 | 27 |
| 30 /** | 28 /** |
| 31 * The initial state in the state machine. | 29 * The initial state in the state machine. |
| 32 */ | 30 */ |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 * | 131 * |
| 134 * @param c the character used to transition from this state to another state | 132 * @param c the character used to transition from this state to another state |
| 135 * @return the state that follows this state on a transition of the given char
acter | 133 * @return the state that follows this state on a transition of the given char
acter |
| 136 */ | 134 */ |
| 137 KeywordState next(int c) => _table[c - 0x61]; | 135 KeywordState next(int c) => _table[c - 0x61]; |
| 138 } | 136 } |
| 139 | 137 |
| 140 /** | 138 /** |
| 141 * The enumeration `ScannerErrorCode` defines the error codes used for errors de
tected by the | 139 * The enumeration `ScannerErrorCode` defines the error codes used for errors de
tected by the |
| 142 * scanner. | 140 * scanner. |
| 143 * | |
| 144 * @coverage dart.engine.parser | |
| 145 */ | 141 */ |
| 146 class ScannerErrorCode extends Enum<ScannerErrorCode> implements ErrorCode { | 142 class ScannerErrorCode extends Enum<ScannerErrorCode> implements ErrorCode { |
| 147 static final ScannerErrorCode ILLEGAL_CHARACTER = new ScannerErrorCode.con1('I
LLEGAL_CHARACTER', 0, "Illegal character %x"); | 143 static final ScannerErrorCode ILLEGAL_CHARACTER = new ScannerErrorCode.con1('I
LLEGAL_CHARACTER', 0, "Illegal character %x"); |
| 148 | 144 |
| 149 static final ScannerErrorCode MISSING_DIGIT = new ScannerErrorCode.con1('MISSI
NG_DIGIT', 1, "Decimal digit expected"); | 145 static final ScannerErrorCode MISSING_DIGIT = new ScannerErrorCode.con1('MISSI
NG_DIGIT', 1, "Decimal digit expected"); |
| 150 | 146 |
| 151 static final ScannerErrorCode MISSING_HEX_DIGIT = new ScannerErrorCode.con1('M
ISSING_HEX_DIGIT', 2, "Hexidecimal digit expected"); | 147 static final ScannerErrorCode MISSING_HEX_DIGIT = new ScannerErrorCode.con1('M
ISSING_HEX_DIGIT', 2, "Hexidecimal digit expected"); |
| 152 | 148 |
| 153 static final ScannerErrorCode MISSING_QUOTE = new ScannerErrorCode.con1('MISSI
NG_QUOTE', 3, "Expected quote (' or \")"); | 149 static final ScannerErrorCode MISSING_QUOTE = new ScannerErrorCode.con1('MISSI
NG_QUOTE', 3, "Expected quote (' or \")"); |
| 154 | 150 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 String getString(int start, int endDelta) => super.getString(start - _offsetDe
lta, endDelta); | 222 String getString(int start, int endDelta) => super.getString(start - _offsetDe
lta, endDelta); |
| 227 | 223 |
| 228 void set offset(int offset) { | 224 void set offset(int offset) { |
| 229 super.offset = offset - _offsetDelta; | 225 super.offset = offset - _offsetDelta; |
| 230 } | 226 } |
| 231 } | 227 } |
| 232 | 228 |
| 233 /** | 229 /** |
| 234 * Instances of the class `TokenWithComment` represent a string token that is pr
eceded by | 230 * Instances of the class `TokenWithComment` represent a string token that is pr
eceded by |
| 235 * comments. | 231 * comments. |
| 236 * | |
| 237 * @coverage dart.engine.parser | |
| 238 */ | 232 */ |
| 239 class StringTokenWithComment extends StringToken { | 233 class StringTokenWithComment extends StringToken { |
| 240 /** | 234 /** |
| 241 * The first comment in the list of comments that precede this token. | 235 * The first comment in the list of comments that precede this token. |
| 242 */ | 236 */ |
| 243 Token _precedingComment; | 237 Token _precedingComment; |
| 244 | 238 |
| 245 /** | 239 /** |
| 246 * Initialize a newly created token to have the given type and offset and to b
e preceded by the | 240 * Initialize a newly created token to have the given type and offset and to b
e preceded by the |
| 247 * comments reachable from the given comment. | 241 * comments reachable from the given comment. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 263 Token token = _precedingComment; | 257 Token token = _precedingComment; |
| 264 while (token != null) { | 258 while (token != null) { |
| 265 token.applyDelta(delta); | 259 token.applyDelta(delta); |
| 266 token = token.next; | 260 token = token.next; |
| 267 } | 261 } |
| 268 } | 262 } |
| 269 } | 263 } |
| 270 | 264 |
| 271 /** | 265 /** |
| 272 * The enumeration `Keyword` defines the keywords in the Dart programming langua
ge. | 266 * The enumeration `Keyword` defines the keywords in the Dart programming langua
ge. |
| 273 * | |
| 274 * @coverage dart.engine.parser | |
| 275 */ | 267 */ |
| 276 class Keyword extends Enum<Keyword> { | 268 class Keyword extends Enum<Keyword> { |
| 277 static final Keyword ASSERT = new Keyword.con1('ASSERT', 0, "assert"); | 269 static final Keyword ASSERT = new Keyword.con1('ASSERT', 0, "assert"); |
| 278 | 270 |
| 279 static final Keyword BREAK = new Keyword.con1('BREAK', 1, "break"); | 271 static final Keyword BREAK = new Keyword.con1('BREAK', 1, "break"); |
| 280 | 272 |
| 281 static final Keyword CASE = new Keyword.con1('CASE', 2, "case"); | 273 static final Keyword CASE = new Keyword.con1('CASE', 2, "case"); |
| 282 | 274 |
| 283 static final Keyword CATCH = new Keyword.con1('CATCH', 3, "catch"); | 275 static final Keyword CATCH = new Keyword.con1('CATCH', 3, "catch"); |
| 284 | 276 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 return _sequence.codeUnitAt(_charOffset + 1); | 526 return _sequence.codeUnitAt(_charOffset + 1); |
| 535 } | 527 } |
| 536 | 528 |
| 537 void set offset(int offset) { | 529 void set offset(int offset) { |
| 538 _charOffset = offset; | 530 _charOffset = offset; |
| 539 } | 531 } |
| 540 } | 532 } |
| 541 | 533 |
| 542 /** | 534 /** |
| 543 * Synthetic `StringToken` represent a token whose value is independent of it's
type. | 535 * Synthetic `StringToken` represent a token whose value is independent of it's
type. |
| 544 * | |
| 545 * @coverage dart.engine.parser | |
| 546 */ | 536 */ |
| 547 class SyntheticStringToken extends StringToken { | 537 class SyntheticStringToken extends StringToken { |
| 548 /** | 538 /** |
| 549 * Initialize a newly created token to represent a token of the given type wit
h the given value. | 539 * Initialize a newly created token to represent a token of the given type wit
h the given value. |
| 550 * | 540 * |
| 551 * @param type the type of the token | 541 * @param type the type of the token |
| 552 * @param value the lexeme represented by this token | 542 * @param value the lexeme represented by this token |
| 553 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 543 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 554 */ | 544 */ |
| 555 SyntheticStringToken(TokenType type, String value, int offset) : super(type, v
alue, offset); | 545 SyntheticStringToken(TokenType type, String value, int offset) : super(type, v
alue, offset); |
| 556 | 546 |
| 557 bool get isSynthetic => true; | 547 bool get isSynthetic => true; |
| 558 } | 548 } |
| 559 | 549 |
| 560 /** | 550 /** |
| 561 * Instances of the class `IncrementalScanner` implement a scanner that scans a
subset of a | 551 * Instances of the class `IncrementalScanner` implement a scanner that scans a
subset of a |
| 562 * string and inserts the resulting tokens into the middle of an existing token
stream. | 552 * string and inserts the resulting tokens into the middle of an existing token
stream. |
| 563 * | |
| 564 * @coverage dart.engine.parser | |
| 565 */ | 553 */ |
| 566 class IncrementalScanner extends Scanner { | 554 class IncrementalScanner extends Scanner { |
| 567 /** | 555 /** |
| 568 * The reader used to access the characters in the source. | 556 * The reader used to access the characters in the source. |
| 569 */ | 557 */ |
| 570 CharacterReader _reader; | 558 CharacterReader _reader; |
| 571 | 559 |
| 572 /** | 560 /** |
| 573 * A map from tokens that were copied to the copies of the tokens. | 561 * A map from tokens that were copied to the copies of the tokens. |
| 574 */ | 562 */ |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 } | 768 } |
| 781 | 769 |
| 782 /** | 770 /** |
| 783 * The class `Scanner` implements a scanner for Dart code. | 771 * The class `Scanner` implements a scanner for Dart code. |
| 784 * | 772 * |
| 785 * The lexical structure of Dart is ambiguous without knowledge of the context i
n which a token is | 773 * The lexical structure of Dart is ambiguous without knowledge of the context i
n which a token is |
| 786 * being scanned. For example, without context we cannot determine whether sourc
e of the form "<<" | 774 * being scanned. For example, without context we cannot determine whether sourc
e of the form "<<" |
| 787 * should be scanned as a single left-shift operator or as two left angle bracke
ts. This scanner | 775 * should be scanned as a single left-shift operator or as two left angle bracke
ts. This scanner |
| 788 * does not have any context, so it always resolves such conflicts by scanning t
he longest possible | 776 * does not have any context, so it always resolves such conflicts by scanning t
he longest possible |
| 789 * token. | 777 * token. |
| 790 * | |
| 791 * @coverage dart.engine.parser | |
| 792 */ | 778 */ |
| 793 class Scanner { | 779 class Scanner { |
| 794 /** | 780 /** |
| 795 * The source being scanned. | 781 * The source being scanned. |
| 796 */ | 782 */ |
| 797 final Source source; | 783 final Source source; |
| 798 | 784 |
| 799 /** | 785 /** |
| 800 * The reader used to access the characters in the source. | 786 * The reader used to access the characters in the source. |
| 801 */ | 787 */ |
| (...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1854 } else { | 1840 } else { |
| 1855 appendToken2(TokenType.TILDE); | 1841 appendToken2(TokenType.TILDE); |
| 1856 return next; | 1842 return next; |
| 1857 } | 1843 } |
| 1858 } | 1844 } |
| 1859 } | 1845 } |
| 1860 | 1846 |
| 1861 /** | 1847 /** |
| 1862 * Instances of the class `StringToken` represent a token whose value is indepen
dent of it's | 1848 * Instances of the class `StringToken` represent a token whose value is indepen
dent of it's |
| 1863 * type. | 1849 * type. |
| 1864 * | |
| 1865 * @coverage dart.engine.parser | |
| 1866 */ | 1850 */ |
| 1867 class StringToken extends Token { | 1851 class StringToken extends Token { |
| 1868 /** | 1852 /** |
| 1869 * The lexeme represented by this token. | 1853 * The lexeme represented by this token. |
| 1870 */ | 1854 */ |
| 1871 String _value2; | 1855 String _value2; |
| 1872 | 1856 |
| 1873 /** | 1857 /** |
| 1874 * Initialize a newly created token to represent a token of the given type wit
h the given value. | 1858 * Initialize a newly created token to represent a token of the given type wit
h the given value. |
| 1875 * | 1859 * |
| 1876 * @param type the type of the token | 1860 * @param type the type of the token |
| 1877 * @param value the lexeme represented by this token | 1861 * @param value the lexeme represented by this token |
| 1878 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 1862 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 1879 */ | 1863 */ |
| 1880 StringToken(TokenType type, String value, int offset) : super(type, offset) { | 1864 StringToken(TokenType type, String value, int offset) : super(type, offset) { |
| 1881 this._value2 = StringUtilities.intern(value); | 1865 this._value2 = StringUtilities.intern(value); |
| 1882 } | 1866 } |
| 1883 | 1867 |
| 1884 Token copy() => new StringToken(type, _value2, offset); | 1868 Token copy() => new StringToken(type, _value2, offset); |
| 1885 | 1869 |
| 1886 String get lexeme => _value2; | 1870 String get lexeme => _value2; |
| 1887 | 1871 |
| 1888 String value() => _value2; | 1872 String value() => _value2; |
| 1889 } | 1873 } |
| 1890 | 1874 |
| 1891 /** | 1875 /** |
| 1892 * Instances of the class `TokenWithComment` represent a normal token that is pr
eceded by | 1876 * Instances of the class `TokenWithComment` represent a normal token that is pr
eceded by |
| 1893 * comments. | 1877 * comments. |
| 1894 * | |
| 1895 * @coverage dart.engine.parser | |
| 1896 */ | 1878 */ |
| 1897 class TokenWithComment extends Token { | 1879 class TokenWithComment extends Token { |
| 1898 /** | 1880 /** |
| 1899 * The first comment in the list of comments that precede this token. | 1881 * The first comment in the list of comments that precede this token. |
| 1900 */ | 1882 */ |
| 1901 Token _precedingComment; | 1883 Token _precedingComment; |
| 1902 | 1884 |
| 1903 /** | 1885 /** |
| 1904 * Initialize a newly created token to have the given type and offset and to b
e preceded by the | 1886 * Initialize a newly created token to have the given type and offset and to b
e preceded by the |
| 1905 * comments reachable from the given comment. | 1887 * comments reachable from the given comment. |
| 1906 * | 1888 * |
| 1907 * @param type the type of the token | 1889 * @param type the type of the token |
| 1908 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 1890 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 1909 * @param precedingComment the first comment in the list of comments that prec
ede this token | 1891 * @param precedingComment the first comment in the list of comments that prec
ede this token |
| 1910 */ | 1892 */ |
| 1911 TokenWithComment(TokenType type, int offset, Token precedingComment) : super(t
ype, offset) { | 1893 TokenWithComment(TokenType type, int offset, Token precedingComment) : super(t
ype, offset) { |
| 1912 this._precedingComment = precedingComment; | 1894 this._precedingComment = precedingComment; |
| 1913 } | 1895 } |
| 1914 | 1896 |
| 1915 Token copy() => new TokenWithComment(type, offset, _precedingComment); | 1897 Token copy() => new TokenWithComment(type, offset, _precedingComment); |
| 1916 | 1898 |
| 1917 Token get precedingComments => _precedingComment; | 1899 Token get precedingComments => _precedingComment; |
| 1918 } | 1900 } |
| 1919 | 1901 |
| 1920 /** | 1902 /** |
| 1921 * Instances of the class `Token` represent a token that was scanned from the in
put. Each | 1903 * Instances of the class `Token` represent a token that was scanned from the in
put. Each |
| 1922 * token knows which token follows it, acting as the head of a linked list of to
kens. | 1904 * token knows which token follows it, acting as the head of a linked list of to
kens. |
| 1923 * | |
| 1924 * @coverage dart.engine.parser | |
| 1925 */ | 1905 */ |
| 1926 class Token { | 1906 class Token { |
| 1927 /** | 1907 /** |
| 1928 * The type of the token. | 1908 * The type of the token. |
| 1929 */ | 1909 */ |
| 1930 final TokenType type; | 1910 final TokenType type; |
| 1931 | 1911 |
| 1932 /** | 1912 /** |
| 1933 * The offset from the beginning of the file to the first character in the tok
en. | 1913 * The offset from the beginning of the file to the first character in the tok
en. |
| 1934 */ | 1914 */ |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2132 * the initial offset and one (1) past the end of the source code. | 2112 * the initial offset and one (1) past the end of the source code. |
| 2133 * | 2113 * |
| 2134 * @param offset the new offset in the source | 2114 * @param offset the new offset in the source |
| 2135 */ | 2115 */ |
| 2136 void set offset(int offset); | 2116 void set offset(int offset); |
| 2137 } | 2117 } |
| 2138 | 2118 |
| 2139 /** | 2119 /** |
| 2140 * Instances of the class `BeginTokenWithComment` represent a begin token that i
s preceded by | 2120 * Instances of the class `BeginTokenWithComment` represent a begin token that i
s preceded by |
| 2141 * comments. | 2121 * comments. |
| 2142 * | |
| 2143 * @coverage dart.engine.parser | |
| 2144 */ | 2122 */ |
| 2145 class BeginTokenWithComment extends BeginToken { | 2123 class BeginTokenWithComment extends BeginToken { |
| 2146 /** | 2124 /** |
| 2147 * The first comment in the list of comments that precede this token. | 2125 * The first comment in the list of comments that precede this token. |
| 2148 */ | 2126 */ |
| 2149 Token _precedingComment; | 2127 Token _precedingComment; |
| 2150 | 2128 |
| 2151 /** | 2129 /** |
| 2152 * Initialize a newly created token to have the given type and offset and to b
e preceded by the | 2130 * Initialize a newly created token to have the given type and offset and to b
e preceded by the |
| 2153 * comments reachable from the given comment. | 2131 * comments reachable from the given comment. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2169 Token token = _precedingComment; | 2147 Token token = _precedingComment; |
| 2170 while (token != null) { | 2148 while (token != null) { |
| 2171 token.applyDelta(delta); | 2149 token.applyDelta(delta); |
| 2172 token = token.next; | 2150 token = token.next; |
| 2173 } | 2151 } |
| 2174 } | 2152 } |
| 2175 } | 2153 } |
| 2176 | 2154 |
| 2177 /** | 2155 /** |
| 2178 * Instances of the class `KeywordToken` represent a keyword in the language. | 2156 * Instances of the class `KeywordToken` represent a keyword in the language. |
| 2179 * | |
| 2180 * @coverage dart.engine.parser | |
| 2181 */ | 2157 */ |
| 2182 class KeywordToken extends Token { | 2158 class KeywordToken extends Token { |
| 2183 /** | 2159 /** |
| 2184 * The keyword being represented by this token. | 2160 * The keyword being represented by this token. |
| 2185 */ | 2161 */ |
| 2186 final Keyword keyword; | 2162 final Keyword keyword; |
| 2187 | 2163 |
| 2188 /** | 2164 /** |
| 2189 * Initialize a newly created token to represent the given keyword. | 2165 * Initialize a newly created token to represent the given keyword. |
| 2190 * | 2166 * |
| 2191 * @param keyword the keyword being represented by this token | 2167 * @param keyword the keyword being represented by this token |
| 2192 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 2168 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 2193 */ | 2169 */ |
| 2194 KeywordToken(this.keyword, int offset) : super(TokenType.KEYWORD, offset); | 2170 KeywordToken(this.keyword, int offset) : super(TokenType.KEYWORD, offset); |
| 2195 | 2171 |
| 2196 Token copy() => new KeywordToken(keyword, offset); | 2172 Token copy() => new KeywordToken(keyword, offset); |
| 2197 | 2173 |
| 2198 String get lexeme => keyword.syntax; | 2174 String get lexeme => keyword.syntax; |
| 2199 | 2175 |
| 2200 Keyword value() => keyword; | 2176 Keyword value() => keyword; |
| 2201 } | 2177 } |
| 2202 | 2178 |
| 2203 /** | 2179 /** |
| 2204 * Instances of the class `BeginToken` represent the opening half of a grouping
pair of | 2180 * Instances of the class `BeginToken` represent the opening half of a grouping
pair of |
| 2205 * tokens. This is used for curly brackets ('{'), parentheses ('('), and square
brackets ('['). | 2181 * tokens. This is used for curly brackets ('{'), parentheses ('('), and square
brackets ('['). |
| 2206 * | |
| 2207 * @coverage dart.engine.parser | |
| 2208 */ | 2182 */ |
| 2209 class BeginToken extends Token { | 2183 class BeginToken extends Token { |
| 2210 /** | 2184 /** |
| 2211 * The token that corresponds to this token. | 2185 * The token that corresponds to this token. |
| 2212 */ | 2186 */ |
| 2213 Token endToken; | 2187 Token endToken; |
| 2214 | 2188 |
| 2215 /** | 2189 /** |
| 2216 * Initialize a newly created token representing the opening half of a groupin
g pair of tokens. | 2190 * Initialize a newly created token representing the opening half of a groupin
g pair of tokens. |
| 2217 * | 2191 * |
| 2218 * @param type the type of the token | 2192 * @param type the type of the token |
| 2219 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 2193 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 2220 */ | 2194 */ |
| 2221 BeginToken(TokenType type, int offset) : super(type, offset) { | 2195 BeginToken(TokenType type, int offset) : super(type, offset) { |
| 2222 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))); | 2196 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))); |
| 2223 } | 2197 } |
| 2224 | 2198 |
| 2225 Token copy() => new BeginToken(type, offset); | 2199 Token copy() => new BeginToken(type, offset); |
| 2226 } | 2200 } |
| 2227 | 2201 |
| 2228 /** | 2202 /** |
| 2229 * The enumeration `TokenClass` represents classes (or groups) of tokens with a
similar use. | 2203 * The enumeration `TokenClass` represents classes (or groups) of tokens with a
similar use. |
| 2230 * | |
| 2231 * @coverage dart.engine.parser | |
| 2232 */ | 2204 */ |
| 2233 class TokenClass extends Enum<TokenClass> { | 2205 class TokenClass extends Enum<TokenClass> { |
| 2234 /** | 2206 /** |
| 2235 * A value used to indicate that the token type is not part of any specific cl
ass of token. | 2207 * A value used to indicate that the token type is not part of any specific cl
ass of token. |
| 2236 */ | 2208 */ |
| 2237 static final TokenClass NO_CLASS = new TokenClass.con1('NO_CLASS', 0); | 2209 static final TokenClass NO_CLASS = new TokenClass.con1('NO_CLASS', 0); |
| 2238 | 2210 |
| 2239 /** | 2211 /** |
| 2240 * A value used to indicate that the token type is an additive operator. | 2212 * A value used to indicate that the token type is an additive operator. |
| 2241 */ | 2213 */ |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2346 * an operator. | 2318 * an operator. |
| 2347 * | 2319 * |
| 2348 * @return the precedence of tokens of this class | 2320 * @return the precedence of tokens of this class |
| 2349 */ | 2321 */ |
| 2350 int get precedence => _precedence; | 2322 int get precedence => _precedence; |
| 2351 } | 2323 } |
| 2352 | 2324 |
| 2353 /** | 2325 /** |
| 2354 * Instances of the class `KeywordTokenWithComment` implement a keyword token th
at is preceded | 2326 * Instances of the class `KeywordTokenWithComment` implement a keyword token th
at is preceded |
| 2355 * by comments. | 2327 * by comments. |
| 2356 * | |
| 2357 * @coverage dart.engine.parser | |
| 2358 */ | 2328 */ |
| 2359 class KeywordTokenWithComment extends KeywordToken { | 2329 class KeywordTokenWithComment extends KeywordToken { |
| 2360 /** | 2330 /** |
| 2361 * The first comment in the list of comments that precede this token. | 2331 * The first comment in the list of comments that precede this token. |
| 2362 */ | 2332 */ |
| 2363 Token _precedingComment; | 2333 Token _precedingComment; |
| 2364 | 2334 |
| 2365 /** | 2335 /** |
| 2366 * Initialize a newly created token to to represent the given keyword and to b
e preceded by the | 2336 * Initialize a newly created token to to represent the given keyword and to b
e preceded by the |
| 2367 * comments reachable from the given comment. | 2337 * comments reachable from the given comment. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2384 while (token != null) { | 2354 while (token != null) { |
| 2385 token.applyDelta(delta); | 2355 token.applyDelta(delta); |
| 2386 token = token.next; | 2356 token = token.next; |
| 2387 } | 2357 } |
| 2388 } | 2358 } |
| 2389 } | 2359 } |
| 2390 | 2360 |
| 2391 /** | 2361 /** |
| 2392 * The enumeration `TokenType` defines the types of tokens that can be returned
by the | 2362 * The enumeration `TokenType` defines the types of tokens that can be returned
by the |
| 2393 * scanner. | 2363 * scanner. |
| 2394 * | |
| 2395 * @coverage dart.engine.parser | |
| 2396 */ | 2364 */ |
| 2397 class TokenType extends Enum<TokenType> { | 2365 class TokenType extends Enum<TokenType> { |
| 2398 /** | 2366 /** |
| 2399 * The type of the token that marks the end of the input. | 2367 * The type of the token that marks the end of the input. |
| 2400 */ | 2368 */ |
| 2401 static final TokenType EOF = new TokenType_EOF('EOF', 0, null, ""); | 2369 static final TokenType EOF = new TokenType_EOF('EOF', 0, null, ""); |
| 2402 | 2370 |
| 2403 static final TokenType DOUBLE = new TokenType.con1('DOUBLE', 1); | 2371 static final TokenType DOUBLE = new TokenType.con1('DOUBLE', 1); |
| 2404 | 2372 |
| 2405 static final TokenType HEXADECIMAL = new TokenType.con1('HEXADECIMAL', 2); | 2373 static final TokenType HEXADECIMAL = new TokenType.con1('HEXADECIMAL', 2); |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2727 * @return `true` if this token type represents an operator that can be define
d by users | 2695 * @return `true` if this token type represents an operator that can be define
d by users |
| 2728 */ | 2696 */ |
| 2729 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, "|"); | 2697 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, "|"); |
| 2730 } | 2698 } |
| 2731 | 2699 |
| 2732 class TokenType_EOF extends TokenType { | 2700 class TokenType_EOF extends TokenType { |
| 2733 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.
con2(name, ordinal, arg0, arg1); | 2701 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.
con2(name, ordinal, arg0, arg1); |
| 2734 | 2702 |
| 2735 String toString() => "-eof-"; | 2703 String toString() => "-eof-"; |
| 2736 } | 2704 } |
| OLD | NEW |