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

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

Issue 14161021: Generate unique names less aggressively. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 3
4 library engine.scanner; 4 library engine.scanner;
5 5
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'java_core.dart'; 7 import 'java_core.dart';
8 import 'java_engine.dart'; 8 import 'java_engine.dart';
9 import 'source.dart'; 9 import 'source.dart';
10 import 'error.dart'; 10 import 'error.dart';
(...skipping 18 matching lines...) Expand all
29 * strings in the given array of strings starting at the given offset and havi ng the given length. 29 * strings in the given array of strings starting at the given offset and havi ng the given length.
30 * All of these strings have a common prefix and the next character is at the given start index. 30 * All of these strings have a common prefix and the next character is at the given start index.
31 * @param start the index of the character in the strings used to transition t o a new state 31 * @param start the index of the character in the strings used to transition t o a new state
32 * @param strings an array containing all of the strings that will be recogniz ed by the state 32 * @param strings an array containing all of the strings that will be recogniz ed by the state
33 * machine 33 * machine
34 * @param offset the offset of the first string in the array that has the pref ix that is assumed 34 * @param offset the offset of the first string in the array that has the pref ix that is assumed
35 * to have been recognized by the time we reach the state being built 35 * to have been recognized by the time we reach the state being built
36 * @param length the number of strings in the array that pass through the stat e being built 36 * @param length the number of strings in the array that pass through the stat e being built
37 * @return the state that was created 37 * @return the state that was created
38 */ 38 */
39 static KeywordState computeKeywordStateTable(int start, List<String> strings, int offset, int length12) { 39 static KeywordState computeKeywordStateTable(int start, List<String> strings, int offset, int length2) {
40 List<KeywordState> result = new List<KeywordState>(26); 40 List<KeywordState> result = new List<KeywordState>(26);
41 assert(length12 != 0); 41 assert(length2 != 0);
42 int chunk = 0x0; 42 int chunk = 0x0;
43 int chunkStart = -1; 43 int chunkStart = -1;
44 bool isLeaf = false; 44 bool isLeaf = false;
45 for (int i = offset; i < offset + length12; i++) { 45 for (int i = offset; i < offset + length2; i++) {
46 if (strings[i].length == start) { 46 if (strings[i].length == start) {
47 isLeaf = true; 47 isLeaf = true;
48 } 48 }
49 if (strings[i].length > start) { 49 if (strings[i].length > start) {
50 int c = strings[i].codeUnitAt(start); 50 int c = strings[i].codeUnitAt(start);
51 if (chunk != c) { 51 if (chunk != c) {
52 if (chunkStart != -1) { 52 if (chunkStart != -1) {
53 result[chunk - 0x61] = computeKeywordStateTable(start + 1, strings, chunkStart, i - chunkStart); 53 result[chunk - 0x61] = computeKeywordStateTable(start + 1, strings, chunkStart, i - chunkStart);
54 } 54 }
55 chunkStart = i; 55 chunkStart = i;
56 chunk = c; 56 chunk = c;
57 } 57 }
58 } 58 }
59 } 59 }
60 if (chunkStart != -1) { 60 if (chunkStart != -1) {
61 assert(result[chunk - 0x61] == null); 61 assert(result[chunk - 0x61] == null);
62 result[chunk - 0x61] = computeKeywordStateTable(start + 1, strings, chunkS tart, offset + length12 - chunkStart); 62 result[chunk - 0x61] = computeKeywordStateTable(start + 1, strings, chunkS tart, offset + length2 - chunkStart);
63 } else { 63 } else {
64 assert(length12 == 1); 64 assert(length2 == 1);
65 return new KeywordState(_EMPTY_TABLE, strings[offset]); 65 return new KeywordState(_EMPTY_TABLE, strings[offset]);
66 } 66 }
67 if (isLeaf) { 67 if (isLeaf) {
68 return new KeywordState(result, strings[offset]); 68 return new KeywordState(result, strings[offset]);
69 } else { 69 } else {
70 return new KeywordState(result, null); 70 return new KeywordState(result, null);
71 } 71 }
72 } 72 }
73 /** 73 /**
74 * Create the initial state in the state machine. 74 * Create the initial state in the state machine.
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 _groupingStack.add(token); 440 _groupingStack.add(token);
441 } 441 }
442 void appendCommentToken(TokenType type, String value) { 442 void appendCommentToken(TokenType type, String value) {
443 if (_firstComment == null) { 443 if (_firstComment == null) {
444 _firstComment = new StringToken(type, value, _tokenStart); 444 _firstComment = new StringToken(type, value, _tokenStart);
445 _lastComment = _firstComment; 445 _lastComment = _firstComment;
446 } else { 446 } else {
447 _lastComment = _lastComment.setNext(new StringToken(type, value, _tokenSta rt)); 447 _lastComment = _lastComment.setNext(new StringToken(type, value, _tokenSta rt));
448 } 448 }
449 } 449 }
450 void appendEndToken(TokenType type42, TokenType beginType) { 450 void appendEndToken(TokenType type2, TokenType beginType) {
451 Token token; 451 Token token;
452 if (_firstComment == null) { 452 if (_firstComment == null) {
453 token = new Token(type42, _tokenStart); 453 token = new Token(type2, _tokenStart);
454 } else { 454 } else {
455 token = new TokenWithComment(type42, _tokenStart, _firstComment); 455 token = new TokenWithComment(type2, _tokenStart, _firstComment);
456 _firstComment = null; 456 _firstComment = null;
457 _lastComment = null; 457 _lastComment = null;
458 } 458 }
459 _tail = _tail.setNext(token); 459 _tail = _tail.setNext(token);
460 int last = _groupingStack.length - 1; 460 int last = _groupingStack.length - 1;
461 if (last >= 0) { 461 if (last >= 0) {
462 BeginToken begin = _groupingStack[last]; 462 BeginToken begin = _groupingStack[last];
463 if (identical(begin.type, beginType)) { 463 if (identical(begin.type, beginType)) {
464 begin.endToken = token; 464 begin.endToken = token;
465 _groupingStack.removeAt(last); 465 _groupingStack.removeAt(last);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 } 538 }
539 recordStartOfLine(); 539 recordStartOfLine();
540 return next; 540 return next;
541 } else if (next == 0xA) { 541 } else if (next == 0xA) {
542 recordStartOfLine(); 542 recordStartOfLine();
543 return advance(); 543 return advance();
544 } else if (next == 0x9 || next == 0x20) { 544 } else if (next == 0x9 || next == 0x20) {
545 return advance(); 545 return advance();
546 } 546 }
547 if (next == 0x72) { 547 if (next == 0x72) {
548 int peek3 = peek(); 548 int peek2 = peek();
549 if (peek3 == 0x22 || peek3 == 0x27) { 549 if (peek2 == 0x22 || peek2 == 0x27) {
550 int start = offset; 550 int start = offset;
551 return tokenizeString(advance(), start, true); 551 return tokenizeString(advance(), start, true);
552 } 552 }
553 } 553 }
554 if (0x61 <= next && next <= 0x7A) { 554 if (0x61 <= next && next <= 0x7A) {
555 return tokenizeKeywordOrIdentifier(next, true); 555 return tokenizeKeywordOrIdentifier(next, true);
556 } 556 }
557 if ((0x41 <= next && next <= 0x5A) || next == 0x5F || next == 0x24) { 557 if ((0x41 <= next && next <= 0x5A) || next == 0x5F || next == 0x24) {
558 return tokenizeIdentifier(next, offset, true); 558 return tokenizeIdentifier(next, offset, true);
559 } 559 }
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 */ 1421 */
1422 Token setNextWithoutSettingPrevious(Token token) { 1422 Token setNextWithoutSettingPrevious(Token token) {
1423 _next = token; 1423 _next = token;
1424 return token; 1424 return token;
1425 } 1425 }
1426 /** 1426 /**
1427 * Set the offset from the beginning of the file to the first character in the token to the given 1427 * Set the offset from the beginning of the file to the first character in the token to the given
1428 * offset. 1428 * offset.
1429 * @param offset the offset from the beginning of the file to the first charac ter in the token 1429 * @param offset the offset from the beginning of the file to the first charac ter in the token
1430 */ 1430 */
1431 void set offset(int offset4) { 1431 void set offset(int offset2) {
1432 this._offset = offset4; 1432 this._offset = offset2;
1433 } 1433 }
1434 String toString() => lexeme; 1434 String toString() => lexeme;
1435 /** 1435 /**
1436 * Return the value of this token. For keyword tokens, this is the keyword ass ociated with the 1436 * Return the value of this token. For keyword tokens, this is the keyword ass ociated with the
1437 * token, for other tokens it is the lexeme associated with the token. 1437 * token, for other tokens it is the lexeme associated with the token.
1438 * @return the value of this token 1438 * @return the value of this token
1439 */ 1439 */
1440 Object value() => _type.lexeme; 1440 Object value() => _type.lexeme;
1441 /** 1441 /**
1442 * Set the previous token in the token stream to the given token. 1442 * Set the previous token in the token stream to the given token.
1443 * @param previous the previous token in the token stream 1443 * @param previous the previous token in the token stream
1444 */ 1444 */
1445 void set previous(Token previous3) { 1445 void set previous(Token previous2) {
1446 this._previous = previous3; 1446 this._previous = previous2;
1447 } 1447 }
1448 } 1448 }
1449 /** 1449 /**
1450 * Instances of the class {@code StringScanner} implement a scanner that reads f rom a string. The 1450 * Instances of the class {@code StringScanner} implement a scanner that reads f rom a string. The
1451 * scanning logic is in the superclass. 1451 * scanning logic is in the superclass.
1452 * @coverage dart.engine.parser 1452 * @coverage dart.engine.parser
1453 */ 1453 */
1454 class StringScanner extends AbstractScanner { 1454 class StringScanner extends AbstractScanner {
1455 /** 1455 /**
1456 * The offset from the beginning of the file to the beginning of the source be ing scanned. 1456 * The offset from the beginning of the file to the beginning of the source be ing scanned.
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 * @return {@code true} if this token type represents an operator that can be defined by users 1902 * @return {@code true} if this token type represents an operator that can be defined by users
1903 */ 1903 */
1904 bool isUserDefinableOperator() => identical(_lexeme, "==") || identical(_lexem e, "~") || identical(_lexeme, "[]") || identical(_lexeme, "[]=") || identical(_l exeme, "*") || identical(_lexeme, "/") || identical(_lexeme, "%") || identical(_ lexeme, "~/") || identical(_lexeme, "+") || identical(_lexeme, "-") || identical (_lexeme, "<<") || identical(_lexeme, ">>") || identical(_lexeme, ">=") || ident ical(_lexeme, ">") || identical(_lexeme, "<=") || identical(_lexeme, "<") || ide ntical(_lexeme, "&") || identical(_lexeme, "^") || identical(_lexeme, "|"); 1904 bool isUserDefinableOperator() => identical(_lexeme, "==") || identical(_lexem e, "~") || identical(_lexeme, "[]") || identical(_lexeme, "[]=") || identical(_l exeme, "*") || identical(_lexeme, "/") || identical(_lexeme, "%") || identical(_ lexeme, "~/") || identical(_lexeme, "+") || identical(_lexeme, "-") || identical (_lexeme, "<<") || identical(_lexeme, ">>") || identical(_lexeme, ">=") || ident ical(_lexeme, ">") || identical(_lexeme, "<=") || identical(_lexeme, "<") || ide ntical(_lexeme, "&") || identical(_lexeme, "^") || identical(_lexeme, "|");
1905 int compareTo(TokenType other) => __ordinal - other.__ordinal; 1905 int compareTo(TokenType other) => __ordinal - other.__ordinal;
1906 String toString() => __name; 1906 String toString() => __name;
1907 } 1907 }
1908 class TokenType_EOF extends TokenType { 1908 class TokenType_EOF extends TokenType {
1909 TokenType_EOF(String ___name, int ___ordinal, TokenClass arg0, String arg1) : super.con2(___name, ___ordinal, arg0, arg1); 1909 TokenType_EOF(String ___name, int ___ordinal, TokenClass arg0, String arg1) : super.con2(___name, ___ordinal, arg0, arg1);
1910 String toString() => "-eof-"; 1910 String toString() => "-eof-";
1911 } 1911 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698