Skip to content

Commit

Permalink
Logs can include escapes (inside strings).
Browse files Browse the repository at this point in the history
Terminating on string is not a problem.
  • Loading branch information
hadley committed Apr 7, 2015
1 parent 25b3656 commit 052b05e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/TokenizerLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ enum LogState {
LOG_DELIM,
LOG_FIELD,
LOG_STRING,
LOG_ESCAPE,
LOG_QUOTE,
LOG_DATE
};
Expand Down Expand Up @@ -100,9 +101,15 @@ class TokenizerLog : public Tokenizer {
case LOG_STRING:
if (*cur_ == '"') {
state_ = LOG_QUOTE;
} else if (*cur_ == '\\') {
state_ = LOG_ESCAPE;
}
break;

case LOG_ESCAPE:
state_ = LOG_STRING;
break;

case LOG_DATE:
if (*cur_ == ']') {
newField();
Expand All @@ -129,7 +136,6 @@ class TokenizerLog : public Tokenizer {
return fieldToken(token_begin + 1, end_ - 1, row, col);

case LOG_STRING:
warn(row, col, "closing quote at end of file");
return fieldToken(token_begin + 1, end_, row, col);

case LOG_DATE:
Expand Down

0 comments on commit 052b05e

Please sign in to comment.