00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef FALCON_INTCOMP_H
00017 #define FALCON_INTCOMP_H
00018
00019 #include <falcon/setup.h>
00020 #include <falcon/compiler.h>
00021 #include <falcon/module.h>
00022 #include <falcon/vm.h>
00023 #include <falcon/intcomp.h>
00024
00025 namespace Falcon
00026 {
00027
00028 class ModuleLoader;
00029
00044 class FALCON_DYN_CLASS InteractiveCompiler: public Compiler
00045 {
00046 VMachine *m_vm;
00047 LiveModule *m_lmodule;
00048 ModuleLoader *m_loader;
00049 bool m_interactive;
00050
00051 void loadNow( const String &name, bool isFilename );
00052 public:
00053
00059 InteractiveCompiler( ModuleLoader *loader, VMachine *vm );
00060 ~InteractiveCompiler();
00061
00062 typedef enum {
00064 e_nothing,
00066 e_more,
00068 e_incomplete,
00070 e_decl,
00072 e_statement,
00074 e_expression,
00078 e_call,
00079
00080 e_terminated
00081 } t_ret_type;
00082
00093 t_ret_type compileNext( Stream *input );
00094
00098 t_ret_type compileNext( const String &input );
00099
00100 t_ret_type compileAll( const String &input );
00101
00102 VMachine *vm() const { return m_vm; }
00103
00104 virtual void addLoad( const String &name, bool isFilename );
00105 virtual void addNamespace( const String &nspace, const String &alias, bool full=false, bool filename=false );
00106
00107
00108 ModuleLoader *loader() const { return m_loader; }
00109 void loader( ModuleLoader *l ) { m_loader = l; }
00110
00111
00112 bool interactive() const { return m_interactive; }
00121 void interactive( bool iactive ) { m_interactive = iactive; }
00122 };
00123
00124 }
00125
00126 #endif
00127
00128