• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

RauliL / juokse / 6077080524

04 Sep 2023 07:36PM UTC coverage: 72.289% (-2.0%) from 74.324%
6077080524

push

github

web-flow
Merge pull request #23 from RauliL/interactive

Add very simple interactive mode

172 of 242 branches covered (0.0%)

Branch coverage included in aggregate %.

26 of 26 new or added lines in 4 files covered. (100.0%)

488 of 671 relevant lines covered (72.73%)

140.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/interactive.ts
1
import * as readline from "readline";
×
2

3
import { Statement } from "./ast";
4
import { Context } from "./context";
5
import { executeScript } from "./execute";
×
6
import { lex } from "./lexer";
×
7
import { parse } from "./parser";
×
8
import { ExitStatus } from "./status";
×
9

10
export const runInteractive = (context: Context) => {
×
11
  const rl = readline.createInterface({
×
12
    input: process.stdin,
13
    output: process.stdout,
14
    prompt: "juokse:1> ",
15
  });
16
  let lineNumber = 1;
×
17

18
  rl.on("line", (source) => {
×
19
    let script: Statement[];
20

21
    try {
×
22
      script = parse(lex("<stdin>", lineNumber++, source));
×
23
    } catch (err) {
24
      console.error(err);
×
25
      return;
×
26
    }
27

28
    executeScript(context, script)
×
29
      .catch((err) => {
30
        console.error(err);
×
31
      })
32
      .finally(() => {
33
        rl.setPrompt(`juokse:${lineNumber}> `);
×
34
        rl.prompt();
×
35
      });
36
  });
37

38
  rl.on("close", () => {
×
39
    process.exit(ExitStatus.OK);
×
40
  });
41

42
  rl.prompt();
×
43
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc