diff --git a/pom.xml b/pom.xml index e2eda25..d4a3eeb 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,8 @@ UTF-8 src/main/frege - 3.21.190-g714a7cc + frege-3.21.232-g7b05453 + 1.0.5 @@ -44,36 +45,25 @@ - maven-antrun-plugin - 1.7 + com.theoryinpractise.frege + frege-maven-plugin + ${frege.plugin.version} - compile - - - - - - - - - - - - - - - - - - + compile + generate-sources - run + compile + + true + true + false + + org.codehaus.mojo exec-maven-plugin @@ -143,11 +133,6 @@ jline 2.10 - - frege - frege - ${frege.version} - frege frege-interpreter @@ -159,9 +144,9 @@ 1.0-SNAPSHOT - org.eclipse.jdt.core.compiler - ecj - 3.7.2 + org.eclipse.jdt.core.compiler + ecj + 4.2.2 diff --git a/src/main/frege/frege/repl/FregeRepl.fr b/src/main/frege/frege/repl/FregeRepl.fr index e4ad4a9..ec100a6 100644 --- a/src/main/frege/frege/repl/FregeRepl.fr +++ b/src/main/frege/frege/repl/FregeRepl.fr @@ -9,7 +9,6 @@ import frege.interpreter.FregeScriptCompiler hiding(compile) import frege.interpreter.FregeInterpreter import frege.compiler.Data(Global) import frege.compiler.EclipseUtil as EU() -import frege.List as FL (Tree, values) data ReplState = ReplState { lastExternalScript :: Maybe String, @@ -69,7 +68,9 @@ evalScript (BrowseModule m) = do let moduleName = trim m replState <- Repl.get state <- Repl . lift $ Interpreter.get - global <- liftIO $ MemoryClassLoader.new state.loader state.classes >>= standardOptions + javac <- liftIO $ MemoryJavaCompiler.new state.loader state.classes + loader <- liftIO $ javac.classLoader + global <- liftIO $ standardOptions loader let res = outlineModule moduleName global return . ReplSuccess $ intercalate newLine res @@ -81,14 +82,21 @@ evalScript Browse = do else evalScript $ BrowseModule state.moduleName -evalScript (Type expr) = Repl.get >>= Repl . lift . interpret where - interpret replState = do +evalScript (Type expr) = do + state <- Repl . lift $ Interpreter.get + javac <- liftIO $ MemoryJavaCompiler.new state.loader state.classes + loader <- liftIO $ javac.classLoader + global <- liftIO $ standardOptions loader + let typeOfExpr = Repl . lift . interpret $ state + interpret replState = do oldState <- Interpreter.get typeOfExpression <- typeOfExpression expr Interpreter.put oldState case typeOfExpression of Right typ -> return $ ReplSuccess typ Left errs -> return $ ReplError errs + maybe typeOfExpr (return . ReplSuccess . flip getSymbolType global) $ lookupVarSymbol global.thisTab expr + evalScript (Load (urlSpec@#.*?://#)) = do urle <- liftIO $ URL.new urlSpec