1 #include <frith/lexer.hpp>
2 #include <ail/string.hpp>
10 lexeme_type::lexeme(lexeme_type::type type
):
15 lexeme_type::lexeme(types::boolean boolean
):
21 lexeme_type::lexeme(types::signed_integer signed_integer
):
23 signed_integer(signed_integer
)
27 lexeme_type::lexeme(types::unsigned_integer unsigned_integer
):
28 type(unsigned_integer
),
29 unsigned_integer(unsigned_integer
)
33 lexeme_type::lexeme(types::floating_point_value floating_point_value
):
34 type(floating_point_value
),
35 floating_point_value(floating_point_value
)
39 lexeme_type::lexeme(lexeme_type::type type
, std::string
const & string
):
41 string(new std::string(string
))
45 std::string
lexeme_type::to_string() const
47 using namespace lexeme_type
;
52 return "name: " + *string
;
55 return "boolean: " + ail::bool_to_string(boolean
);
58 return "integer: " + ail::number_to_string(signed_integer
);
60 case unsigned_integer
:
61 return "unsigned-integer: " + ail::number_to_string(unsigned_integer
);
63 case floating_point_value
:
64 return "float: " + ail::number_to_string(floating_point_value
);
67 return "string: " + ail::replace_string(*string
, "\n", "\\n");
87 case addition_assignment
:
90 case subtraction_assignment
:
93 case multiplication_assignment
:
96 case division_assignment
:
99 case modulo_assignment
:
114 case less_than_or_equal
:
120 case greater_than_or_equal
:
157 return "bracket: start";
160 return "bracket: end";
163 return "array: start";
169 return "symbol_tree_node: start";
172 return "symbol_tree_node: end";
180 case function_declaration
:
183 case anonymous_function_declaration
:
184 return "anonymous function";
187 return "class operator";
189 case selection_operator
: