diff options
author | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2009-12-22 18:11:09 +0000 |
---|---|---|
committer | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2009-12-22 18:11:09 +0000 |
commit | 6f12e3e29a2f75af03c27723810e5a94b56a8642 (patch) | |
tree | 5a5d27dc55f2920c309ae16516a51d450d1de75a | |
parent | f9c5978f5dc2ee88067931c55e13049d17f5331c (diff) | |
download | protobuf-6f12e3e29a2f75af03c27723810e5a94b56a8642.tar.gz protobuf-6f12e3e29a2f75af03c27723810e5a94b56a8642.tar.bz2 protobuf-6f12e3e29a2f75af03c27723810e5a94b56a8642.zip |
Accept form feeds as whitespace.
-rw-r--r-- | src/google/protobuf/io/tokenizer.cc | 2 | ||||
-rw-r--r-- | src/google/protobuf/io/tokenizer_unittest.cc | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/google/protobuf/io/tokenizer.cc b/src/google/protobuf/io/tokenizer.cc index 75cbfed5..38fa351c 100644 --- a/src/google/protobuf/io/tokenizer.cc +++ b/src/google/protobuf/io/tokenizer.cc @@ -117,7 +117,7 @@ namespace { } CHARACTER_CLASS(Whitespace, c == ' ' || c == '\n' || c == '\t' || - c == '\r' || c == '\v'); + c == '\r' || c == '\v' || c == '\f'); CHARACTER_CLASS(Unprintable, c < ' ' && c > '\0'); diff --git a/src/google/protobuf/io/tokenizer_unittest.cc b/src/google/protobuf/io/tokenizer_unittest.cc index 3598e188..358ec567 100644 --- a/src/google/protobuf/io/tokenizer_unittest.cc +++ b/src/google/protobuf/io/tokenizer_unittest.cc @@ -403,6 +403,13 @@ MultiTokenCase kMultiTokenCases[] = { { Tokenizer::TYPE_SYMBOL, "\300", 0, 0 }, { Tokenizer::TYPE_END , "" , 0, 1 }, }}, + + // Test all whitespace chars + { "foo\n\t\r\v\fbar", { + { Tokenizer::TYPE_IDENTIFIER, "foo", 0, 0 }, + { Tokenizer::TYPE_IDENTIFIER, "bar", 1, 11 }, + { Tokenizer::TYPE_END , "" , 1, 14 }, + }}, }; TEST_2D(TokenizerTest, MultipleTokens, kMultiTokenCases, kBlockSizes) { |