xref: /haiku/src/tests/add-ons/print/ppd/parser/PPDParser.h (revision 17889a8c70dbb3d59c1412f6431968753c767bab)
1 /*
2  * Copyright 2008, Haiku.
3  * Distributed under the terms of the MIT license.
4  *
5  * Authors:
6  *		Michael Pfeiffer <laplace@users.sourceforge.net>
7  */
8 
9 #ifndef _PPD_PARSER_H
10 #define _PPD_PARSER_H
11 
12 #include "PPD.h"
13 #include "Parser.h"
14 #include "Statement.h"
15 #include "StatementWrapper.h"
16 
17 class RequiredKeywords;
18 
19 class PPDParser : public Parser
20 {
21 private:
22 	PPD*              fPPD;
23 	StatementList     fStack; // of nested statements
24 	RequiredKeywords* fRequiredKeywords;
25 	bool              fParseAll;
26 
27 	void Push(Statement* statement);
28 	Statement* Top();
29 	void Pop();
30 
31 	// Add statement to PPD or the children of a
32 	// nested statement
33 	void AddStatement(Statement* statement);
34 
35 	bool IsValidOpenStatement(GroupStatement* statement);
36 	bool IsValidCloseStatement(GroupStatement* statement);
37 	bool ParseStatement(Statement* statement);
38 	bool ParseStatements();
39 	PPD* Parse(bool all);
40 
41 public:
42 	PPDParser(const char* file);
43 	~PPDParser();
44 
45 	PPD* ParseAll();
46 	PPD* ParseHeader();
47 };
48 
49 #endif
50