| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 ILLEGAL_CHARACTER, | 156 ILLEGAL_CHARACTER, |
| 157 MISSING_DIGIT, | 157 MISSING_DIGIT, |
| 158 MISSING_HEX_DIGIT, | 158 MISSING_HEX_DIGIT, |
| 159 MISSING_QUOTE, | 159 MISSING_QUOTE, |
| 160 UNTERMINATED_MULTI_LINE_COMMENT, | 160 UNTERMINATED_MULTI_LINE_COMMENT, |
| 161 UNTERMINATED_STRING_LITERAL]; | 161 UNTERMINATED_STRING_LITERAL]; |
| 162 | 162 |
| 163 /** | 163 /** |
| 164 * The template used to create the message to be displayed for this error. | 164 * The template used to create the message to be displayed for this error. |
| 165 */ | 165 */ |
| 166 final String message; | 166 String message; |
| 167 | 167 |
| 168 /** | 168 /** |
| 169 * The template used to create the correction to be displayed for this error,
or `null` if | 169 * The template used to create the correction to be displayed for this error,
or `null` if |
| 170 * there is no correction information for this error. | 170 * there is no correction information for this error. |
| 171 */ | 171 */ |
| 172 String correction10; | 172 String correction10; |
| 173 | 173 |
| 174 /** | 174 /** |
| 175 * Initialize a newly created error code to have the given message. | 175 * Initialize a newly created error code to have the given message. |
| 176 * | 176 * |
| 177 * @param message the message template used to create the message to be displa
yed for this error | 177 * @param message the message template used to create the message to be displa
yed for this error |
| 178 */ | 178 */ |
| 179 ScannerErrorCode.con1(String name, int ordinal, this.message) : super(name, or
dinal); | 179 ScannerErrorCode.con1(String name, int ordinal, String message) : super(name,
ordinal) { |
| 180 this.message = message; |
| 181 } |
| 180 | 182 |
| 181 /** | 183 /** |
| 182 * Initialize a newly created error code to have the given message and correct
ion. | 184 * Initialize a newly created error code to have the given message and correct
ion. |
| 183 * | 185 * |
| 184 * @param message the template used to create the message to be displayed for
the error | 186 * @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 | 187 * @param correction the template used to create the correction to be displaye
d for the error |
| 186 */ | 188 */ |
| 187 ScannerErrorCode.con2(String name, int ordinal, this.message, String correctio
n) : super(name, ordinal) { | 189 ScannerErrorCode.con2(String name, int ordinal, String message, String correct
ion) : super(name, ordinal) { |
| 190 this.message = message; |
| 188 this.correction10 = correction; | 191 this.correction10 = correction; |
| 189 } | 192 } |
| 190 | 193 |
| 191 @override | 194 @override |
| 192 String get correction => correction10; | 195 String get correction => correction10; |
| 193 | 196 |
| 194 @override | 197 @override |
| 195 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; | 198 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; |
| 196 | 199 |
| 197 @override | 200 @override |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 * The lexical structure of Dart is ambiguous without knowledge of the context i
n which a token is | 791 * The lexical structure of Dart is ambiguous without knowledge of the context i
n which a token is |
| 789 * being scanned. For example, without context we cannot determine whether sourc
e of the form "<<" | 792 * being scanned. For example, without context we cannot determine whether sourc
e of the form "<<" |
| 790 * should be scanned as a single left-shift operator or as two left angle bracke
ts. This scanner | 793 * should be scanned as a single left-shift operator or as two left angle bracke
ts. This scanner |
| 791 * does not have any context, so it always resolves such conflicts by scanning t
he longest possible | 794 * does not have any context, so it always resolves such conflicts by scanning t
he longest possible |
| 792 * token. | 795 * token. |
| 793 */ | 796 */ |
| 794 class Scanner { | 797 class Scanner { |
| 795 /** | 798 /** |
| 796 * The source being scanned. | 799 * The source being scanned. |
| 797 */ | 800 */ |
| 798 final Source source; | 801 Source source; |
| 799 | 802 |
| 800 /** | 803 /** |
| 801 * The reader used to access the characters in the source. | 804 * The reader used to access the characters in the source. |
| 802 */ | 805 */ |
| 803 CharacterReader _reader; | 806 CharacterReader _reader; |
| 804 | 807 |
| 805 /** | 808 /** |
| 806 * The error listener that will be informed of any errors that are found durin
g the scan. | 809 * The error listener that will be informed of any errors that are found durin
g the scan. |
| 807 */ | 810 */ |
| 808 AnalysisErrorListener _errorListener; | 811 AnalysisErrorListener _errorListener; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 */ | 861 */ |
| 859 bool _hasUnmatchedGroups = false; | 862 bool _hasUnmatchedGroups = false; |
| 860 | 863 |
| 861 /** | 864 /** |
| 862 * Initialize a newly created scanner. | 865 * Initialize a newly created scanner. |
| 863 * | 866 * |
| 864 * @param source the source being scanned | 867 * @param source the source being scanned |
| 865 * @param reader the character reader used to read the characters in the sourc
e | 868 * @param reader the character reader used to read the characters in the sourc
e |
| 866 * @param errorListener the error listener that will be informed of any errors
that are found | 869 * @param errorListener the error listener that will be informed of any errors
that are found |
| 867 */ | 870 */ |
| 868 Scanner(this.source, CharacterReader reader, AnalysisErrorListener errorListen
er) { | 871 Scanner(Source source, CharacterReader reader, AnalysisErrorListener errorList
ener) { |
| 872 this.source = source; |
| 869 this._reader = reader; | 873 this._reader = reader; |
| 870 this._errorListener = errorListener; | 874 this._errorListener = errorListener; |
| 871 _tokens = new Token(TokenType.EOF, -1); | 875 _tokens = new Token(TokenType.EOF, -1); |
| 872 _tokens.setNext(_tokens); | 876 _tokens.setNext(_tokens); |
| 873 _tail = _tokens; | 877 _tail = _tokens; |
| 874 _tokenStart = -1; | 878 _tokenStart = -1; |
| 875 _lineStarts.add(0); | 879 _lineStarts.add(0); |
| 876 } | 880 } |
| 877 | 881 |
| 878 /** | 882 /** |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1920 } | 1924 } |
| 1921 | 1925 |
| 1922 /** | 1926 /** |
| 1923 * Instances of the class `Token` represent a token that was scanned from the in
put. Each | 1927 * Instances of the class `Token` represent a token that was scanned from the in
put. Each |
| 1924 * token knows which token follows it, acting as the head of a linked list of to
kens. | 1928 * token knows which token follows it, acting as the head of a linked list of to
kens. |
| 1925 */ | 1929 */ |
| 1926 class Token { | 1930 class Token { |
| 1927 /** | 1931 /** |
| 1928 * The type of the token. | 1932 * The type of the token. |
| 1929 */ | 1933 */ |
| 1930 final TokenType type; | 1934 TokenType type; |
| 1931 | 1935 |
| 1932 /** | 1936 /** |
| 1933 * The offset from the beginning of the file to the first character in the tok
en. | 1937 * The offset from the beginning of the file to the first character in the tok
en. |
| 1934 */ | 1938 */ |
| 1935 int offset = 0; | 1939 int offset = 0; |
| 1936 | 1940 |
| 1937 /** | 1941 /** |
| 1938 * The previous token in the token stream. | 1942 * The previous token in the token stream. |
| 1939 */ | 1943 */ |
| 1940 Token previous; | 1944 Token previous; |
| 1941 | 1945 |
| 1942 /** | 1946 /** |
| 1943 * The next token in the token stream. | 1947 * The next token in the token stream. |
| 1944 */ | 1948 */ |
| 1945 Token _next; | 1949 Token _next; |
| 1946 | 1950 |
| 1947 /** | 1951 /** |
| 1948 * Initialize a newly created token to have the given type and offset. | 1952 * Initialize a newly created token to have the given type and offset. |
| 1949 * | 1953 * |
| 1950 * @param type the type of the token | 1954 * @param type the type of the token |
| 1951 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 1955 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 1952 */ | 1956 */ |
| 1953 Token(this.type, int offset) { | 1957 Token(TokenType type, int offset) { |
| 1958 this.type = type; |
| 1954 this.offset = offset; | 1959 this.offset = offset; |
| 1955 } | 1960 } |
| 1956 | 1961 |
| 1957 /** | 1962 /** |
| 1958 * Return a newly created token that is a copy of this token but that is not a
part of any token | 1963 * Return a newly created token that is a copy of this token but that is not a
part of any token |
| 1959 * stream. | 1964 * stream. |
| 1960 * | 1965 * |
| 1961 * @return a newly created token that is a copy of this token | 1966 * @return a newly created token that is a copy of this token |
| 1962 */ | 1967 */ |
| 1963 Token copy() => new Token(type, offset); | 1968 Token copy() => new Token(type, offset); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2191 } | 2196 } |
| 2192 } | 2197 } |
| 2193 | 2198 |
| 2194 /** | 2199 /** |
| 2195 * Instances of the class `KeywordToken` represent a keyword in the language. | 2200 * Instances of the class `KeywordToken` represent a keyword in the language. |
| 2196 */ | 2201 */ |
| 2197 class KeywordToken extends Token { | 2202 class KeywordToken extends Token { |
| 2198 /** | 2203 /** |
| 2199 * The keyword being represented by this token. | 2204 * The keyword being represented by this token. |
| 2200 */ | 2205 */ |
| 2201 final Keyword keyword; | 2206 Keyword keyword; |
| 2202 | 2207 |
| 2203 /** | 2208 /** |
| 2204 * Initialize a newly created token to represent the given keyword. | 2209 * Initialize a newly created token to represent the given keyword. |
| 2205 * | 2210 * |
| 2206 * @param keyword the keyword being represented by this token | 2211 * @param keyword the keyword being represented by this token |
| 2207 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 2212 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 2208 */ | 2213 */ |
| 2209 KeywordToken(this.keyword, int offset) : super(TokenType.KEYWORD, offset); | 2214 KeywordToken(Keyword keyword, int offset) : super(TokenType.KEYWORD, offset) { |
| 2215 this.keyword = keyword; |
| 2216 } |
| 2210 | 2217 |
| 2211 @override | 2218 @override |
| 2212 Token copy() => new KeywordToken(keyword, offset); | 2219 Token copy() => new KeywordToken(keyword, offset); |
| 2213 | 2220 |
| 2214 @override | 2221 @override |
| 2215 String get lexeme => keyword.syntax; | 2222 String get lexeme => keyword.syntax; |
| 2216 | 2223 |
| 2217 @override | 2224 @override |
| 2218 Keyword value() => keyword; | 2225 Keyword value() => keyword; |
| 2219 } | 2226 } |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2742 */ | 2749 */ |
| 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, "|"); | 2750 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, "|"); |
| 2744 } | 2751 } |
| 2745 | 2752 |
| 2746 class TokenType_EOF extends TokenType { | 2753 class TokenType_EOF extends TokenType { |
| 2747 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.
con2(name, ordinal, arg0, arg1); | 2754 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.
con2(name, ordinal, arg0, arg1); |
| 2748 | 2755 |
| 2749 @override | 2756 @override |
| 2750 String toString() => "-eof-"; | 2757 String toString() => "-eof-"; |
| 2751 } | 2758 } |
| OLD | NEW |