Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
53530189
Commit
53530189
authored
Jan 07, 2010
by
kenton@google.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address comments from various code reviews.
parent
2429e3a0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
5 deletions
+26
-5
TextFormat.java
java/src/main/java/com/google/protobuf/TextFormat.java
+7
-1
text_format.py
python/google/protobuf/text_format.py
+9
-3
command_line_interface.cc
src/google/protobuf/compiler/command_line_interface.cc
+10
-1
No files found.
java/src/main/java/com/google/protobuf/TextFormat.java
View file @
53530189
...
...
@@ -704,7 +704,13 @@ public final class TextFormat {
return
ByteString
.
copyFrom
(
list
);
}
public
void
consumeByteString
(
List
<
ByteString
>
list
)
throws
ParseException
{
/**
* Like {@link #consumeByteString()} but adds each token of the string to
* the given list. String literals (whether bytes or text) may come in
* multiple adjacent tokens which are automatically concatenated, like in
* C or Python.
*/
private
void
consumeByteString
(
List
<
ByteString
>
list
)
throws
ParseException
{
final
char
quote
=
currentToken
.
length
()
>
0
?
currentToken
.
charAt
(
0
)
:
'\0'
;
if
(
quote
!=
'\"'
&&
quote
!=
'\''
)
{
...
...
python/google/protobuf/text_format.py
View file @
53530189
...
...
@@ -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.'
)
...
...
src/google/protobuf/compiler/command_line_interface.cc
View file @
53530189
...
...
@@ -219,14 +219,23 @@ class CommandLineInterface::ErrorPrinter : public MultiFileErrorCollector,
// -------------------------------------------------------------------
// An OutputDirectory implementation that writes to disk.
// An OutputDirectory implementation that buffers files in memory, then dumps
// them all to disk on demand.
class
CommandLineInterface
::
MemoryOutputDirectory
:
public
OutputDirectory
{
public
:
MemoryOutputDirectory
();
~
MemoryOutputDirectory
();
// Write all files in the directory to disk at the given output location,
// which must end in a '/'.
bool
WriteAllToDisk
(
const
string
&
prefix
);
// Write the contents of this directory to a ZIP-format archive with the
// given name.
bool
WriteAllToZip
(
const
string
&
filename
);
// Add a boilerplate META-INF/MANIFEST.MF file as required by the Java JAR
// format, unless one has already been written.
void
AddJarManifest
();
// implements OutputDirectory --------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment