Rename runtimes with interpreter (#1082)

This commit is contained in:
Fábio Rosado
2023-01-16 18:52:31 +00:00
committed by GitHub
parent 5a3c414c8f
commit bb5c59307a
33 changed files with 497 additions and 370 deletions

View File

@@ -7,14 +7,14 @@ import { defaultKeymap } from '@codemirror/commands';
import { oneDarkTheme } from '@codemirror/theme-one-dark';
import { getAttribute, ensureUniqueId, htmlDecode } from '../utils';
import type { Runtime } from '../runtime';
import type { Interpreter } from '../interpreter';
import { pyExec, pyDisplay } from '../pyexec';
import { getLogger } from '../logger';
const logger = getLogger('py-repl');
const RUNBUTTON = `<svg style="height:20px;width:20px;vertical-align:-.125em;transform-origin:center;overflow:visible;color:green" viewBox="0 0 384 512" aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg"><g transform="translate(192 256)" transform-origin="96 0"><g transform="translate(0,0) scale(1,1)"><path d="M361 215C375.3 223.8 384 239.3 384 256C384 272.7 375.3 288.2 361 296.1L73.03 472.1C58.21 482 39.66 482.4 24.52 473.9C9.377 465.4 0 449.4 0 432V80C0 62.64 9.377 46.63 24.52 38.13C39.66 29.64 58.21 29.99 73.03 39.04L361 215z" fill="currentColor" transform="translate(-192 -256)"></path></g></g></svg>`;
export function make_PyRepl(runtime: Runtime) {
export function make_PyRepl(interpreter: Interpreter) {
/* High level structure of py-repl DOM, and the corresponding JS names.
this <py-repl>
@@ -166,11 +166,11 @@ export function make_PyRepl(runtime: Runtime) {
outEl.innerHTML = '';
// execute the python code
const pyResult = pyExec(runtime, pySrc, outEl);
const pyResult = pyExec(interpreter, pySrc, outEl);
// display the value of the last evaluated expression (REPL-style)
if (pyResult !== undefined) {
pyDisplay(runtime, pyResult, { target: outEl.id });
pyDisplay(interpreter, pyResult, { target: outEl.id });
}
this.autogenerateMaybe();