aboutsummaryrefslogtreecommitdiff
path: root/src/buildparser.h
blob: 7e6e348027f243478eed805810e88110b6af3afa (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/string.h"
#include "types.h"

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

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

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

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

	class Ast &xAst;

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

private:
	Bu::Stack<Bu::String> 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