aboutsummaryrefslogtreecommitdiff
path: root/src/buildparser.h
blob: 8e2af6c3fb4918657c07536fd2f886587f602ee6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef BUILD_PARSER_H
#define BUILD_PARSER_H

#include "build.tab.h"

#include "bu/stack.h"
#include "bu/fstring.h"
#include "types.h"

class BuildParser
{
public:
	BuildParser( class Ast &rAst );
	virtual ~BuildParser();

	void load( const Bu::FString &sFile );

	bool isKeyword( const Bu::FString &sStr );
	bool isCond( const Bu::FString &sStr );
	void include( const Bu::FString &sStr, void *scanner, YYLTYPE *loc );
	void endInclude( YYLTYPE *loc );

	void error( int iLine1, int iLine2, int iCol1, int iCol2,
		const Bu::FString &sMsg );

	class Ast &xAst;

	void addIncludePath( const Bu::FString &sPath );

private:
	Bu::Stack<Bu::FString> sFilename;
	Bu::Stack<YYLTYPE> sLocation;
	StrList lIncludePaths;
};

typedef void * yyscan_t;
#define YY_DECL int build_lex( YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner, BuildParser &b )
YY_DECL;

#endif