Changeset 31147 in webkit for trunk/JavaScriptCore/kjs/lexer.cpp
- Timestamp:
- Mar 18, 2008, 9:23:21 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/lexer.cpp
r30942 r31147 524 524 #endif 525 525 526 if (state != Identifier && eatNextIdentifier)526 if (state != Identifier) 527 527 eatNextIdentifier = false; 528 528 … … 537 537 break; 538 538 case Other: 539 if (token == '}' || token == ';') {539 if (token == '}' || token == ';') 540 540 delimited = true; 541 break; 542 case Identifier: 543 // Apply anonymous-function hack below (eat the identifier). 544 if (eatNextIdentifier) { 545 eatNextIdentifier = false; 546 token = lex(); 547 break; 541 548 } 549 kjsyylval.ident = makeIdentifier(m_buffer16); 550 token = IDENT; 542 551 break; 543 552 case IdentifierOrKeyword: 544 if ((token = Lookup::find(&mainTable, m_buffer16.data(), m_buffer16.size())) < 0) { 545 case Identifier: 546 // Lookup for keyword failed, means this is an identifier 547 // Apply anonymous-function hack below (eat the identifier) 548 if (eatNextIdentifier) { 549 eatNextIdentifier = false; 550 token = lex(); 551 break; 552 } 553 kjsyylval.ident = makeIdentifier(m_buffer16); 553 kjsyylval.ident = makeIdentifier(m_buffer16); 554 if ((token = mainTable.value(*kjsyylval.ident)) < 0) { 555 // Lookup for keyword failed, means this is an identifier. 554 556 token = IDENT; 555 557 break; 556 558 } 557 558 eatNextIdentifier = false; 559 // Hack for "f = function somename() { ... }", too hard to get into the grammar 560 if (token == FUNCTION && lastToken == '=' ) 561 eatNextIdentifier = true; 562 563 if (token == CONTINUE || token == BREAK || 564 token == RETURN || token == THROW) 559 // Hack for "f = function somename() { ... }"; too hard to get into the grammar. 560 eatNextIdentifier = token == FUNCTION && lastToken == '='; 561 if (token == CONTINUE || token == BREAK || token == RETURN || token == THROW) 565 562 restrKeyword = true; 566 563 break;
Note:
See TracChangeset
for help on using the changeset viewer.