From 2136ca304ad492189b59c0a9e747541c6ea29002 Mon Sep 17 00:00:00 2001 From: Maxim Kalaev Date: Wed, 7 May 2014 20:56:32 +0300 Subject: Allow paths with '{' '}' in depfiles --- src/depfile_parser.cc | 7 ++++--- src/depfile_parser.in.cc | 2 +- src/depfile_parser_test.cc | 7 +++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/depfile_parser.cc b/src/depfile_parser.cc index d052a4b..4ca3943 100644 --- a/src/depfile_parser.cc +++ b/src/depfile_parser.cc @@ -64,7 +64,7 @@ bool DepfileParser::Parse(string* content, string* err) { 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 0, 0, 0, 128, 0, + 128, 128, 128, 128, 0, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -114,11 +114,12 @@ bool DepfileParser::Parse(string* content, string* err) { if (yych != '\\') goto yy9; } } else { - if (yych <= 'z') { + if (yych <= '{') { if (yych == '`') goto yy9; goto yy5; } else { - if (yych == '~') goto yy5; + if (yych <= '|') goto yy9; + if (yych <= '~') goto yy5; goto yy9; } } diff --git a/src/depfile_parser.in.cc b/src/depfile_parser.in.cc index ba77079..b59baf0 100644 --- a/src/depfile_parser.in.cc +++ b/src/depfile_parser.in.cc @@ -73,7 +73,7 @@ bool DepfileParser::Parse(string* content, string* err) { *out++ = yych; continue; } - [a-zA-Z0-9+,/_:.~()@=!-]+ { + [a-zA-Z0-9+,/_:.~()}{@=!-]+ { // Got a span of plain text. int len = (int)(in - start); // Need to shift it over if we're overwriting backslashes. diff --git a/src/depfile_parser_test.cc b/src/depfile_parser_test.cc index 581f3a2..a5f3321 100644 --- a/src/depfile_parser_test.cc +++ b/src/depfile_parser_test.cc @@ -120,16 +120,19 @@ TEST_F(DepfileParserTest, SpecialChars) { string err; EXPECT_TRUE(Parse( "C:/Program\\ Files\\ (x86)/Microsoft\\ crtdefs.h: \n" -" en@quot.header~ t+t-x!=1", +" en@quot.header~ t+t-x!=1 \n" +" openldap/slapd.d/cn=config/cn=schema/cn={0}core.ldif", &err)); ASSERT_EQ("", err); EXPECT_EQ("C:/Program Files (x86)/Microsoft crtdefs.h", parser_.out_.AsString()); - ASSERT_EQ(2u, parser_.ins_.size()); + ASSERT_EQ(3u, parser_.ins_.size()); EXPECT_EQ("en@quot.header~", parser_.ins_[0].AsString()); EXPECT_EQ("t+t-x!=1", parser_.ins_[1].AsString()); + EXPECT_EQ("openldap/slapd.d/cn=config/cn=schema/cn={0}core.ldif", + parser_.ins_[2].AsString()); } TEST_F(DepfileParserTest, UnifyMultipleOutputs) { -- cgit v0.12