blob: 95b72414277f4b73c8a383caa9600bb9aad2628b [file] [log] [blame]
Shinichiro Hamaji1d545aa2015-06-23 15:29:13 +09001// 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
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090015#ifndef PARSER_H_
16#define PARSER_H_
17
Shinichiro Hamaji80456fb2015-06-18 14:56:10 +090018#include <vector>
19
20#include "loc.h"
Shinichiro Hamaji645cca72015-09-24 17:04:21 +090021#include "stmt.h"
Shinichiro Hamaji80456fb2015-06-18 14:56:10 +090022#include "string_piece.h"
23
24using namespace std;
25
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090026class Makefile;
27
28void Parse(Makefile* mk);
Shinichiro Hamaji645cca72015-09-24 17:04:21 +090029void Parse(StringPiece buf, const Loc& loc, vector<Stmt*>* out_asts);
Shinichiro Hamaji631a9f82015-07-05 14:18:15 +090030void ParseNotAfterRule(StringPiece buf, const Loc& loc,
Shinichiro Hamaji645cca72015-09-24 17:04:21 +090031 vector<Stmt*>* out_asts);
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090032
Shinichiro Hamaji9b16bda2015-06-19 14:25:17 +090033void ParseAssignStatement(StringPiece line, size_t sep,
34 StringPiece* lhs, StringPiece* rhs, AssignOp* op);
35
Shinichiro Hamaji42b625f2015-06-16 23:07:21 +090036void InitParser();
37void QuitParser();
38
Shinichiro Hamaji645cca72015-09-24 17:04:21 +090039const vector<ParseErrorStmt*>& GetParseErrors();
Shinichiro Hamajia06bee92015-08-05 17:13:05 +090040
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090041#endif // PARSER_H_