diff --git a/balloon/balloon_lexer.h b/balloon/balloon_lexer.h index e7b5864..7c1731a 100644 --- a/balloon/balloon_lexer.h +++ b/balloon/balloon_lexer.h @@ -81,11 +81,15 @@ bool check_number(std::string str) class resource_file { private: - std::list resource; + std::list libsource; // place for lib code + std::list resource; // place for user code + std::list totalsource; // link lib and user code public: void set_clear() { resource.clear(); + libsource.clear(); + totalsource.clear(); return; } void add_lib() @@ -95,12 +99,34 @@ class resource_file if(access("lib/math.nas",0)) std::cout<<">>[Resource] lack lib file: lib/math.nas ."<>[Resource] lack lib file: lib/io.nas ."<>[Resource] cannot find a file named \'"<& get_resource() { - return resource; + totalsource.clear(); + for(std::list::iterator i=libsource.begin();i!=libsource.end();++i) + totalsource.push_back(*i); + for(std::list::iterator i=resource.begin();i!=resource.end();++i) + totalsource.push_back(*i); + return totalsource; } void print_file() { diff --git a/balloon/main.cpp b/balloon/main.cpp index cee21b8..1d06e83 100644 --- a/balloon/main.cpp +++ b/balloon/main.cpp @@ -25,8 +25,7 @@ int main() std::cout<<">> 7. [del ] |delete program in memory."<> 8. [run ] |run the programme in stack. (-lexer -parser)"<> 9. [rs ] |check the source program."<>10. [lib ] |add lib into resource codes."<>11. [sound ] |make noise(?)."<>10. [sound ] |make noise(?)."<>[Lexer] error(s) found,stop."<