• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
ParseTestDyndepParser30   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 
43   DyndepFile* dyndep_file_;
44   BindingEnv env_;
45 };
46 
47 #endif  // NINJA_DYNDEP_PARSER_H_
48