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

Side by Side Diff: pkg/analyzer_experimental/lib/src/generated/scanner.dart

Issue 25373002: Issue 13584. Fix for Java/Dart local variable scoping mismatch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
OLDNEW
1 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 library engine.scanner; 3 library engine.scanner;
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'java_core.dart'; 5 import 'java_core.dart';
6 import 'java_engine.dart'; 6 import 'java_engine.dart';
7 import 'source.dart'; 7 import 'source.dart';
8 import 'error.dart'; 8 import 'error.dart';
9 import 'instrumentation.dart'; 9 import 'instrumentation.dart';
10 /** 10 /**
(...skipping 20 matching lines...) Expand all
31 * All of these strings have a common prefix and the next character is at the given start index. 31 * All of these strings have a common prefix and the next character is at the given start index.
32 * 32 *
33 * @param start the index of the character in the strings used to transition t o a new state 33 * @param start the index of the character in the strings used to transition t o a new state
34 * @param strings an array containing all of the strings that will be recogniz ed by the state 34 * @param strings an array containing all of the strings that will be recogniz ed by the state
35 * machine 35 * machine
36 * @param offset the offset of the first string in the array that has the pref ix that is assumed 36 * @param offset the offset of the first string in the array that has the pref ix that is assumed
37 * to have been recognized by the time we reach the state being built 37 * to have been recognized by the time we reach the state being built
38 * @param length the number of strings in the array that pass through the stat e being built 38 * @param length the number of strings in the array that pass through the stat e being built
39 * @return the state that was created 39 * @return the state that was created
40 */ 40 */
41 static KeywordState computeKeywordStateTable(int start, List<String> strings, int offset, int length2) { 41 static KeywordState computeKeywordStateTable(int start, List<String> strings, int offset, int length) {
42 List<KeywordState> result = new List<KeywordState>(26); 42 List<KeywordState> result = new List<KeywordState>(26);
43 assert(length2 != 0); 43 assert(length != 0);
44 int chunk = 0x0; 44 int chunk = 0x0;
45 int chunkStart = -1; 45 int chunkStart = -1;
46 bool isLeaf = false; 46 bool isLeaf = false;
47 for (int i = offset; i < offset + length2; i++) { 47 for (int i = offset; i < offset + length; i++) {
48 if (strings[i].length == start) { 48 if (strings[i].length == start) {
49 isLeaf = true; 49 isLeaf = true;
50 } 50 }
51 if (strings[i].length > start) { 51 if (strings[i].length > start) {
52 int c = strings[i].codeUnitAt(start); 52 int c = strings[i].codeUnitAt(start);
53 if (chunk != c) { 53 if (chunk != c) {
54 if (chunkStart != -1) { 54 if (chunkStart != -1) {
55 result[chunk - 0x61] = computeKeywordStateTable(start + 1, strings, chunkStart, i - chunkStart); 55 result[chunk - 0x61] = computeKeywordStateTable(start + 1, strings, chunkStart, i - chunkStart);
56 } 56 }
57 chunkStart = i; 57 chunkStart = i;
58 chunk = c; 58 chunk = c;
59 } 59 }
60 } 60 }
61 } 61 }
62 if (chunkStart != -1) { 62 if (chunkStart != -1) {
63 assert(result[chunk - 0x61] == null); 63 assert(result[chunk - 0x61] == null);
64 result[chunk - 0x61] = computeKeywordStateTable(start + 1, strings, chunkS tart, offset + length2 - chunkStart); 64 result[chunk - 0x61] = computeKeywordStateTable(start + 1, strings, chunkS tart, offset + length - chunkStart);
65 } else { 65 } else {
66 assert(length2 == 1); 66 assert(length == 1);
67 return new KeywordState(_EMPTY_TABLE, strings[offset]); 67 return new KeywordState(_EMPTY_TABLE, strings[offset]);
68 } 68 }
69 if (isLeaf) { 69 if (isLeaf) {
70 return new KeywordState(result, strings[offset]); 70 return new KeywordState(result, strings[offset]);
71 } else { 71 } else {
72 return new KeywordState(result, null); 72 return new KeywordState(result, null);
73 } 73 }
74 } 74 }
75 75
76 /** 76 /**
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 _groupingStack.add(token); 537 _groupingStack.add(token);
538 } 538 }
539 void appendCommentToken(TokenType type, String value) { 539 void appendCommentToken(TokenType type, String value) {
540 if (_firstComment == null) { 540 if (_firstComment == null) {
541 _firstComment = new StringToken(type, value, _tokenStart); 541 _firstComment = new StringToken(type, value, _tokenStart);
542 _lastComment = _firstComment; 542 _lastComment = _firstComment;
543 } else { 543 } else {
544 _lastComment = _lastComment.setNext(new StringToken(type, value, _tokenSta rt)); 544 _lastComment = _lastComment.setNext(new StringToken(type, value, _tokenSta rt));
545 } 545 }
546 } 546 }
547 void appendEndToken(TokenType type2, TokenType beginType) { 547 void appendEndToken(TokenType type, TokenType beginType) {
548 Token token; 548 Token token;
549 if (_firstComment == null) { 549 if (_firstComment == null) {
550 token = new Token(type2, _tokenStart); 550 token = new Token(type, _tokenStart);
551 } else { 551 } else {
552 token = new TokenWithComment(type2, _tokenStart, _firstComment); 552 token = new TokenWithComment(type, _tokenStart, _firstComment);
553 _firstComment = null; 553 _firstComment = null;
554 _lastComment = null; 554 _lastComment = null;
555 } 555 }
556 _tail = _tail.setNext(token); 556 _tail = _tail.setNext(token);
557 int last = _groupingStack.length - 1; 557 int last = _groupingStack.length - 1;
558 if (last >= 0) { 558 if (last >= 0) {
559 BeginToken begin = _groupingStack[last]; 559 BeginToken begin = _groupingStack[last];
560 if (identical(begin.type, beginType)) { 560 if (identical(begin.type, beginType)) {
561 begin.endToken = token; 561 begin.endToken = token;
562 _groupingStack.removeAt(last); 562 _groupingStack.removeAt(last);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 recordStartOfLine(); 636 recordStartOfLine();
637 return next; 637 return next;
638 } else if (next == 0xA) { 638 } else if (next == 0xA) {
639 next = advance(); 639 next = advance();
640 recordStartOfLine(); 640 recordStartOfLine();
641 return next; 641 return next;
642 } else if (next == 0x9 || next == 0x20) { 642 } else if (next == 0x9 || next == 0x20) {
643 return advance(); 643 return advance();
644 } 644 }
645 if (next == 0x72) { 645 if (next == 0x72) {
646 int peek2 = peek(); 646 int peek = this.peek();
647 if (peek2 == 0x22 || peek2 == 0x27) { 647 if (peek == 0x22 || peek == 0x27) {
648 int start = offset; 648 int start = offset;
649 return tokenizeString(advance(), start, true); 649 return tokenizeString(advance(), start, true);
650 } 650 }
651 } 651 }
652 if (0x61 <= next && next <= 0x7A) { 652 if (0x61 <= next && next <= 0x7A) {
653 return tokenizeKeywordOrIdentifier(next, true); 653 return tokenizeKeywordOrIdentifier(next, true);
654 } 654 }
655 if ((0x41 <= next && next <= 0x5A) || next == 0x5F || next == 0x24) { 655 if ((0x41 <= next && next <= 0x5A) || next == 0x5F || next == 0x24) {
656 return tokenizeIdentifier(next, offset, true); 656 return tokenizeIdentifier(next, offset, true);
657 } 657 }
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 } 1010 }
1011 int tokenizeInterpolatedIdentifier(int next, int start) { 1011 int tokenizeInterpolatedIdentifier(int next, int start) {
1012 appendStringToken2(TokenType.STRING_INTERPOLATION_IDENTIFIER, "\$", 0); 1012 appendStringToken2(TokenType.STRING_INTERPOLATION_IDENTIFIER, "\$", 0);
1013 if (((0x41 <= next && next <= 0x5A) || (0x61 <= next && next <= 0x7A) || nex t == 0x5F)) { 1013 if (((0x41 <= next && next <= 0x5A) || (0x61 <= next && next <= 0x7A) || nex t == 0x5F)) {
1014 beginToken(); 1014 beginToken();
1015 next = tokenizeKeywordOrIdentifier(next, false); 1015 next = tokenizeKeywordOrIdentifier(next, false);
1016 } 1016 }
1017 beginToken(); 1017 beginToken();
1018 return next; 1018 return next;
1019 } 1019 }
1020 int tokenizeKeywordOrIdentifier(int next2, bool allowDollar) { 1020 int tokenizeKeywordOrIdentifier(int next, bool allowDollar) {
1021 KeywordState state = KeywordState.KEYWORD_STATE; 1021 KeywordState state = KeywordState.KEYWORD_STATE;
1022 int start = offset; 1022 int start = offset;
1023 while (state != null && 0x61 <= next2 && next2 <= 0x7A) { 1023 while (state != null && 0x61 <= next && next <= 0x7A) {
1024 state = state.next(next2 as int); 1024 state = state.next(next as int);
1025 next2 = advance(); 1025 next = advance();
1026 } 1026 }
1027 if (state == null || state.keyword() == null) { 1027 if (state == null || state.keyword() == null) {
1028 return tokenizeIdentifier(next2, start, allowDollar); 1028 return tokenizeIdentifier(next, start, allowDollar);
1029 } 1029 }
1030 if ((0x41 <= next2 && next2 <= 0x5A) || (0x30 <= next2 && next2 <= 0x39) || next2 == 0x5F || next2 == 0x24) { 1030 if ((0x41 <= next && next <= 0x5A) || (0x30 <= next && next <= 0x39) || next == 0x5F || next == 0x24) {
1031 return tokenizeIdentifier(next2, start, allowDollar); 1031 return tokenizeIdentifier(next, start, allowDollar);
1032 } else if (next2 < 128) { 1032 } else if (next < 128) {
1033 appendKeywordToken(state.keyword()); 1033 appendKeywordToken(state.keyword());
1034 return next2; 1034 return next;
1035 } else { 1035 } else {
1036 return tokenizeIdentifier(next2, start, allowDollar); 1036 return tokenizeIdentifier(next, start, allowDollar);
1037 } 1037 }
1038 } 1038 }
1039 int tokenizeLessThan(int next) { 1039 int tokenizeLessThan(int next) {
1040 next = advance(); 1040 next = advance();
1041 if (0x3D == next) { 1041 if (0x3D == next) {
1042 appendToken(TokenType.LT_EQ); 1042 appendToken(TokenType.LT_EQ);
1043 return advance(); 1043 return advance();
1044 } else if (0x3C == next) { 1044 } else if (0x3C == next) {
1045 return select(0x3D, TokenType.LT_LT_EQ, TokenType.LT_LT); 1045 return select(0x3D, TokenType.LT_LT_EQ, TokenType.LT_LT);
1046 } else { 1046 } else {
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
2100 * Return `true` if this token type represents an operator that can be defined by users. 2100 * Return `true` if this token type represents an operator that can be defined by users.
2101 * 2101 *
2102 * @return `true` if this token type represents an operator that can be define d by users 2102 * @return `true` if this token type represents an operator that can be define d by users
2103 */ 2103 */
2104 bool get isUserDefinableOperator => identical(lexeme, "==") || identical(lexem e, "~") || identical(lexeme, "[]") || identical(lexeme, "[]=") || identical(lexe me, "*") || identical(lexeme, "/") || identical(lexeme, "%") || identical(lexeme , "~/") || identical(lexeme, "+") || identical(lexeme, "-") || identical(lexeme, "<<") || identical(lexeme, ">>") || identical(lexeme, ">=") || identical(lexeme , ">") || identical(lexeme, "<=") || identical(lexeme, "<") || identical(lexeme, "&") || identical(lexeme, "^") || identical(lexeme, "|"); 2104 bool get isUserDefinableOperator => identical(lexeme, "==") || identical(lexem e, "~") || identical(lexeme, "[]") || identical(lexeme, "[]=") || identical(lexe me, "*") || identical(lexeme, "/") || identical(lexeme, "%") || identical(lexeme , "~/") || identical(lexeme, "+") || identical(lexeme, "-") || identical(lexeme, "<<") || identical(lexeme, ">>") || identical(lexeme, ">=") || identical(lexeme , ">") || identical(lexeme, "<=") || identical(lexeme, "<") || identical(lexeme, "&") || identical(lexeme, "^") || identical(lexeme, "|");
2105 } 2105 }
2106 class TokenType_EOF extends TokenType { 2106 class TokenType_EOF extends TokenType {
2107 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super. con2(name, ordinal, arg0, arg1); 2107 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super. con2(name, ordinal, arg0, arg1);
2108 String toString() => "-eof-"; 2108 String toString() => "-eof-";
2109 } 2109 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698