File: EisenParser.h

package info (click to toggle)
structure-synth 1.5.0-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,268 kB
  • ctags: 1,966
  • sloc: cpp: 10,209; python: 164; makefile: 71; sh: 15
file content (50 lines) | stat: -rw-r--r-- 1,216 bytes parent folder | download | duplicates (10)
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
41
42
43
44
45
46
47
48
49
50
#pragma once

#include "Tokenizer.h"
#include "../Model/Transformation.h"
#include "../Model/Rule.h"
#include "../Model/CustomRule.h"
#include "../Model/RuleSet.h"
#include "../Model/Action.h"

namespace StructureSynth {
	namespace Parser {	


		/// The' Eisenstein Engine' is a simple recursive descent parser,
		/// for parsing 'EisenScript'.
		class EisenParser {

		public:
			/// Constructor. 
			EisenParser(Tokenizer* tokenizer);

			/// Destructor, The tokenizer is not deleted.
			~EisenParser();

			/// Parses the input, and returns the corresponding ruleset.
			/// Throws a ParseError if any errors are encountered
			Model::RuleSet* parseRuleset();
			bool recurseDepthFirst() { return recurseDepth; }

		private:
			bool recurseDepth;
			void getSymbol();
			Model::Rule* rule();
			Model::RuleSet* ruleset();
			Model::Action action();
			Model::Action setAction();
			Model::Transformation transformationList();
			Model::Transformation transformation();
			void ruleModifierList(Model::CustomRule* customRule);
		
			bool accept(Symbol::SymbolType st);
			bool expect(Symbol::SymbolType st);
			Symbol symbol;

			Tokenizer* tokenizer;
		};

	}
}