diff options
author | Evan Martin <martine@danga.com> | 2011-05-22 17:15:11 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-05-27 02:35:39 (GMT) |
commit | 55fd4232d35de1f163310333d216d81a35cc0ef1 (patch) | |
tree | 1b0f3dedb6bc5b216ba8ae0809f78d20e45323f6 /src/parsers.h | |
parent | 976166706db05dcd4496586ae995b7fdb1afab35 (diff) | |
download | Ninja-55fd4232d35de1f163310333d216d81a35cc0ef1.zip Ninja-55fd4232d35de1f163310333d216d81a35cc0ef1.tar.gz Ninja-55fd4232d35de1f163310333d216d81a35cc0ef1.tar.bz2 |
switch to $ as the line continuation char
This means that backslashes are passed through without interpretation,
allowing us to support Windows paths without worrying about escaping.
Diffstat (limited to 'src/parsers.h')
-rw-r--r-- | src/parsers.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/parsers.h b/src/parsers.h index b67a861..eb50523 100644 --- a/src/parsers.h +++ b/src/parsers.h @@ -63,10 +63,17 @@ struct SourceLocation { /// Processes an input stream into Tokens. struct Tokenizer { - Tokenizer(bool whitespace_significant) - : whitespace_significant_(whitespace_significant), - token_(Token::NONE), line_number_(0), - last_indent_(0), cur_indent_(-1) {} + Tokenizer() + : makefile_flavor_(false), + token_(Token::NONE), line_number_(0), + last_indent_(0), cur_indent_(-1) {} + + /// Tokenization differs slightly between ninja files and Makefiles. + /// By default we tokenize as ninja files; calling this changes to + /// Makefile-style tokenization. + void SetMakefileFlavor() { + makefile_flavor_ = true; + } void Start(const char* start, const char* end); /// Report an error with a location pointing at the current token. @@ -91,7 +98,7 @@ struct Tokenizer { return SourceLocation(line_number_ + 1, token_.pos_ - cur_line_ + 1); } - bool whitespace_significant_; + bool makefile_flavor_; const char* cur_; const char* end_; |