The omnipotent crawling chaos, Portal!
[fridhskrift.git] / frith / interpreter.hpp
blob788fae70133ce67c5f643c05245214e6b22b329f
1 #pragma once
3 #include <string>
4 #include <vector>
5 #include <frith/symbol.hpp>
7 namespace frith
9 namespace match_result
11 enum type
13 no_match,
14 match,
15 error,
19 namespace process_line_result
21 enum type
23 ok,
24 end_of_block,
25 error,
29 class interpreter
31 public:
32 interpreter();
33 bool load_module(std::string const & path, std::string const & name, std::string & error_message);
35 private:
36 bool running;
38 module main_module;
39 std::vector<module> modules;
41 std::size_t
42 line_offset,
43 line_end;
45 uword indentation_level;
47 std::size_t
48 lexeme_offset,
49 lexeme_end;
51 std::string error_message;
53 bool in_a_class;
55 std::vector<line_of_code> lines;
57 symbol_tree_node * current_node;
59 bool translate_data(module & target_module, std::string const & data, std::string const & module_name, std::string & error_message_output);
61 void error(std::string const & message);