From 535301894efb5ae340d835a4b1de465f3beeb487 Mon Sep 17 00:00:00 2001 From: "kenton@google.com" Date: Thu, 7 Jan 2010 02:08:03 +0000 Subject: Address comments from various code reviews. --- python/google/protobuf/text_format.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'python/google') diff --git a/python/google/protobuf/text_format.py b/python/google/protobuf/text_format.py index 428e8c55..cc6ac902 100755 --- a/python/google/protobuf/text_format.py +++ b/python/google/protobuf/text_format.py @@ -536,12 +536,18 @@ class _Tokenizer(object): Raises: ParseError: If a byte array value couldn't be consumed. """ - list = [self.ConsumeSingleByteString()] + list = [self._ConsumeSingleByteString()] while len(self.token) > 0 and self.token[0] in ('\'', '"'): - list.append(self.ConsumeSingleByteString()) + list.append(self._ConsumeSingleByteString()) return "".join(list) - def ConsumeSingleByteString(self): + def _ConsumeSingleByteString(self): + """Consume one token of a string literal. + + String literals (whether bytes or text) can come in multiple adjacent + tokens which are automatically concatenated, like in C or Python. This + method only consumes one token. + """ text = self.token if len(text) < 1 or text[0] not in ('\'', '"'): raise self._ParseError('Exptected string.') -- cgit v1.2.3