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
,
85 anonymous_function_declaration
,
97 namespace lexeme_group
114 typedef std::vector
<lexeme
> lexeme_container
;
115 typedef std::vector
<line_of_code
> lines_of_code
;
119 lexeme_type::type type
;
123 types::signed_integer signed_integer
;
124 types::unsigned_integer unsigned_integer
;
125 types::floating_point_value floating_point_value
;
126 std::string
* string
;
130 lexeme(lexeme
const & other
);
131 lexeme(lexeme_type::type type
);
132 explicit lexeme(types::boolean boolean
);
133 explicit lexeme(types::signed_integer signed_integer
);
134 explicit lexeme(types::unsigned_integer unsigned_integer
);
135 explicit lexeme(types::floating_point_value floating_point_value
);
136 explicit lexeme(std::string
const & string
);
140 std::string
to_string() const;
142 lexeme
& operator=(lexeme
const & other
);
144 void copy(lexeme
const & other
);
147 bool is_string() const;
153 uword indentation_level
;
154 lexeme_container lexemes
;
159 struct operator_lexeme
161 lexeme_type::type lexeme
;
164 operator_lexeme(lexeme_type::type lexeme
, std::string
const & string
);
165 bool operator<(operator_lexeme
const & other
) const;
171 lexer(std::string
const & input
, lines_of_code
& lines
);
172 bool parse(std::string
& error
);
175 std::string
const & input
;
176 lines_of_code
& lines
;
183 line_of_code current_line
;
185 bool parse_operator(line_of_code
& output
);
186 void parse_string(line_of_code
& output
);
187 bool parse_number(line_of_code
& output
);
188 void parse_name(line_of_code
& output
);
189 void parse_comment();
191 void lexer_error(std::string
const & message
, uword error_line
= 0);
192 void number_parsing_error(std::string
const & message
);
194 bool is_name_char(char input
);
195 bool string_match(std::string
const & target
);
196 void process_newline();
198 void parse_lexemes();
201 std::string
visualise_lexemes(lines_of_code
& lines
);
203 void initialise_tables();
205 bool get_lexeme_group(lexeme_type::type input
, lexeme_group::type
& output
);
207 extern boost::mutex table_mutex
;
208 extern std::vector
<operator_lexeme
> operator_lexeme_data
;