Changeset 220047 in webkit for trunk/Source/JavaScriptCore/offlineasm/parser.rb
- Timestamp:
- Jul 29, 2017, 8:01:12 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/offlineasm/parser.rb
r200125 r220047 4 4 # modification, are permitted provided that the following conditions 5 5 # are met: 6 # 1. Redistributions of source code must retain the above copyrigh t6 # 1. Redistributions of source code must retain the above copyrighht 7 7 # notice, this list of conditions and the following disclaimer. 8 8 # 2. Redistributions in binary form must reproduce the above copyright … … 223 223 224 224 def isKeyword(token) 225 token =~ /\A((true)|(false)|(if)|(then)|(else)|(elsif)|(end)|(and)|(or)|(not)|(global)|(macro)|(const)|( sizeof)|(error)|(include))\Z/ or225 token =~ /\A((true)|(false)|(if)|(then)|(else)|(elsif)|(end)|(and)|(or)|(not)|(global)|(macro)|(const)|(constexpr)|(sizeof)|(error)|(include))\Z/ or 226 226 token =~ REGISTER_PATTERN or 227 227 isInstruction(token) … … 418 418 [codeOrigin, names] 419 419 end 420 421 def parseTextInParens 422 skipNewLine 423 codeOrigin = @tokens[@idx].codeOrigin 424 raise unless @tokens[@idx] == "(" 425 @idx += 1 426 # need at least one item 427 raise if @tokens[@idx] == ")" 428 numEnclosedParens = 0 429 text = [] 430 while @tokens[@idx] != ")" || numEnclosedParens > 0 431 if @tokens[@idx] == "(" 432 numEnclosedParens += 1 433 elsif @tokens[@idx] == ")" 434 numEnclosedParens -= 1 435 end 436 437 text << @tokens[@idx].string 438 @idx += 1 439 end 440 @idx += 1 441 return [codeOrigin, text] 442 end 443 420 444 421 445 def parseExpressionAtom … … 454 478 codeOrigin, names = parseColonColon 455 479 Sizeof.forName(codeOrigin, names.join('::')) 480 elsif @tokens[@idx] == "constexpr" 481 @idx += 1 482 skipNewLine 483 if @tokens[@idx] == "(" 484 codeOrigin, text = parseTextInParens 485 text = text.join 486 else 487 codeOrigin, text = parseColonColon 488 text = text.join("::") 489 end 490 ConstExpr.forName(codeOrigin, text) 456 491 elsif isLabel @tokens[@idx] 457 492 result = LabelReference.new(@tokens[@idx].codeOrigin, Label.forName(@tokens[@idx].codeOrigin, @tokens[@idx].string)) … … 482 517 483 518 def couldBeExpression 484 @tokens[@idx] == "-" or @tokens[@idx] == "~" or @tokens[@idx] == "sizeof" or isInteger(@tokens[@idx]) or isString(@tokens[@idx]) or isVariable(@tokens[@idx]) or @tokens[@idx] == "("519 @tokens[@idx] == "-" or @tokens[@idx] == "~" or @tokens[@idx] == "sizeof" or @tokens[@idx] == "constexpr" or isInteger(@tokens[@idx]) or isString(@tokens[@idx]) or isVariable(@tokens[@idx]) or @tokens[@idx] == "(" 485 520 end 486 521
Note:
See TracChangeset
for help on using the changeset viewer.