Move parser-specific stuff into its own class

This commit is contained in:
Jonathan Turner
2009-06-30 18:54:33 +00:00
parent ee44ae0ca0
commit 1bc71d21bd
5 changed files with 1189 additions and 1147 deletions

View File

@@ -650,7 +650,8 @@ namespace chaiscript {
retval = true; retval = true;
if (Char('(')) { if (Char('(')) {
if (!(Arg_List() && Char(')'))) { Arg_List();
if (!Char(')')) {
throw Parse_Error("Incomplete anonymous function", File_Position(line, col), filename); throw Parse_Error("Incomplete anonymous function", File_Position(line, col), filename);
} }
} }

View File

@@ -15,11 +15,11 @@ if(Boost_FOUND)
add_executable(chaiscript_test main.cpp) add_executable(chaiscript_test main.cpp)
target_link_libraries(chaiscript_test ${Boost_LIBRARIES}) target_link_libraries(chaiscript_test ${Boost_LIBRARIES})
add_executable(chaiscript_callbacktest callbacktest.cpp) #add_executable(chaiscript_callbacktest callbacktest.cpp)
target_link_libraries(chaiscript_callbacktest ${Boost_LIBRARIES}) #target_link_libraries(chaiscript_callbacktest ${Boost_LIBRARIES})
add_executable(sensors sensors.cpp) #add_executable(sensors sensors.cpp)
target_link_libraries(sensors ${Boost_LIBRARIES}) #target_link_libraries(sensors ${Boost_LIBRARIES})
endif() endif()

File diff suppressed because it is too large Load Diff

View File

@@ -424,13 +424,18 @@ namespace chaiscript
for (i = 0; i < node->children[0]->children.size(); ++i) { for (i = 0; i < node->children[0]->children.size(); ++i) {
param_names.push_back(node->children[0]->children[i]->text); param_names.push_back(node->children[0]->children[i]->text);
} }
}
//retval = boost::shared_ptr<dispatchkit::Proxy_Function>(new dispatchkit::Proxy_Function_Impl<boost::function<void (const std::string &)> >(&test)); //retval = boost::shared_ptr<dispatchkit::Proxy_Function>(new dispatchkit::Proxy_Function_Impl<boost::function<void (const std::string &)> >(&test));
retval = dispatchkit::Boxed_Value(boost::shared_ptr<dispatchkit::Proxy_Function>( retval = dispatchkit::Boxed_Value(boost::shared_ptr<dispatchkit::Proxy_Function>(
new dispatchkit::Dynamic_Proxy_Function( new dispatchkit::Dynamic_Proxy_Function(
boost::bind(&eval_function<Eval_System>, boost::ref(ss), node->children.back(), param_names, _1), node->children[0]->children.size()))); boost::bind(&eval_function<Eval_System>, boost::ref(ss), node->children.back(), param_names, _1), node->children[0]->children.size())));
} }
else {
//no parameters
retval = dispatchkit::Boxed_Value(boost::shared_ptr<dispatchkit::Proxy_Function>(
new dispatchkit::Dynamic_Proxy_Function(
boost::bind(&eval_function<Eval_System>, boost::ref(ss), node->children.back(), param_names, _1), 0)));
}
}
break; break;
case (Token_Type::Block) : { case (Token_Type::Block) : {

File diff suppressed because it is too large Load Diff