blob: e4cf7c21359eac1061c9f04bb3eca58e465d586c [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);
Dan Willemsen3ce083f2017-10-11 22:17:48 -070030void ParseNotAfterRule(StringPiece buf,
31 const Loc& loc,
Shinichiro Hamaji645cca72015-09-24 17:04:21 +090032 vector<Stmt*>* out_asts);
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090033
Dan Willemsen3ce083f2017-10-11 22:17:48 -070034void ParseAssignStatement(StringPiece line,
35 size_t sep,
36 StringPiece* lhs,
37 StringPiece* rhs,
38 AssignOp* op);
Shinichiro Hamaji9b16bda2015-06-19 14:25:17 +090039
Shinichiro Hamaji42b625f2015-06-16 23:07:21 +090040void InitParser();
41void QuitParser();
42
Shinichiro Hamaji645cca72015-09-24 17:04:21 +090043const vector<ParseErrorStmt*>& GetParseErrors();
Shinichiro Hamajia06bee92015-08-05 17:13:05 +090044
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090045#endif // PARSER_H_