X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=python%2Fovs%2Fjson.py;h=d329ee41004c456fc9ea7bd0860f243fcc32f00d;hb=7cfb9651a2cd446d81fce90ccf77af56d5c0cbc2;hp=f4caf41cf36a28477c575ada8c1eddda662a32b4;hpb=26bb0f31299d3f8eb06551d6a219846929c27149;p=openvswitch diff --git a/python/ovs/json.py b/python/ovs/json.py index f4caf41c..d329ee41 100644 --- a/python/ovs/json.py +++ b/python/ovs/json.py @@ -1,4 +1,4 @@ -# Copyright (c) 2010, 2011 Nicira Networks +# Copyright (c) 2010, 2011, 2012 Nicira, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -267,7 +267,7 @@ class Parser(object): self.__parser_input(0) return elif significand <= 2 ** 63: - while pow10 > 0 and significand <= 2 * 63: + while pow10 > 0 and significand <= 2 ** 63: significand *= 10 pow10 -= 1 while pow10 < 0 and significand % 10 == 0: @@ -420,13 +420,6 @@ class Parser(object): return True def __lex_input(self, c): - self.byte_number += 1 - if c == '\n': - self.column_number = 0 - self.line_number += 1 - else: - self.column_number += 1 - eat = self.lex_state(self, c) assert eat is True or eat is False return eat @@ -557,7 +550,16 @@ class Parser(object): while True: if self.done or i >= len(s): return i - if self.__lex_input(s[i]): + + c = s[i] + if self.__lex_input(c): + self.byte_number += 1 + if c == '\n': + self.column_number = 0 + self.line_number += 1 + else: + self.column_number += 1 + i += 1 def is_done(self):