Ninja
dyndep_parser.h
Go to the documentation of this file.
1 // Copyright 2015 Google Inc. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef NINJA_DYNDEP_PARSER_H_
16 #define NINJA_DYNDEP_PARSER_H_
17 
18 #include "eval_env.h"
19 #include "parser.h"
20 
21 struct DyndepFile;
22 struct EvalString;
23 
24 /// Parses dyndep files.
25 struct DyndepParser: public Parser {
26  DyndepParser(State* state, FileReader* file_reader,
27  DyndepFile* dyndep_file);
28 
29  /// Parse a text string of input. Used by tests.
30  bool ParseTest(const std::string& input, std::string* err) {
31  return Parse("input", input, err);
32  }
33 
34 private:
35  /// Parse a file, given its contents as a string.
36  bool Parse(const std::string& filename, const std::string& input,
37  std:: string* err);
38 
39  bool ParseDyndepVersion(std::string* err);
40  bool ParseLet(std::string* key, EvalString* val, std::string* err);
41  bool ParseEdge(std::string* err);
42 
45 };
46 
47 #endif // NINJA_DYNDEP_PARSER_H_
An Env which contains a mapping of variables to values as well as a pointer to a parent scope.
Definition: eval_env.h:93
Store data loaded from one dyndep file.
Definition: dyndep.h:42
Parses dyndep files.
Definition: dyndep_parser.h:25
bool ParseTest(const std::string &input, std::string *err)
Parse a text string of input. Used by tests.
Definition: dyndep_parser.h:30
bool ParseEdge(std::string *err)
BindingEnv env_
Definition: dyndep_parser.h:44
bool ParseLet(std::string *key, EvalString *val, std::string *err)
DyndepFile * dyndep_file_
Definition: dyndep_parser.h:43
bool ParseDyndepVersion(std::string *err)
bool Parse(const std::string &filename, const std::string &input, std::string *err)
Parse a file, given its contents as a string.
DyndepParser(State *state, FileReader *file_reader, DyndepFile *dyndep_file)
A tokenized string that contains variable references.
Definition: eval_env.h:35
Interface for reading files from disk.
Base class for parsers.
Definition: parser.h:26
Global state (file status) for a single run.
Definition: state.h:95