Skip to content

Commit

Permalink
Frege 3.21.232-g7b05453 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mmhelloworld committed Sep 29, 2013
1 parent 6ea3d8d commit 9b23412
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 36 deletions.
49 changes: 17 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceDirectory>src/main/frege</project.build.sourceDirectory>
<frege.version>3.21.190-g714a7cc</frege.version>
<frege.version>frege-3.21.232-g7b05453</frege.version>
<frege.plugin.version>1.0.5</frege.plugin.version>
</properties>
<build>
<pluginManagement>
Expand Down Expand Up @@ -44,36 +45,25 @@
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<groupId>com.theoryinpractise.frege</groupId>
<artifactId>frege-maven-plugin</artifactId>
<version>${frege.plugin.version}</version>
<executions>
<execution>
<phase>compile</phase>
<configuration>
<target>
<property name="compile_classpath" refid="maven.compile.classpath" />
<property name="outputDir"
value="${project.build.outputDirectory}" />
<property name="sourceDir" value="src/main/frege" />
<property name="fregec" value="${frege:frege:jar}" />
<exec executable="java" failonerror="true">
<arg value="-Xss1m" />
<arg value="-Dfrege.javac=javac" />
<arg value="-classpath" />
<arg value="${compile_classpath}" />
<arg value="frege.compiler.Main" />
<arg value="-d" />
<arg path="${outputDir}" />
<arg value="${sourceDir}/frege/repl/FregeRepl.fr" />
</exec>
</target>
</configuration>
<id>compile</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<inline>true</inline>
<hints>true</hints>
<includeStale>false</includeStale>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
Expand Down Expand Up @@ -143,11 +133,6 @@
<artifactId>jline</artifactId>
<version>2.10</version>
</dependency>
<dependency>
<groupId>frege</groupId>
<artifactId>frege</artifactId>
<version>${frege.version}</version>
</dependency>
<dependency>
<groupId>frege</groupId>
<artifactId>frege-interpreter</artifactId>
Expand All @@ -159,9 +144,9 @@
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>3.7.2</version>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>4.2.2</version>
</dependency>
</dependencies>
</project>
16 changes: 12 additions & 4 deletions src/main/frege/frege/repl/FregeRepl.fr
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 9b23412

Please sign in to comment.