• 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 string& input, 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 string& filename, const string& input, string* err);
37 
38   bool ParseDyndepVersion(string* err);
39   bool ParseLet(string* key, EvalString* val, string* err);
40   bool ParseEdge(string* err);
41 
42   DyndepFile* dyndep_file_;
43   BindingEnv env_;
44 };
45 
46 #endif  // NINJA_DYNDEP_PARSER_H_
47