diff options
author | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2010-01-07 02:08:03 +0000 |
---|---|---|
committer | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2010-01-07 02:08:03 +0000 |
commit | 535301894efb5ae340d835a4b1de465f3beeb487 (patch) | |
tree | c816894658e7260d2f2433e96ed116d5460e7af2 /python | |
parent | 2429e3a0deb0b26b8723c717555c09d14842373f (diff) | |
download | protobuf-535301894efb5ae340d835a4b1de465f3beeb487.tar.gz protobuf-535301894efb5ae340d835a4b1de465f3beeb487.tar.bz2 protobuf-535301894efb5ae340d835a4b1de465f3beeb487.zip |
Address comments from various code reviews.
Diffstat (limited to 'python')
-rwxr-xr-x | python/google/protobuf/text_format.py | 12 |
1 files changed, 9 insertions, 3 deletions
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.') |