lib/minjs/lex.rb in minjs-0.1.10 vs lib/minjs/lex.rb in minjs-0.2.0

- old
+ new

@@ -616,19 +616,22 @@ when 0x75 #u t = [[@codes[@pos+1], @codes[@pos+2], @codes[@pos+3], @codes[@pos+4]].pack("U*").to_i(16)].pack("U*") @pos += 4 t else - # + # line continuation + if line_terminator?(@codes[@pos]) + "" # octal # Annex B - if octal?(@codes[@pos]) - oct = 0 - while octal?(@codes[@pos]) + elsif octal?(@codes[@pos]) + oct = (@codes[@pos] - 0x30) + 2.times do + break unless octal?(@codes[@pos+1]) + @pos += 1 oct *= 8 oct += (@codes[@pos] - 0x30) - @pos += 1 end [oct].pack("U*") else [@codes[@pos]].pack("U*") end @@ -726,12 +729,12 @@ pos0 = 20 elsif pos >= 0 pos0 = pos pos = 0 end - if col and col > 2 - pos0 = col - 2; + if col and col >= 1 + pos0 = col - 1; end t = '' t << @codes[pos..(pos+80)].pack("U*") t << "\n" t << (' ' * pos0) + "^" @@ -780,15 +783,15 @@ col = 1 @codes.each do |code| break if _pos >= pos if line_terminator?(code) row += 1 - row = 0 + col = 0 else col += 1 end _pos += 1 end - return [row+1, col] + return [row+1, col+1] end end end