diff --git a/include/chaiscript/language/chaiscript_common.hpp b/include/chaiscript/language/chaiscript_common.hpp index 09e16d2..38cf8e6 100644 --- a/include/chaiscript/language/chaiscript_common.hpp +++ b/include/chaiscript/language/chaiscript_common.hpp @@ -33,7 +33,7 @@ namespace chaiscript /// Types of AST nodes available to the parser and eval enum class AST_Node_Type { Error, Id, Char, Str, Eol, Fun_Call, Arg_List, Variable, Equation, Var_Decl, - Comparison, Addition, Subtraction, Multiplication, Division, Modulus, Array_Call, Dot_Access, Quoted_String, Single_Quoted_String, + Comparison, Addition, Subtraction, Multiplication, Division, Modulus, Array_Call, Dot_Access, Lambda, Block, Def, While, If, For, Inline_Array, Inline_Map, Return, File, Prefix, Break, Continue, Map_Pair, Value_Range, Inline_Range, Annotation, Try, Catch, Finally, Method, Attr_Decl, Shift, Equality, Bitwise_And, Bitwise_Xor, Bitwise_Or, Logical_And, Logical_Or, Reference, Switch, Case, Default, Ternary_Cond, Noop, Class, Binary, Arg, Global_Decl, Constant @@ -45,7 +45,7 @@ namespace chaiscript /// Helper lookup to get the name of each node type const char *ast_node_type_to_string(AST_Node_Type ast_node_type) { static const char * const ast_node_types[] = { "Internal Parser Error", "Id", "Char", "Str", "Eol", "Fun_Call", "Arg_List", "Variable", "Equation", "Var_Decl", - "Comparison", "Addition", "Subtraction", "Multiplication", "Division", "Modulus", "Array_Call", "Dot_Access", "Quoted_String", "Single_Quoted_String", + "Comparison", "Addition", "Subtraction", "Multiplication", "Division", "Modulus", "Array_Call", "Dot_Access", "Lambda", "Block", "Def", "While", "If", "For", "Inline_Array", "Inline_Map", "Return", "File", "Prefix", "Break", "Continue", "Map_Pair", "Value_Range", "Inline_Range", "Annotation", "Try", "Catch", "Finally", "Method", "Attr_Decl", "Shift", "Equality", "Bitwise_And", "Bitwise_Xor", "Bitwise_Or", "Logical_And", "Logical_Or", "Reference", "Switch", "Case", "Default", "Ternary Condition", "Noop", "Class", "Binary", "Arg", "Constant"}; diff --git a/include/chaiscript/language/chaiscript_eval.hpp b/include/chaiscript/language/chaiscript_eval.hpp index 61413a7..bb4fa3c 100644 --- a/include/chaiscript/language/chaiscript_eval.hpp +++ b/include/chaiscript/language/chaiscript_eval.hpp @@ -562,41 +562,6 @@ namespace chaiscript const std::string m_fun_name; }; - struct Quoted_String_AST_Node final : AST_Node { - Quoted_String_AST_Node(std::string t_ast_node_text, Parse_Location t_loc) : - AST_Node(std::move(t_ast_node_text), AST_Node_Type::Quoted_String, std::move(t_loc)), - m_value(const_var(text)) { } - - Boxed_Value eval_internal(const chaiscript::detail::Dispatch_State &) const override { - return m_value; - } - - std::string pretty_print() const override - { - return "\"" + text + "\""; - } - - private: - Boxed_Value m_value; - }; - - struct Single_Quoted_String_AST_Node final : AST_Node { - Single_Quoted_String_AST_Node(std::string t_ast_node_text, Parse_Location t_loc) : - AST_Node(std::move(t_ast_node_text), AST_Node_Type::Single_Quoted_String, std::move(t_loc)), - m_value(const_var(char(text.at(0)))) { } - - Boxed_Value eval_internal(const chaiscript::detail::Dispatch_State &) const override{ - return m_value; - } - - std::string pretty_print() const override - { - return "'" + text + "'"; - } - - private: - Boxed_Value m_value; - }; struct Lambda_AST_Node final : AST_Node { Lambda_AST_Node(std::string t_ast_node_text, Parse_Location t_loc, std::vector t_children) : diff --git a/include/chaiscript/language/chaiscript_parser.hpp b/include/chaiscript/language/chaiscript_parser.hpp index ee745b7..2df9d3f 100644 --- a/include/chaiscript/language/chaiscript_parser.hpp +++ b/include/chaiscript/language/chaiscript_parser.hpp @@ -1106,11 +1106,11 @@ namespace chaiscript if (cparser.is_interpolated) { //If we've seen previous interpolation, add on instead of making a new one - m_match_stack.push_back(make_node(match, start.line, start.col)); + m_match_stack.push_back(make_node(match, start.line, start.col, const_var(match))); build_match(prev_stack_top, "+"); } else { - m_match_stack.push_back(make_node(match, start.line, start.col)); + m_match_stack.push_back(make_node(match, start.line, start.col, const_var(match))); } //We've finished with the part of the string up to this point, so clear it @@ -1162,11 +1162,11 @@ namespace chaiscript }(); if (is_interpolated) { - m_match_stack.push_back(make_node(match, start.line, start.col)); + m_match_stack.push_back(make_node(match, start.line, start.col, const_var(match))); build_match(prev_stack_top, "+"); } else { - m_match_stack.push_back(make_node(match, start.line, start.col)); + m_match_stack.push_back(make_node(match, start.line, start.col, const_var(match))); } return true; } else { @@ -1227,7 +1227,7 @@ namespace chaiscript throw exception::eval_error("Single-quoted strings must be 1 character long", File_Position(m_position.line, m_position.col), *m_filename); } - m_match_stack.push_back(make_node(match, start.line, start.col)); + m_match_stack.push_back(make_node(match, start.line, start.col, const_var(char(match.at(0))))); return true; } else {