<commit_before>(import extra/argparse arg)
(import extra/term (colored))
(import lua/basic (load))
(import lua/coroutine co)
(import lua/debug debug)
(import lua/io io)
(import lua/os os)
(import lua/table table)
(import string)

(import urn/backend/lua lua)
(import urn/backend/writer writer)
(import urn/documentation docs)
(import urn/logger logger)
(import urn/logger/void void)
(import urn/logger)
(import urn/parser parser)

(define compile (.> (require "tacky.compile") :compile))

(define Scope (require "tacky.analysis.scope"))

(defun requires-input (str)
  "Determine whether STR requires additional input (such as quotes or parens).
   The returns false if no input is required, and nil if a syntax error occured."
  (case (list (pcall (lambda()
                       (parser/parse
                         void/void
                         (parser/lex void/void str "<stdin>" true)
                         true))))
    [(true _) false]
    [(false (as table? ?x)) (if (.> x :cont) true false)]
    [(false _) nil]))

(defun do-resolve (compiler scope str)
  :hidden
  (let* [(logger (.> compiler :log))
         (lexed (parser/lex logger str "<stdin>"))
         (parsed (parser/parse logger lexed))]
    (cadr (list (compile
                  compiler
                  lua/execute-states
                  parsed
                  scope)))))

(define repl-colour-scheme
  :hidden
  (when-let* [(ge os/getenv) ; actually check that os/getenv exists
              (clrs (ge "URN_COLOURS"))
              (scheme-alist (parser/read clrs))]
    scheme-alist))

(defun colour-for (elem) :hidden
  (if (assoc? repl-colour-scheme (string->symbol elem))
    (const-val (assoc repl-colour-scheme (string->symbol elem)))
    (case elem
      ["text" 0]
      ["arg" 36]
      ["mono" 97]
      ["bold" 1]
      ["italic" 3]
      ["link" 94])))
<commit_msg>Fix multi-line input on the REPL<commit_after>(import extra/argparse arg)
(import extra/term (colored))
(import lua/basic (load))
(import lua/coroutine co)
(import lua/debug debug)
(import lua/io io)
(import lua/os os)
(import lua/table table)
(import string)

(import urn/backend/lua lua)
(import urn/backend/writer writer)
(import urn/documentation docs)
(import urn/logger logger)
(import urn/logger/void void)
(import urn/logger)
(import urn/parser parser)

(define compile (.> (require "tacky.compile") :compile))

(define Scope (require "tacky.analysis.scope"))

(defun requires-input (str)
  "Determine whether STR requires additional input (such as quotes or parens).
   The returns false if no input is required, and nil if a syntax error occured."
  (case (list (pcall (lambda()
                       (parser/parse
                         void/void
                         (parser/lex void/void str "<stdin>" true)
                         true))))
    [(true _) false]
    [(false (table? @ ?x)) (if (.> x :cont) true false)]
    [(false ?x) (debug x) nil]))

(defun do-resolve (compiler scope str)
  :hidden
  (let* [(logger (.> compiler :log))
         (lexed (parser/lex logger str "<stdin>"))
         (parsed (parser/parse logger lexed))]
    (cadr (list (compile
                  compiler
                  lua/execute-states
                  parsed
                  scope)))))

(define repl-colour-scheme
  :hidden
  (when-let* [(ge os/getenv) ; actually check that os/getenv exists
              (clrs (ge "URN_COLOURS"))
              (scheme-alist (parser/read clrs))]
    scheme-alist))

(defun colour-for (elem) :hidden
  (if (assoc? repl-colour-scheme (string->symbol elem))
    (const-val (assoc repl-colour-scheme (string->symbol elem)))
    (case elem
      ["text" 0]
      ["arg" 36]
      ["mono" 97]
      ["bold" 1]
      ["italic" 3]
      ["link" 94])))

{'fraction_non_alphanumeric': 0.1380686352753392, 'fraction_numerical': 0.004788507581803671, 'mean_word_length': 2.4337899543378994, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, 'https://': 0, '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': '1160606', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1167, 'n_words': 369}