diff --git a/README.rst b/README.rst index 0719ddd9b..ce135636b 100644 --- a/README.rst +++ b/README.rst @@ -4,7 +4,7 @@ An open-source interpreter for *The Source*. Usage ----- -The REPL is still under development. +The REPL is still under development, and is under the `source-academy/slang` repository. To build, @@ -14,10 +14,3 @@ To build, $ cd slang $ yarn $ yarn build - -To invoke the repl, run the built `slang.js`, - -.. code-block:: - - $ ./slang.js - > diff --git a/package.json b/package.json index 7d2d0541a..d5f07083b 100644 --- a/package.json +++ b/package.json @@ -37,8 +37,13 @@ "typescript": "^2.7.2" }, "jest": { - "moduleFileExtensions": [ "ts", "js" ], - "transform": {"\\.ts$": "/node_modules/ts-jest/preprocessor.js"}, + "moduleFileExtensions": [ + "ts", + "js" + ], + "transform": { + "\\.ts$": "/node_modules/ts-jest/preprocessor.js" + }, "testRegex": "/__tests__/.*\\.ts$" } } diff --git a/slang.js b/slang.js deleted file mode 100755 index 09b6aaf53..000000000 --- a/slang.js +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/sh -':' //; exec "$(command -v nodejs || command -v node)" "$0" "$@" - -'use strict'; - -const repl = require('./dist/repl.js') -const program = require('commander'); -program - .version('slang 0.1.0', '-v, --version') - .parse(process.argv); - -repl.startRepl(); diff --git a/src/repl.ts b/src/repl.ts deleted file mode 100644 index 5c09c600b..000000000 --- a/src/repl.ts +++ /dev/null @@ -1,31 +0,0 @@ -import * as repl from 'repl' -import { createContext, runInContext } from './index' - -const sourceCtxt = createContext() - -function fmtError(ctxt: any): string { - let error = ctxt.errors[0] - let line = error.location.start.line - let char = error.location.start.column - let errType = error.type + error.severity - return errType + ' at ' + line + ':' + char -} - -function sourceEval(cmd: string, context: any, filename: any, callback: any): any { - let promise = runInContext(cmd, sourceCtxt) - promise.then((obj) => { - if (obj.status == 'finished') { - callback(null, obj.value) - } else { - callback(fmtError(obj), null) - } - }) -} - -export function startRepl() { - repl.start({ - prompt: '>>> ', - eval: sourceEval - }) - runInContext('var __week__ = ' + sourceCtxt.chapter + ';', sourceCtxt) -}