<commit_before>#! /usr/bin/env node
/*
 * jslisp-cli
 * https://github.com/TheThirdOne/jslisp-cli
 *
 * Copyright (c) 2014 <NAME>
 * Licensed under the MIT license.
 */
var JSLisp = require('jslisp');

var readline = require('readline'),
rl = readline.createInterface(process.stdin, process.stdout);
rl.setPrompt('ijl> ');
rl.prompt();
rl.on('line', function(line) { //All the magic starts here
    loop(line);
}).on('close', function() {
    console.log('\nHave a great day!');
    process.exit(0);
});
function cont(){ //here if i need to edit later
    rl.prompt();
}
function loop(line){ //main loop
    console.log(JSLisp.runtime.run(JSLisp.compiler.parse(line)));
    cont();
}<commit_msg>added multi-line interactive support<commit_after>#! /usr/bin/env node
/*
 * jslisp-cli
 * https://github.com/TheThirdOne/jslisp-cli
 *
 * Copyright (c) 2014 <NAME>
 * Licensed under the MIT license.
 */
var JSLisp = require('jslisp');

var readline = require('readline'),
temp = '',
rl = readline.createInterface(process.stdin, process.stdout);
rl.setPrompt('ijl> ');
rl.prompt();
rl.on('line', function(line) { //All the magic starts here
    loop(line);
}).on('close', function() {
    console.log('\nHave a great day!');
    process.exit(0);
});
function cont(){ //here if i need to edit later
    rl.prompt();
}
function loop(line){ //main loop
    try{
      console.log(JSLisp.runtime.run(JSLisp.compiler.parse(temp+line)));
      temp = '';
      rl.setPrompt('ijl> ');
    }catch(e){
      if(e === "Unexpected end of file. Expecting )"){
        rl.setPrompt(' ... ');
        temp += line + ' ';
      }else{
        rl.setPrompt('ijl> ');
        temp = '';
        console.log(e);
      }
    }
    cont();
}
{'fraction_non_alphanumeric': 0.18997668997668998, 'fraction_numerical': 0.005827505827505828, 'mean_word_length': 3.2186732186732185, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6902701', 'n_tokens_mistral': 610, 'n_tokens_neox': 590, 'n_words': 133}