Revert whitespace fixes to third_party (#501)

This commit is contained in:
Jared Miller 2022-07-22 00:46:07 -04:00 committed by GitHub
parent d4000bb8f7
commit 9de3d8f1e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
365 changed files with 39190 additions and 39211 deletions

View file

@ -1,6 +1,6 @@
/*
* QuickJS Read Eval Print Loop
*
*
* Copyright (c) 2017-2020 Fabrice Bellard
* Copyright (c) 2017-2020 Charlie Gordon
*
@ -31,7 +31,7 @@ import * as os from "os";
/* add 'os' and 'std' bindings */
g.os = os;
g.std = std;
/* close global objects */
var Object = g.Object;
var String = g.String;
@ -45,7 +45,7 @@ import * as os from "os";
var config_numcalc = (typeof os.open === "undefined");
var has_jscalc = (typeof Fraction === "function");
var has_bignum = (typeof BigFloat === "function");
var colors = {
none: "\x1b[0m",
black: "\x1b[30m",
@ -105,7 +105,7 @@ import * as os from "os";
var prec;
var expBits;
var log2_10;
var pstate = "";
var prompt = "";
var plen = 0;
@ -119,7 +119,7 @@ import * as os from "os";
var show_time = false;
var show_colors = true;
var eval_time = 0;
var mexpr = "";
var level = 0;
var cmd = "";
@ -137,12 +137,12 @@ import * as os from "os";
var term_read_buf;
var term_width;
/* current X position of the cursor in the terminal */
var term_cursor_x = 0;
var term_cursor_x = 0;
function termInit() {
var tab;
term_fd = std.in.fileno();
/* get the terminal size */
term_width = 80;
if (os.isatty(term_fd)) {
@ -169,14 +169,14 @@ import * as os from "os";
/* send Ctrl-C to readline */
handle_byte(3);
}
function term_read_handler() {
var l, i;
l = os.read(term_fd, term_read_buf.buffer, 0, term_read_buf.length);
for(i = 0; i < l; i++)
handle_byte(term_read_buf[i]);
}
function handle_byte(c) {
if (!utf8) {
handle_char(c);
@ -194,12 +194,12 @@ import * as os from "os";
handle_char(c);
}
}
function is_alpha(c) {
return typeof c === "string" &&
((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'));
}
function is_digit(c) {
return typeof c === "string" && (c >= '0' && c <= '9');
}
@ -231,7 +231,7 @@ import * as os from "os";
d = c.codePointAt(0); /* can be NaN if empty string */
return d >= 0xdc00 && d < 0xe000;
}
function is_balanced(a, b) {
switch (a + b) {
case "()":
@ -270,7 +270,7 @@ import * as os from "os";
} else {
l = Math.min(term_width - 1 - term_cursor_x, delta);
print_csi(l, "C"); /* right */
delta -= l;
delta -= l;
term_cursor_x += l;
}
}
@ -398,7 +398,7 @@ import * as os from "os";
function backward_word() {
cursor_pos = skip_word_backward(cursor_pos);
}
}
function accept_line() {
std.puts("\n");
@ -581,7 +581,7 @@ import * as os from "os";
readline_print_prompt();
}
}
function reset() {
cmd = "";
cursor_pos = 0;
@ -735,7 +735,7 @@ import * as os from "os";
readline_print_prompt();
}
}
var commands = { /* command table */
"\x01": beginning_of_line, /* ^A - bol */
"\x02": backward_char, /* ^B - backward-char */
@ -813,9 +813,9 @@ import * as os from "os";
cursor_pos = cmd.length;
history_index = history.length;
readline_cb = cb;
prompt = pstate;
if (mexpr) {
prompt += dupstr(" ", plen - prompt.length);
prompt += ps2;
@ -902,7 +902,7 @@ import * as os from "os";
} else {
alert(); /* beep! */
}
cursor_pos = (cursor_pos < 0) ? 0 :
(cursor_pos > cmd.length) ? cmd.length : cursor_pos;
update();
@ -1000,13 +1000,13 @@ import * as os from "os";
s += "n";
return s;
}
function print(a) {
var stack = [];
function print_rec(a) {
var n, i, keys, key, type, s;
type = typeof(a);
if (type === "object") {
if (a === null) {
@ -1080,7 +1080,7 @@ import * as os from "os";
}
print_rec(a);
}
function extract_directive(a) {
var pos;
if (a[0] !== '\\')
@ -1095,7 +1095,7 @@ import * as os from "os";
/* return true if the string after cmd can be evaluted as JS */
function handle_directive(cmd, expr) {
var param, prec1, expBits1;
if (cmd === "h" || cmd === "?" || cmd == "help") {
help();
} else if (cmd === "load") {
@ -1205,7 +1205,7 @@ import * as os from "os";
}
}
}
function help() {
function sel(n) {
return n ? "*": " ";
@ -1233,7 +1233,7 @@ import * as os from "os";
function eval_and_print(expr) {
var result;
try {
if (eval_mode === "math")
expr = '"use math"; void 0;' + expr;
@ -1286,7 +1286,7 @@ import * as os from "os";
function cmd_readline_start() {
readline_start(dupstr(" ", level), readline_handle_cmd);
}
function readline_handle_cmd(expr) {
handle_cmd(expr);
cmd_readline_start();
@ -1294,7 +1294,7 @@ import * as os from "os";
function handle_cmd(expr) {
var colorstate, cmd;
if (expr === null) {
expr = "";
return;
@ -1311,7 +1311,7 @@ import * as os from "os";
}
if (expr === "")
return;
if (mexpr)
expr = mexpr + '\n' + expr;
colorstate = colorize_js(expr);
@ -1322,7 +1322,7 @@ import * as os from "os";
return;
}
mexpr = "";
if (has_bignum) {
BigFloatEnv.setPrec(eval_and_print.bind(null, expr),
prec, expBits);
@ -1330,7 +1330,7 @@ import * as os from "os";
eval_and_print(expr);
}
level = 0;
/* run the garbage collector after each command */
std.gc();
}
@ -1567,7 +1567,7 @@ import * as os from "os";
}
termInit();
cmd_start();
})(globalThis);