Changeset 122650 in webkit for trunk/Source/JavaScriptCore/offlineasm/parser.rb
- Timestamp:
- Jul 13, 2012, 5:44:47 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/offlineasm/parser.rb
r110383 r122650 22 22 # THE POSSIBILITY OF SUCH DAMAGE. 23 23 24 require "config" 24 25 require "ast" 25 26 require "instructions" … … 82 83 result = [] 83 84 lineNumber = 1 85 annotation = nil 84 86 while not str.empty? 85 87 case str 86 88 when /\A\#([^\n]*)/ 87 89 # comment, ignore 90 when /\A\/\/([^\n]*)/ 91 # annotation 92 annotation = $1 88 93 when /\A\n/ 94 # We've found a '\n'. Emit the last comment recorded if appropriate: 95 if $enableInstrAnnotations and annotation 96 result << Token.new(CodeOrigin.new(fileName, lineNumber), "@" + annotation) 97 annotation = nil 98 end 89 99 result << Token.new(CodeOrigin.new(fileName, lineNumber), $&) 90 100 lineNumber += 1 … … 137 147 end 138 148 149 def isAnnotation(token) 150 token =~ /\A\@([^\n]*)/ 151 end 152 139 153 def isLabel(token) 140 154 token =~ /\A_([a-zA-Z0-9_]*)\Z/ … … 536 550 list << Instruction.new(codeOrigin, name, []) 537 551 break 552 elsif isAnnotation @tokens[@idx] 553 annotation = @tokens[@idx].string 554 list << Instruction.new(codeOrigin, name, [], annotation) 555 @idx += 2 # Consume the newline as well. 538 556 elsif @tokens[@idx] == "\n" 539 557 # Zero operand instruction. … … 544 562 operands = [] 545 563 endOfSequence = false 564 annotation = nil 546 565 loop { 547 566 operands << parseOperand("while inside of instruction #{name}") … … 553 572 # Has another operand. 554 573 @idx += 1 574 elsif isAnnotation @tokens[@idx] 575 annotation = @tokens[@idx].string 576 @idx += 2 # Consume the newline as well. 577 break 555 578 elsif @tokens[@idx] == "\n" 556 579 # The end of the instruction. … … 561 584 end 562 585 } 563 list << Instruction.new(codeOrigin, name, operands )586 list << Instruction.new(codeOrigin, name, operands, annotation) 564 587 if endOfSequence 565 588 break
Note:
See TracChangeset
for help on using the changeset viewer.