summaryrefslogtreecommitdiffstats
path: root/src/parsers.h
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-05-01 01:49:50 (GMT)
committerEvan Martin <martine@danga.com>2011-05-01 02:03:12 (GMT)
commitf3910e0ca2b5d5d3f900fe356f8fd81b8828ec09 (patch)
tree870998bffa3a0e427a14daa15d75ac22c243db59 /src/parsers.h
parentbce2d134b166c570e659ff43923103f241a614de (diff)
downloadNinja-f3910e0ca2b5d5d3f900fe356f8fd81b8828ec09.zip
Ninja-f3910e0ca2b5d5d3f900fe356f8fd81b8828ec09.tar.gz
Ninja-f3910e0ca2b5d5d3f900fe356f8fd81b8828ec09.tar.bz2
drop reserved words 'build'/'rule'/'subninja'/etc.
Instead, parse them as normal words, which makes them work as paths. We instead rely on the *position* (i.e., we start a statement with a keyword and not a path) to distinguish the keyword 'build' from the file 'build'.
Diffstat (limited to 'src/parsers.h')
-rw-r--r--src/parsers.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/parsers.h b/src/parsers.h
index 58d2bd7..9dc61d9 100644
--- a/src/parsers.h
+++ b/src/parsers.h
@@ -29,10 +29,6 @@ struct Token {
NONE,
UNKNOWN,
IDENT,
- RULE,
- BUILD,
- SUBNINJA,
- INCLUDE,
NEWLINE,
EQUALS,
COLON,
@@ -69,6 +65,7 @@ struct Tokenizer {
void SkipWhitespace(bool newline=false);
bool Newline(string* err);
bool ExpectToken(Token::Type expected, string* err);
+ bool ExpectIdent(const char* expected, string* err);
bool ReadIdent(string* out);
bool ReadToNewline(string* text, string* err,
size_t max_length=std::numeric_limits<size_t>::max());
@@ -118,7 +115,7 @@ struct ManifestParser {
bool ParseEdge(string* err);
/// Parse either a 'subninja' or 'include' line.
- bool ParseFileInclude(Token::Type type, string* err);
+ bool ParseFileInclude(string* err);
State* state_;
BindingEnv* env_;