5 #include <ail/types.hpp>
6 #include <fridh/symbol.hpp>
7 #include <fridh/construction.hpp>
8 #include <boost/thread/mutex.hpp>
18 non_terminating_placeholder
,
40 subtraction_assignment
,
41 multiplication_assignment
,
44 exponentiation_assignment
,
52 greater_than_or_equal
,
87 anonymous_function_declaration
,
99 namespace lexeme_group
116 typedef std::vector
<lexeme
> lexeme_container
;
117 typedef std::vector
<line_of_code
> lines_of_code
;
121 lexeme_type::type type
;
125 types::signed_integer signed_integer
;
126 types::unsigned_integer unsigned_integer
;
127 types::floating_point_value floating_point_value
;
128 std::string
* string
;
132 lexeme(lexeme
const & other
);
133 lexeme(lexeme_type::type type
);
134 explicit lexeme(types::boolean boolean
);
135 explicit lexeme(types::signed_integer signed_integer
);
136 explicit lexeme(types::unsigned_integer unsigned_integer
);
137 explicit lexeme(types::floating_point_value floating_point_value
);
138 explicit lexeme(std::string
const & string
);
142 std::string
to_string() const;
144 lexeme
& operator=(lexeme
const & other
);
146 void copy(lexeme
const & other
);
149 bool is_string() const;
155 uword indentation_level
;
156 lexeme_container lexemes
;
161 struct operator_lexeme
163 lexeme_type::type lexeme
;
166 operator_lexeme(lexeme_type::type lexeme
, std::string
const & string
);
167 bool operator<(operator_lexeme
const & other
) const;
173 lexer(std::string
const & input
, lines_of_code
& lines
);
174 bool parse(std::string
& error
);
177 std::string
const & input
;
178 lines_of_code
& lines
;
185 line_of_code current_line
;
187 bool parse_operator(line_of_code
& output
);
188 void parse_string(line_of_code
& output
);
189 bool parse_number(line_of_code
& output
);
190 void parse_name(line_of_code
& output
);
191 void parse_comment();
193 void lexer_error(std::string
const & message
, uword error_line
= 0);
194 void number_parsing_error(std::string
const & message
);
196 bool is_name_char(char input
);
197 bool string_match(std::string
const & target
);
198 void process_newline(bool next_line
= true);
200 void parse_lexemes();
202 void process_one_liner(word summand
);
205 std::string
visualise_lexemes(lines_of_code
& lines
);
207 void initialise_tables();
209 bool get_lexeme_group(lexeme_type::type input
, lexeme_group::type
& output
);
211 extern boost::mutex table_mutex
;
212 extern std::vector
<operator_lexeme
> operator_lexeme_data
;