Skip to content

Commit

Permalink
Merge pull request #31 from Frege/feature/3.22.524
Browse files Browse the repository at this point in the history
frege-repl-30 Fix #30, upgrade jline
  • Loading branch information
mmhelloworld committed Aug 15, 2015
2 parents 10a20e6 + afd2b89 commit 96980aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
8 changes: 7 additions & 1 deletion frege-repl-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ compileFrege {
inline = false
}

run{
standardInput = System.in
standardOutput = System.out
if (hasProperty("args"))
args project.args.split()
}

dependencies {
compile project(":frege-repl-nativedeps")
compile "jline:jline:2.12"
compile "jline:jline:2.13"
compile "org.frege-lang:frege-interpreter-core:$fregeInterpreterVersion"

testCompile "junit:junit:4.11"
Expand Down
19 changes: 5 additions & 14 deletions frege-repl-core/src/main/frege/frege/repl/FregeRepl.fr
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ import Compiler.enums.Flags
import Compiler.types.Global hiding (Message, Severity)
import Compiler.types.Global (Message CompilerMessage, Severity())
import Compiler.types.Positions
import Compiler.types.SourceDefinitions
import Compiler.enums.TokenID
import Compiler.types.SNames
import Compiler.types.ImportDetails
import Compiler.types.Tokens
import Java.Swing
import Java.Awt (Component, ActionListener)
import Java.Util (Scanner, ArrayList, Collection)
Expand Down Expand Up @@ -130,7 +125,10 @@ print console (cmd@(Eval line)) (CodeInfo sourceRepr g msgs) env = case sourceRe
(res, newEnv) <- Repl.run evalShow env
case res of
CodeInfo{} -> print console cmd res newEnv
_ -> printSymbolType console g sym
_ -> do
let typeCmd = Type line
(res, newEnv) <- Repl.run (eval typeCmd) env
print console typeCmd res newEnv
Expression sym = printSymbolType console g sym
Definitions syms markerSym = do
let symLabels = map (showSymbol g) $ filter (not . Symbol.{alias?}) newSyms
Expand Down Expand Up @@ -567,7 +565,7 @@ warmup = do
_ -> return $ Just "ignore"
return ()

main ("-terminal": "jline": otherOpts) = do
main = do
console <- ConsoleReader.new "frege" sysin System.out Nothing "UTF-8"
Runnable.new warmup >>= Thread.new >>= Thread.start
env <- ReplEnv.default
Expand All @@ -577,10 +575,3 @@ main ("-terminal": "jline": otherOpts) = do
repl console env
System.exit 0

main ("-terminal": invalidTerminal: otherOpts) = stderr.println $ "Invalid value for terminal: " ++ invalidTerminal

main _ = do
let console = ReaderWriterConsole stdin stdout
console.writeln welcome
ReplEnv.default >>= repl console
System.exit 0

0 comments on commit 96980aa

Please sign in to comment.