Skip to content

Commit

Permalink
Fix additional range in character class.
Browse files Browse the repository at this point in the history
The range was added in 7ab6dcb, but that
change only tried to add ! to the character class. Fix by moving '-' to the end
of the class.

Fixes #694.
  • Loading branch information
nico committed Dec 13, 2013
1 parent 2517b75 commit 81f935b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 30 deletions.
71 changes: 42 additions & 29 deletions src/depfile_parser.cc
Expand Up @@ -53,10 +53,10 @@ bool DepfileParser::Parse(string* content, string* err) {
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, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
0, 128, 0, 0, 0, 0, 0, 0,
128, 128, 0, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 0, 0,
128, 128, 128, 0, 0, 128, 0, 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,
Expand Down Expand Up @@ -84,30 +84,45 @@ bool DepfileParser::Parse(string* content, string* err) {
};

yych = *in;
if (yych <= '[') {
if (yych <= '=') {
if (yych <= '$') {
if (yych <= 0x00) goto yy7;
if (yych <= ' ') goto yy9;
if (yych <= '#') goto yy6;
goto yy4;
if (yych <= ' ') {
if (yych <= 0x00) goto yy7;
goto yy9;
} else {
if (yych <= '!') goto yy5;
if (yych <= '#') goto yy9;
goto yy4;
}
} else {
if (yych <= '=') goto yy6;
if (yych <= '?') goto yy9;
if (yych <= 'Z') goto yy6;
goto yy9;
if (yych <= '*') {
if (yych <= '\'') goto yy9;
if (yych <= ')') goto yy5;
goto yy9;
} else {
if (yych <= ':') goto yy5;
if (yych <= '<') goto yy9;
goto yy5;
}
}
} else {
if (yych <= '`') {
if (yych <= '\\') goto yy2;
if (yych == '_') goto yy6;
goto yy9;
if (yych <= '^') {
if (yych <= 'Z') {
if (yych <= '?') goto yy9;
goto yy5;
} else {
if (yych != '\\') goto yy9;
}
} else {
if (yych <= 'z') goto yy6;
if (yych == '~') goto yy6;
goto yy9;
if (yych <= 'z') {
if (yych == '`') goto yy9;
goto yy5;
} else {
if (yych == '~') goto yy5;
goto yy9;
}
}
}
yy2:
++in;
if ((yych = *in) <= '#') {
if (yych <= '\n') {
Expand Down Expand Up @@ -135,10 +150,14 @@ bool DepfileParser::Parse(string* content, string* err) {
break;
}
yy4:
yych = *++in;
if (yych == '$') goto yy12;
goto yy3;
yy5:
++in;
if ((yych = *in) == '$') goto yy12;
yych = *in;
goto yy11;
yy5:
yy6:
{
// Got a span of plain text.
int len = (int)(in - start);
Expand All @@ -148,9 +167,6 @@ bool DepfileParser::Parse(string* content, string* err) {
out += len;
continue;
}
yy6:
yych = *++in;
goto yy11;
yy7:
++in;
{
Expand All @@ -166,12 +182,9 @@ bool DepfileParser::Parse(string* content, string* err) {
if (yybm[0+yych] & 128) {
goto yy10;
}
goto yy5;
goto yy6;
yy12:
++in;
if (yybm[0+(yych = *in)] & 128) {
goto yy10;
}
{
// De-escape dollar character.
*out++ = '$';
Expand Down
2 changes: 1 addition & 1 deletion src/depfile_parser.in.cc
Expand Up @@ -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.
Expand Down

0 comments on commit 81f935b

Please sign in to comment.