diff --git a/pico_minify.py b/pico_minify.py index 8d57284..58c065a 100644 --- a/pico_minify.py +++ b/pico_minify.py @@ -1,8 +1,9 @@ from utils import * +from pico_defs import fixnum_is_negative from pico_tokenize import TokenType from pico_tokenize import StopTraverse, k_skip_children from pico_parse import Node, NodeType, VarKind -from pico_parse import k_unary_ops_prec, get_precedence, is_right_assoc +from pico_parse import k_unary_ops_prec, get_precedence, is_right_assoc, can_replace_with_unary from pico_parse import is_vararg_expr, is_short_block_stmt, is_global_or_builtin_local from pico_output import format_fixnum, format_string_literal from pico_output import output_min_wspace, output_original_wspace @@ -292,6 +293,40 @@ def fixup_nodes_pre(node): if node.type in (NodeType.if_, NodeType.while_) and node.short and (analysis.new_shorts[node.type] == False): minify_change_shorthand(node, False) + + # remove unneeded groups + + while node.type == NodeType.group: + inner, outer = node.child, node.parent + inner_prec, outer_prec = get_precedence(inner), get_precedence(outer) + needed = True + if e(inner_prec) and e(outer_prec) and (inner_prec > outer_prec or (inner_prec == outer_prec and + (outer_prec == k_unary_ops_prec or is_right_assoc(outer) == (outer.right == node)))): + needed = False + elif e(outer_prec) and inner.type in (NodeType.var, NodeType.index, NodeType.member, NodeType.call, NodeType.varargs): + needed = False + elif e(outer_prec) and inner.type == NodeType.const and (focus.tokens or can_replace_with_unary(node) or + not (inner.token.type == TokenType.number and fixnum_is_negative(inner.token.fixnum_value))): + needed = False + elif outer.type in (NodeType.group, NodeType.table_member, NodeType.table_index, NodeType.op_assign): + needed = False + elif outer.type == NodeType.call and (node in outer.args[:-1] or + (outer.args and node == outer.args[-1] and not is_vararg_expr(inner))): + needed = False + elif outer.type in (NodeType.assign, NodeType.local) and (node in outer.sources[:-1] or + (outer.sources and node == outer.sources[-1] and (not is_vararg_expr(inner) or len(outer.targets) <= len(outer.sources)))): + needed = False + elif outer.type in (NodeType.return_, NodeType.table) and (node in outer.items[:-1] or + (outer.items and node == outer.items[-1] and not is_vararg_expr(inner))): + needed = False + elif outer.type in (NodeType.if_, NodeType.elseif, NodeType.while_, NodeType.until) and not outer.short: + needed = False + + if needed: + break + else: + node.replace_with(node.child.move()) + # node may now be another group, so loop def fixup_nodes_post(node): if minify_tokens: @@ -310,10 +345,6 @@ def fixup_nodes_post(node): prev = prev.prev_sibling() if prev and prev.type == node.type: minify_merge_assignments(prev, node, ctxt, safe_reorder) - - def remove_parens(token): - token.erase("(") - token.parent.erase_token(-1, ")") def fixup_tokens(token): @@ -340,27 +371,9 @@ def fixup_tokens(token): if token.value == "(" and token.parent.type == NodeType.call and len(token.parent.args) == 1: arg = token.parent.args[0] if arg.type == NodeType.table or (arg.type == NodeType.const and arg.token.type == TokenType.string): - return remove_parens(token) - - if token.value == "(" and token.parent.type == NodeType.group: - inner, outer = token.parent.child, token.parent.parent - inner_prec, outer_prec = get_precedence(inner), get_precedence(outer) - if e(inner_prec) and e(outer_prec) and (inner_prec > outer_prec or (inner_prec == outer_prec and - (outer_prec == k_unary_ops_prec or is_right_assoc(outer) == (outer.right == token.parent)))): - return remove_parens(token) - if outer.type in (NodeType.group, NodeType.table_member, NodeType.table_index, NodeType.op_assign): - return remove_parens(token) - if outer.type == NodeType.call and (token.parent in outer.args[:-1] or - (outer.args and token.parent == outer.args[-1] and not is_vararg_expr(inner))): - return remove_parens(token) - if outer.type in (NodeType.assign, NodeType.local) and (token.parent in outer.sources[:-1] or - (outer.sources and token.parent == outer.sources[-1] and (not is_vararg_expr(inner) or len(outer.targets) <= len(outer.sources)))): - return remove_parens(token) - if outer.type in (NodeType.return_, NodeType.table) and (token.parent in outer.items[:-1] or - (outer.items and token.parent == outer.items[-1] and not is_vararg_expr(inner))): - return remove_parens(token) - if outer.type in (NodeType.if_, NodeType.elseif, NodeType.while_, NodeType.until) and not outer.short: - return remove_parens(token) + token.erase("(") + token.parent.erase_token(-1, ")") + return # replace tokens for higher consistency @@ -377,13 +390,14 @@ def fixup_tokens(token): token.modify(minify_string_literal(ctxt, token, focus)) if token.type == TokenType.number: - outer_prec = get_precedence(token.parent.parent) if token.parent.type == NodeType.const else None - allow_unary = outer_prec is None or outer_prec < k_unary_ops_prec + allow_unary = can_replace_with_unary(token.parent) token.modify(format_fixnum(token.fixnum_value, sign=None if allow_unary else '')) - if token.value.startswith("-") or token.value.startswith("~"): - # insert synthetic unary token, so that output_tokens's tokenize won't get confused - token.parent.insert_token(0, TokenType.punct, token.value[0], near_next=True) - token.modify(token.value[1:]) + + if token.type == TokenType.number: + if token.value.startswith("-") or token.value.startswith("~"): # either due to format_fixnum above, or due to ConstToken.value + # insert synthetic unary token, so that output_tokens's tokenize and root.get_tokens() won't get confused + token.parent.insert_token(0, TokenType.punct, token.value[0], near_next=True) + token.modify(token.value[1:]) root.traverse_nodes(fixup_nodes_pre, fixup_nodes_post, tokens=fixup_tokens) diff --git a/pico_output.py b/pico_output.py index d184c9f..be75698 100644 --- a/pico_output.py +++ b/pico_output.py @@ -39,7 +39,7 @@ def str_add_1(str): return str[:-1] + chr(ord(str[-1]) + 1) numvalue = value / (1 << 16) - decvalue = "%.10f" % numvalue + decvalue = "%.6f" % numvalue while "." in decvalue: nextvalue = decvalue[:-1] nextupvalue = str_add_1(nextvalue) @@ -174,7 +174,6 @@ def output_original_wspace(root, exclude_comments=False): """convert a root back to a string, using original whitespace (optionally except comments)""" output = [] prev_token = Token.none - prev_welded_token = None prev_vline = 0 need_linebreak = False diff --git a/pico_parse.py b/pico_parse.py index f7382e5..35176eb 100644 --- a/pico_parse.py +++ b/pico_parse.py @@ -146,9 +146,12 @@ def __init__(m, type, children, **kwargs): for child in children: child.parent = m - def get_tokens(m): + def get_tokens(m): # (not including erased tokens, whereas traverse includes them) tokens = [] - m.traverse_tokens(lambda token: tokens.append(token)) + def on_token(token): + if token.value != None: + tokens.append(token) + m.traverse_tokens(on_token) return tokens short = False # default property @@ -965,4 +968,12 @@ def is_right_assoc(node): else: return False +def can_replace_with_unary(node): + parent = node.parent + if not parent or (parent.type == NodeType.binary_op and parent.right is node): + return True + else: + prec = get_precedence(parent) + return prec is None or prec < k_unary_ops_prec + from pico_process import Error diff --git a/pico_tokenize.py b/pico_tokenize.py index 81e5f06..f863f89 100644 --- a/pico_tokenize.py +++ b/pico_tokenize.py @@ -202,9 +202,11 @@ def __init__(m, type, other, fixnum_value=None, string_value=None, value=None): lazy_property.clear(m, "value") @lazy_property - def value(m): # will not be called if minified normally, so output is suboptimal + def value(m): # used during going over chars for rename (tsk...) and for output when not minify-tokens + # (but not used for output under minify-tokens) if e(m.fixnum_value): - return format_fixnum(m.fixnum_value, sign='') + allow_unary = can_replace_with_unary(m.parent) + return format_fixnum(m.fixnum_value, sign=None if allow_unary else "") else: return format_string_literal(m.string_value, long=False) @@ -528,12 +530,14 @@ def tokenize_long_string(off): def count_tokens(tokens): count = 0 for i, token in enumerate(tokens): + assert token.value != None + if token.children: for comment in token.children: if comment.hint == CommentHint.lint and k_lint_count_stop in comment.hintdata: return count - if token.value in (",", ".", ":", ";", "::", ")", "]", "}", "end", "local", None): + if token.value in (",", ".", ":", ";", "::", ")", "]", "}", "end", "local"): continue if token.value in ("-", "~") and i+1 < len(tokens) and tokens[i+1].type == TokenType.number and \ @@ -652,6 +656,6 @@ def parse_string_literal(str): return "".join(litparts) -from pico_parse import Node, VarKind +from pico_parse import Node, VarKind, can_replace_with_unary from pico_output import format_fixnum, format_string_literal from pico_process import Error diff --git a/run_bbs_tests.py b/run_bbs_tests.py index e032e6c..24b5e36 100644 --- a/run_bbs_tests.py +++ b/run_bbs_tests.py @@ -229,9 +229,9 @@ def run(focus): filename = str(focus) if focus else "normal" input_json = path_join("test_bbs", "input.json") - output_json = path_join("test_bbs", "output", filename + ".json") - compare_json = path_join("test_bbs", "compare", filename + ".json") - unfocused_json = path_join("test_bbs", "compare", "normal.json") if g_opts.compare_unfocused else None + output_json = path_join("test_output", "bbs", filename + ".json") + compare_json = path_join("test_compare", "bbs", filename + ".json") + unfocused_json = path_join("test_compare", "bbs", "normal.json") if g_opts.compare_unfocused else None inputs = try_file_read_json(input_json, {}) outputs = try_file_read_json(output_json, {}) compares = try_file_read_json(compare_json, {}) @@ -298,7 +298,9 @@ def run_all(): if __name__ == "__main__": init_tests(g_opts) - for dir in ("output", "compare"): - dir_ensure_exists(path_join("test_bbs", dir)) + dir_ensure_exists("test_bbs") + for dir in ("test_output", "test_compare"): + dir_ensure_exists(path_join(dir, "bbs")) + run_all() sys.exit(end_tests()) diff --git a/run_tests.py b/run_tests.py index 485d035..6e49686 100644 --- a/run_tests.py +++ b/run_tests.py @@ -156,6 +156,7 @@ def run(): "--no-minify-spaces", "--no-minify-lines", "--no-minify-comments", "--no-minify-rename", pico8_output="output.p8.printh") run_test("nominify", "input.p8", "output-nomin.p8", check_output=False, pico8_output="output.p8.printh") + run_test("reformat", "input.p8", "input-reformat.p8", "--unminify", "--unminify-indent", "4") run_test("nopreserve", "nopreserve.p8", "nopreserve.p8", "--minify", "--no-preserve", "circfill,rectfill", pico8_output_val="yep") @@ -167,11 +168,11 @@ def run(): pico8_output="const.p8.printh") run_test("const2", "const2.p8", "const2.p8", "--minify", "--no-minify-spaces", "--no-minify-lines", "--no-minify-comments", "--no-minify-rename", "--no-minify-tokens", - pico8_run=True, stdout_output="const2.txt", norm_stdout=norm_paths) + stdout_output="const2.txt", norm_stdout=norm_paths) run_test("constcl", "constcl.p8", "constcl.p8", "--minify") run_test("constcl-1", "constcl.p8", "constcl-1.p8", "--minify", "--const", "DEBUG", "true", "--const", "SPEED", "2.5", "--str-const", "VERSION", "v1.2") run_test("constcl-2", "constcl.p8", "constcl-2.p8", "--minify", "--const", "DEBUG", "true", "--const", "SPEED", "-2.6", "--const", "hero", "~1") - run_test("constmin", "const.p8", "constmin.p8", "--minify", pico8_run=True) + run_test("constmin", "const.p8", "constmin.p8", "--minify", pico8_output="const.p8.printh") if run_test("test", "test.p8", "test.p8", "--minify", "--no-minify-consts", pico8_output_val="DONE"): run_test("unmintest", "test.p8", "test-un.p8", "--unminify", from_output=True, pico8_output_val="DONE") @@ -233,7 +234,6 @@ def run(): run_test("repl-oc", "repl.p8", "repl-oc.p8", "--minify", "--focus-chars", pico8_output_val="finished") run_test("repl-ob", "repl.p8", "repl-ob.p8", "--minify", "--focus-compressed", pico8_output_val="finished") - run_test("reformat", "input.p8", "input-reformat.p8", "--unminify", "--unminify-indent", "4") run_test("notnil", "notnil.p8", "notnil.p8", "--minify", pico8_output_val="passed") run_test("wildcards", "wildcards.p8", "wildcards.p8", "--minify", "--no-minify-consts") diff --git a/shrinko8.py b/shrinko8.py index dcb9117..60d1ff6 100644 --- a/shrinko8.py +++ b/shrinko8.py @@ -9,7 +9,7 @@ from pico_defs import get_default_version_id import argparse -k_version = 'v1.2.0f' +k_version = 'v1.2.0g' def SplitBySeps(val): return k_hint_split_re.split(val) diff --git a/test_compare/bbs/chars.json b/test_compare/bbs/chars.json new file mode 100644 index 0000000..1b8ba3f --- /dev/null +++ b/test_compare/bbs/chars.json @@ -0,0 +1,930 @@ +{ + "100973": { + "compress": { + "chars": 39288, + "compressed": 8841 + }, + "safe_minify": { + "chars": 21015, + "compressed": 6623, + "tokens": 6821 + }, + "unsafe_minify": { + "chars": 17518, + "compressed": 6163, + "tokens": 6821 + } + }, + "101541": { + "compress": { + "chars": 34820, + "compressed": 12510 + }, + "safe_minify": { + "chars": 30590, + "compressed": 11733, + "tokens": 2274 + }, + "unsafe_minify": { + "chars": 30245, + "compressed": 11642, + "tokens": 2274 + } + }, + "103651": { + "compress": { + "chars": 40092, + "compressed": 15173 + }, + "safe_minify": { + "chars": 34293, + "compressed": 13592, + "tokens": 6352 + }, + "unsafe_minify": { + "chars": 31351, + "compressed": 13216, + "tokens": 6352 + } + }, + "10388": { + "compress": { + "chars": 31061, + "compressed": 12033 + }, + "safe_minify": { + "chars": 19350, + "compressed": 8980, + "tokens": 7853 + }, + "unsafe_minify": { + "chars": 18768, + "compressed": 8879, + "tokens": 7853 + } + }, + "107459": { + "compress": { + "chars": 43307, + "compressed": 15204 + }, + "safe_minify": { + "chars": 27163, + "compressed": 12087, + "tokens": 8154 + }, + "unsafe_minify": { + "chars": 26167, + "compressed": 11906, + "tokens": 8154 + } + }, + "109575": { + "compress": { + "chars": 31993, + "compressed": 10330 + }, + "safe_minify": { + "chars": 19300, + "compressed": 7095, + "tokens": 7144 + }, + "unsafe_minify": { + "chars": 16813, + "compressed": 6772, + "tokens": 7144 + } + }, + "109673": { + "compress": { + "chars": 14845, + "compressed": 5257 + }, + "safe_minify": { + "chars": 7588, + "compressed": 3598, + "tokens": 3104 + }, + "unsafe_minify": { + "chars": 7442, + "compressed": 3550, + "tokens": 3104 + } + }, + "109822": { + "compress": { + "chars": 35953, + "compressed": 14758 + }, + "safe_minify": { + "chars": 35334, + "compressed": 14615, + "tokens": 8100 + }, + "unsafe_minify": { + "chars": 34160, + "compressed": 14592, + "tokens": 8100 + } + }, + "112308": { + "compress": { + "chars": 52322, + "compressed": 15038 + }, + "safe_minify": { + "chars": 24218, + "compressed": 8948, + "tokens": 8081 + }, + "unsafe_minify": { + "chars": 18621, + "compressed": 8331, + "tokens": 8081 + } + }, + "112740": { + "compress": { + "chars": 49966, + "compressed": 14828 + }, + "safe_minify": { + "chars": 20884, + "compressed": 8857, + "tokens": 7956 + }, + "unsafe_minify": { + "chars": 18259, + "compressed": 8435, + "tokens": 7956 + } + }, + "112916": { + "compress": { + "chars": 39179, + "compressed": 13730 + }, + "safe_minify": { + "chars": 38273, + "compressed": 13609, + "tokens": 8171 + }, + "unsafe_minify": { + "chars": 35734, + "compressed": 13408, + "tokens": 8171 + } + }, + "114060": { + "compress": { + "chars": 45477, + "compressed": 13836 + }, + "safe_minify": { + "chars": 22417, + "compressed": 8758, + "tokens": 8053 + }, + "unsafe_minify": { + "chars": 20346, + "compressed": 8453, + "tokens": 8053 + } + }, + "114663": { + "compress": { + "chars": 49512, + "compressed": 15070 + }, + "safe_minify": { + "chars": 24086, + "compressed": 9437, + "tokens": 7927 + }, + "unsafe_minify": { + "chars": 19497, + "compressed": 8893, + "tokens": 7927 + } + }, + "115136": { + "compress": { + "chars": 4643, + "compressed": 1767 + }, + "safe_minify": { + "chars": 2729, + "compressed": 1195, + "tokens": 1348 + }, + "unsafe_minify": { + "chars": 2693, + "compressed": 1179, + "tokens": 1348 + } + }, + "116823": { + "compress": { + "chars": 50155, + "compressed": 15048 + }, + "safe_minify": { + "chars": 26075, + "compressed": 10916, + "tokens": 7956 + }, + "unsafe_minify": { + "chars": 22240, + "compressed": 10477, + "tokens": 7956 + } + }, + "116846": { + "compress": { + "chars": 39925, + "compressed": 12687 + }, + "safe_minify": { + "chars": 23063, + "compressed": 8739, + "tokens": 7629 + }, + "unsafe_minify": { + "chars": 20199, + "compressed": 8348, + "tokens": 7629 + } + }, + "11722": { + "compress": { + "chars": 26589, + "compressed": 7659 + }, + "safe_minify": { + "chars": 14576, + "compressed": 5240, + "tokens": 5847 + }, + "unsafe_minify": { + "chars": 12457, + "compressed": 4931, + "tokens": 5847 + } + }, + "119614": { + "compress": { + "chars": 40128, + "compressed": 14758 + }, + "safe_minify": { + "chars": 30759, + "compressed": 11852, + "tokens": 4790 + }, + "unsafe_minify": { + "chars": 26072, + "compressed": 11182, + "tokens": 4790 + } + }, + "12502": { + "compress": { + "chars": 13973, + "compressed": 5327 + }, + "safe_minify": { + "chars": 4817, + "compressed": 2547, + "tokens": 2321 + }, + "unsafe_minify": { + "chars": 4817, + "compressed": 2547, + "tokens": 2321 + } + }, + "12682": { + "compress": { + "chars": 31669, + "compressed": 10000 + }, + "safe_minify": { + "chars": 14589, + "compressed": 6610, + "tokens": 6200 + }, + "unsafe_minify": { + "chars": 14348, + "compressed": 6573, + "tokens": 6200 + } + }, + "13057": { + "compress": { + "chars": 16596, + "compressed": 6066 + }, + "safe_minify": { + "chars": 10234, + "compressed": 4860, + "tokens": 3190 + }, + "unsafe_minify": { + "chars": 10234, + "compressed": 4860, + "tokens": 3190 + } + }, + "131586": { + "compress": { + "chars": 27177, + "compressed": 8808 + }, + "safe_minify": { + "chars": 15375, + "compressed": 6187, + "tokens": 4723 + }, + "unsafe_minify": { + "chars": 15215, + "compressed": 6163, + "tokens": 4723 + } + }, + "132559": { + "compress": { + "chars": 40781, + "compressed": 14582 + }, + "safe_minify": { + "chars": 26634, + "compressed": 11835, + "tokens": 8015 + }, + "unsafe_minify": { + "chars": 25488, + "compressed": 11690, + "tokens": 8015 + } + }, + "142353": { + "compress": { + "chars": 41588, + "compressed": 15275 + }, + "safe_minify": { + "chars": 40651, + "compressed": 15329, + "tokens": 6098 + }, + "unsafe_minify": { + "chars": 39757, + "compressed": 15173, + "tokens": 6098 + } + }, + "15116": { + "compress": { + "chars": 23927, + "compressed": 6482 + }, + "safe_minify": { + "chars": 7904, + "compressed": 3459, + "tokens": 3643 + }, + "unsafe_minify": { + "chars": 7470, + "compressed": 3418, + "tokens": 3643 + } + }, + "18483": { + "compress": { + "chars": 30450, + "compressed": 9078 + }, + "safe_minify": { + "chars": 18820, + "compressed": 7045, + "tokens": 7421 + }, + "unsafe_minify": { + "chars": 17248, + "compressed": 6889, + "tokens": 7421 + } + }, + "20407": { + "compress": { + "chars": 7151, + "compressed": 2749 + }, + "safe_minify": { + "chars": 3229, + "compressed": 1504, + "tokens": 1324 + }, + "unsafe_minify": { + "chars": 3130, + "compressed": 1479, + "tokens": 1324 + } + }, + "21098": { + "compress": { + "chars": 31448, + "compressed": 11668 + }, + "safe_minify": { + "chars": 18963, + "compressed": 8587, + "tokens": 8107 + }, + "unsafe_minify": { + "chars": 17380, + "compressed": 8349, + "tokens": 8107 + } + }, + "24899": { + "compress": { + "chars": 38142, + "compressed": 12622 + }, + "safe_minify": { + "chars": 21338, + "compressed": 10051, + "tokens": 7659 + }, + "unsafe_minify": { + "chars": 20631, + "compressed": 9950, + "tokens": 7659 + } + }, + "26851": { + "compress": { + "chars": 28608, + "compressed": 13229 + }, + "safe_minify": { + "chars": 24960, + "compressed": 12043, + "tokens": 8081 + }, + "unsafe_minify": { + "chars": 24158, + "compressed": 11899, + "tokens": 8081 + } + }, + "33331": { + "compress": { + "chars": 17491, + "compressed": 5821 + }, + "safe_minify": { + "chars": 9867, + "compressed": 4275, + "tokens": 4017 + }, + "unsafe_minify": { + "chars": 9378, + "compressed": 4210, + "tokens": 4017 + } + }, + "41037": { + "compress": { + "chars": 45875, + "compressed": 12936 + }, + "safe_minify": { + "chars": 32262, + "compressed": 10604, + "tokens": 7294 + }, + "unsafe_minify": { + "chars": 32191, + "compressed": 10589, + "tokens": 7294 + } + }, + "42655": { + "compress": { + "chars": 22577, + "compressed": 8001 + }, + "safe_minify": { + "chars": 15124, + "compressed": 6125, + "tokens": 6163 + }, + "unsafe_minify": { + "chars": 13543, + "compressed": 5886, + "tokens": 6163 + } + }, + "43229": { + "compress": { + "chars": 39178, + "compressed": 11639 + }, + "safe_minify": { + "chars": 23692, + "compressed": 9137, + "tokens": 8111 + }, + "unsafe_minify": { + "chars": 20843, + "compressed": 8849, + "tokens": 8111 + } + }, + "44028": { + "compress": { + "chars": 45968, + "compressed": 12556 + }, + "safe_minify": { + "chars": 21757, + "compressed": 7653, + "tokens": 7428 + }, + "unsafe_minify": { + "chars": 17880, + "compressed": 7130, + "tokens": 7428 + } + }, + "47025": { + "compress": { + "chars": 13939, + "compressed": 4228 + }, + "safe_minify": { + "chars": 9221, + "compressed": 3409, + "tokens": 3763 + }, + "unsafe_minify": { + "chars": 8147, + "compressed": 3315, + "tokens": 3763 + } + }, + "59366": { + "compress": { + "chars": 34386, + "compressed": 12092 + }, + "safe_minify": { + "chars": 27232, + "compressed": 10489, + "tokens": 7377 + }, + "unsafe_minify": { + "chars": 23859, + "compressed": 10052, + "tokens": 7377 + } + }, + "59497": { + "compress": { + "chars": 24156, + "compressed": 11305 + }, + "safe_minify": { + "chars": 19336, + "compressed": 10375, + "tokens": 2882 + }, + "unsafe_minify": { + "chars": 19336, + "compressed": 10375, + "tokens": 2882 + } + }, + "59509": { + "compress": { + "chars": 39238, + "compressed": 11676 + }, + "safe_minify": { + "chars": 20950, + "compressed": 7356, + "tokens": 8085 + }, + "unsafe_minify": { + "chars": 18580, + "compressed": 7105, + "tokens": 8085 + } + }, + "66786": { + "compress": { + "chars": 25587, + "compressed": 8130 + }, + "safe_minify": { + "chars": 13275, + "compressed": 5494, + "tokens": 5502 + }, + "unsafe_minify": { + "chars": 12153, + "compressed": 5327, + "tokens": 5502 + } + }, + "66935": { + "compress": { + "chars": 42758, + "compressed": 12530 + }, + "safe_minify": { + "chars": 34806, + "compressed": 11329, + "tokens": 7055 + }, + "unsafe_minify": { + "chars": 31430, + "compressed": 10880, + "tokens": 7055 + } + }, + "69899": { + "compress": { + "chars": 36598, + "compressed": 12136 + }, + "safe_minify": { + "chars": 20850, + "compressed": 7961, + "tokens": 5448 + }, + "unsafe_minify": { + "chars": 17223, + "compressed": 7509, + "tokens": 5448 + } + }, + "72921": { + "compress": { + "chars": 37571, + "compressed": 13933 + }, + "safe_minify": { + "chars": 22766, + "compressed": 10990, + "tokens": 8101 + }, + "unsafe_minify": { + "chars": 20122, + "compressed": 10610, + "tokens": 8101 + } + }, + "75108": { + "compress": { + "chars": 9209, + "compressed": 3105 + }, + "safe_minify": { + "chars": 5066, + "compressed": 2258, + "tokens": 2695 + }, + "unsafe_minify": { + "chars": 5056, + "compressed": 2255, + "tokens": 2695 + } + }, + "75741": { + "compress": { + "chars": 28410, + "compressed": 8718 + }, + "safe_minify": { + "chars": 16781, + "compressed": 6480, + "tokens": 4596 + }, + "unsafe_minify": { + "chars": 16781, + "compressed": 6480, + "tokens": 4596 + } + }, + "78599": { + "compress": { + "chars": 44095, + "compressed": 15154 + }, + "safe_minify": { + "chars": 25490, + "compressed": 11276, + "tokens": 8056 + }, + "unsafe_minify": { + "chars": 23580, + "compressed": 10994, + "tokens": 8056 + } + }, + "82023": { + "compress": { + "chars": 25528, + "compressed": 9252 + }, + "safe_minify": { + "chars": 14943, + "compressed": 6522, + "tokens": 6308 + }, + "unsafe_minify": { + "chars": 14381, + "compressed": 6401, + "tokens": 6308 + } + }, + "83367": { + "compress": { + "chars": 39786, + "compressed": 15181 + }, + "safe_minify": { + "chars": 33916, + "compressed": 14211, + "tokens": 8075 + }, + "unsafe_minify": { + "chars": 31586, + "compressed": 13971, + "tokens": 8075 + } + }, + "85620": { + "compress": { + "chars": 42829, + "compressed": 15164 + }, + "safe_minify": { + "chars": 27630, + "compressed": 12432, + "tokens": 8132 + }, + "unsafe_minify": { + "chars": 27605, + "compressed": 12418, + "tokens": 8132 + } + }, + "86280": { + "compress": { + "chars": 35951, + "compressed": 14527 + }, + "safe_minify": { + "chars": 28282, + "compressed": 13299, + "tokens": 7707 + }, + "unsafe_minify": { + "chars": 27777, + "compressed": 13242, + "tokens": 7707 + } + }, + "89823": { + "compress": { + "chars": 35746, + "compressed": 10130 + }, + "safe_minify": { + "chars": 23383, + "compressed": 7859, + "tokens": 8108 + }, + "unsafe_minify": { + "chars": 20881, + "compressed": 7630, + "tokens": 8108 + } + }, + "89915": { + "compress": { + "chars": 30466, + "compressed": 14407 + }, + "safe_minify": { + "chars": 29169, + "compressed": 14352, + "tokens": 8147 + }, + "unsafe_minify": { + "chars": 29160, + "compressed": 14354, + "tokens": 8147 + } + }, + "90020": { + "compress": { + "chars": 42234, + "compressed": 12451 + }, + "safe_minify": { + "chars": 17544, + "compressed": 7366, + "tokens": 7590 + }, + "unsafe_minify": { + "chars": 17533, + "compressed": 7347, + "tokens": 7590 + } + }, + "91453": { + "compress": { + "chars": 54034, + "compressed": 13353 + }, + "safe_minify": { + "chars": 26575, + "compressed": 9247, + "tokens": 7965 + }, + "unsafe_minify": { + "chars": 19906, + "compressed": 8437, + "tokens": 7965 + } + }, + "94408": { + "compress": { + "chars": 48356, + "compressed": 13608 + }, + "safe_minify": { + "chars": 33357, + "compressed": 11375, + "tokens": 4504 + }, + "unsafe_minify": { + "chars": 33321, + "compressed": 11371, + "tokens": 4504 + } + }, + "96334": { + "compress": { + "chars": 51283, + "compressed": 14899 + }, + "safe_minify": { + "chars": 24249, + "compressed": 9021, + "tokens": 8148 + }, + "unsafe_minify": { + "chars": 19316, + "compressed": 8492, + "tokens": 8148 + } + }, + "97636": { + "compress": { + "chars": 19446, + "compressed": 5849 + }, + "safe_minify": { + "chars": 9498, + "compressed": 4074, + "tokens": 4284 + }, + "unsafe_minify": { + "chars": 9051, + "compressed": 3998, + "tokens": 4284 + } + }, + "9983": { + "compress": { + "chars": 15248, + "compressed": 6109 + }, + "safe_minify": { + "chars": 10872, + "compressed": 5119, + "tokens": 5096 + }, + "unsafe_minify": { + "chars": 10312, + "compressed": 5026, + "tokens": 5096 + } + } +} \ No newline at end of file diff --git a/test_compare/bbs/compressed.json b/test_compare/bbs/compressed.json new file mode 100644 index 0000000..77937ff --- /dev/null +++ b/test_compare/bbs/compressed.json @@ -0,0 +1,930 @@ +{ + "100973": { + "compress": { + "chars": 39288, + "compressed": 8841 + }, + "safe_minify": { + "chars": 22128, + "compressed": 6512, + "tokens": 6821 + }, + "unsafe_minify": { + "chars": 18896, + "compressed": 6020, + "tokens": 6821 + } + }, + "101541": { + "compress": { + "chars": 34820, + "compressed": 12510 + }, + "safe_minify": { + "chars": 30853, + "compressed": 11702, + "tokens": 2274 + }, + "unsafe_minify": { + "chars": 30508, + "compressed": 11614, + "tokens": 2274 + } + }, + "103651": { + "compress": { + "chars": 40092, + "compressed": 15173 + }, + "safe_minify": { + "chars": 35297, + "compressed": 13577, + "tokens": 6352 + }, + "unsafe_minify": { + "chars": 32784, + "compressed": 13151, + "tokens": 6352 + } + }, + "10388": { + "compress": { + "chars": 31061, + "compressed": 12033 + }, + "safe_minify": { + "chars": 21362, + "compressed": 8964, + "tokens": 7853 + }, + "unsafe_minify": { + "chars": 20945, + "compressed": 8838, + "tokens": 7853 + } + }, + "107459": { + "compress": { + "chars": 43307, + "compressed": 15204 + }, + "safe_minify": { + "chars": 28422, + "compressed": 12036, + "tokens": 8154 + }, + "unsafe_minify": { + "chars": 27488, + "compressed": 11822, + "tokens": 8154 + } + }, + "109575": { + "compress": { + "chars": 31993, + "compressed": 10330 + }, + "safe_minify": { + "chars": 20140, + "compressed": 6986, + "tokens": 7144 + }, + "unsafe_minify": { + "chars": 17917, + "compressed": 6663, + "tokens": 7144 + } + }, + "109673": { + "compress": { + "chars": 14845, + "compressed": 5257 + }, + "safe_minify": { + "chars": 8219, + "compressed": 3565, + "tokens": 3104 + }, + "unsafe_minify": { + "chars": 8073, + "compressed": 3521, + "tokens": 3104 + } + }, + "109822": { + "compress": { + "chars": 35953, + "compressed": 14758 + }, + "safe_minify": { + "chars": 36235, + "compressed": 14601, + "tokens": 8100 + }, + "unsafe_minify": { + "chars": 35483, + "compressed": 14488, + "tokens": 8100 + } + }, + "112308": { + "compress": { + "chars": 52322, + "compressed": 15038 + }, + "safe_minify": { + "chars": 25606, + "compressed": 8657, + "tokens": 8081 + }, + "unsafe_minify": { + "chars": 20351, + "compressed": 8009, + "tokens": 8081 + } + }, + "112740": { + "compress": { + "chars": 49966, + "compressed": 14828 + }, + "safe_minify": { + "chars": 22768, + "compressed": 8729, + "tokens": 7956 + }, + "unsafe_minify": { + "chars": 20306, + "compressed": 8312, + "tokens": 7956 + } + }, + "112916": { + "compress": { + "chars": 39179, + "compressed": 13730 + }, + "safe_minify": { + "chars": 39064, + "compressed": 13541, + "tokens": 8171 + }, + "unsafe_minify": { + "chars": 37323, + "compressed": 13310, + "tokens": 8171 + } + }, + "114060": { + "compress": { + "chars": 45477, + "compressed": 13836 + }, + "safe_minify": { + "chars": 23730, + "compressed": 8643, + "tokens": 8053 + }, + "unsafe_minify": { + "chars": 21771, + "compressed": 8333, + "tokens": 8053 + } + }, + "114663": { + "compress": { + "chars": 49512, + "compressed": 15070 + }, + "safe_minify": { + "chars": 25622, + "compressed": 9259, + "tokens": 7927 + }, + "unsafe_minify": { + "chars": 21329, + "compressed": 8689, + "tokens": 7927 + } + }, + "115136": { + "compress": { + "chars": 4643, + "compressed": 1767 + }, + "safe_minify": { + "chars": 2847, + "compressed": 1201, + "tokens": 1348 + }, + "unsafe_minify": { + "chars": 2811, + "compressed": 1186, + "tokens": 1348 + } + }, + "116823": { + "compress": { + "chars": 50155, + "compressed": 15048 + }, + "safe_minify": { + "chars": 27664, + "compressed": 10808, + "tokens": 7956 + }, + "unsafe_minify": { + "chars": 24049, + "compressed": 10350, + "tokens": 7956 + } + }, + "116846": { + "compress": { + "chars": 39925, + "compressed": 12687 + }, + "safe_minify": { + "chars": 24523, + "compressed": 8642, + "tokens": 7629 + }, + "unsafe_minify": { + "chars": 21936, + "compressed": 8236, + "tokens": 7629 + } + }, + "11722": { + "compress": { + "chars": 26589, + "compressed": 7659 + }, + "safe_minify": { + "chars": 15356, + "compressed": 5175, + "tokens": 5847 + }, + "unsafe_minify": { + "chars": 13376, + "compressed": 4865, + "tokens": 5847 + } + }, + "119614": { + "compress": { + "chars": 40128, + "compressed": 14758 + }, + "safe_minify": { + "chars": 31450, + "compressed": 11847, + "tokens": 4790 + }, + "unsafe_minify": { + "chars": 27241, + "compressed": 11159, + "tokens": 4790 + } + }, + "12502": { + "compress": { + "chars": 13973, + "compressed": 5327 + }, + "safe_minify": { + "chars": 5500, + "compressed": 2527, + "tokens": 2321 + }, + "unsafe_minify": { + "chars": 5500, + "compressed": 2527, + "tokens": 2321 + } + }, + "12682": { + "compress": { + "chars": 31669, + "compressed": 10000 + }, + "safe_minify": { + "chars": 16873, + "compressed": 6581, + "tokens": 6200 + }, + "unsafe_minify": { + "chars": 16632, + "compressed": 6544, + "tokens": 6200 + } + }, + "13057": { + "compress": { + "chars": 16596, + "compressed": 6066 + }, + "safe_minify": { + "chars": 11257, + "compressed": 4872, + "tokens": 3190 + }, + "unsafe_minify": { + "chars": 11257, + "compressed": 4872, + "tokens": 3190 + } + }, + "131586": { + "compress": { + "chars": 27177, + "compressed": 8808 + }, + "safe_minify": { + "chars": 16050, + "compressed": 6200, + "tokens": 4723 + }, + "unsafe_minify": { + "chars": 15890, + "compressed": 6177, + "tokens": 4723 + } + }, + "132559": { + "compress": { + "chars": 40781, + "compressed": 14582 + }, + "safe_minify": { + "chars": 28017, + "compressed": 11744, + "tokens": 8015 + }, + "unsafe_minify": { + "chars": 27029, + "compressed": 11583, + "tokens": 8015 + } + }, + "142353": { + "compress": { + "chars": 41588, + "compressed": 15275 + }, + "safe_minify": { + "chars": 41690, + "compressed": 15239, + "tokens": 6098 + }, + "unsafe_minify": { + "chars": 40872, + "compressed": 15076, + "tokens": 6098 + } + }, + "15116": { + "compress": { + "chars": 23927, + "compressed": 6482 + }, + "safe_minify": { + "chars": 8461, + "compressed": 3404, + "tokens": 3643 + }, + "unsafe_minify": { + "chars": 8027, + "compressed": 3358, + "tokens": 3643 + } + }, + "18483": { + "compress": { + "chars": 30450, + "compressed": 9078 + }, + "safe_minify": { + "chars": 20166, + "compressed": 7027, + "tokens": 7421 + }, + "unsafe_minify": { + "chars": 18765, + "compressed": 6840, + "tokens": 7421 + } + }, + "20407": { + "compress": { + "chars": 7151, + "compressed": 2749 + }, + "safe_minify": { + "chars": 3421, + "compressed": 1495, + "tokens": 1324 + }, + "unsafe_minify": { + "chars": 3322, + "compressed": 1467, + "tokens": 1324 + } + }, + "21098": { + "compress": { + "chars": 31448, + "compressed": 11668 + }, + "safe_minify": { + "chars": 20777, + "compressed": 8630, + "tokens": 8107 + }, + "unsafe_minify": { + "chars": 19476, + "compressed": 8343, + "tokens": 8107 + } + }, + "24899": { + "compress": { + "chars": 38142, + "compressed": 12622 + }, + "safe_minify": { + "chars": 22842, + "compressed": 9984, + "tokens": 7659 + }, + "unsafe_minify": { + "chars": 22153, + "compressed": 9874, + "tokens": 7659 + } + }, + "26851": { + "compress": { + "chars": 28608, + "compressed": 13229 + }, + "safe_minify": { + "chars": 26426, + "compressed": 11844, + "tokens": 8081 + }, + "unsafe_minify": { + "chars": 26032, + "compressed": 11694, + "tokens": 8081 + } + }, + "33331": { + "compress": { + "chars": 17491, + "compressed": 5821 + }, + "safe_minify": { + "chars": 10424, + "compressed": 4255, + "tokens": 4017 + }, + "unsafe_minify": { + "chars": 9954, + "compressed": 4182, + "tokens": 4017 + } + }, + "41037": { + "compress": { + "chars": 45875, + "compressed": 12936 + }, + "safe_minify": { + "chars": 34792, + "compressed": 10697, + "tokens": 7294 + }, + "unsafe_minify": { + "chars": 34721, + "compressed": 10681, + "tokens": 7294 + } + }, + "42655": { + "compress": { + "chars": 22577, + "compressed": 8001 + }, + "safe_minify": { + "chars": 15962, + "compressed": 6110, + "tokens": 6163 + }, + "unsafe_minify": { + "chars": 14666, + "compressed": 5835, + "tokens": 6163 + } + }, + "43229": { + "compress": { + "chars": 39178, + "compressed": 11639 + }, + "safe_minify": { + "chars": 24917, + "compressed": 9037, + "tokens": 8111 + }, + "unsafe_minify": { + "chars": 22366, + "compressed": 8704, + "tokens": 8111 + } + }, + "44028": { + "compress": { + "chars": 45968, + "compressed": 12556 + }, + "safe_minify": { + "chars": 23272, + "compressed": 7537, + "tokens": 7428 + }, + "unsafe_minify": { + "chars": 19556, + "compressed": 6998, + "tokens": 7428 + } + }, + "47025": { + "compress": { + "chars": 13939, + "compressed": 4228 + }, + "safe_minify": { + "chars": 9962, + "compressed": 3450, + "tokens": 3763 + }, + "unsafe_minify": { + "chars": 8951, + "compressed": 3360, + "tokens": 3763 + } + }, + "59366": { + "compress": { + "chars": 34386, + "compressed": 12092 + }, + "safe_minify": { + "chars": 28455, + "compressed": 10409, + "tokens": 7377 + }, + "unsafe_minify": { + "chars": 25538, + "compressed": 9943, + "tokens": 7377 + } + }, + "59497": { + "compress": { + "chars": 24156, + "compressed": 11305 + }, + "safe_minify": { + "chars": 19686, + "compressed": 10360, + "tokens": 2882 + }, + "unsafe_minify": { + "chars": 19686, + "compressed": 10360, + "tokens": 2882 + } + }, + "59509": { + "compress": { + "chars": 39238, + "compressed": 11676 + }, + "safe_minify": { + "chars": 22671, + "compressed": 7364, + "tokens": 8085 + }, + "unsafe_minify": { + "chars": 20581, + "compressed": 7064, + "tokens": 8085 + } + }, + "66786": { + "compress": { + "chars": 25587, + "compressed": 8130 + }, + "safe_minify": { + "chars": 14299, + "compressed": 5363, + "tokens": 5502 + }, + "unsafe_minify": { + "chars": 13208, + "compressed": 5189, + "tokens": 5502 + } + }, + "66935": { + "compress": { + "chars": 42758, + "compressed": 12530 + }, + "safe_minify": { + "chars": 35707, + "compressed": 11282, + "tokens": 7055 + }, + "unsafe_minify": { + "chars": 32703, + "compressed": 10790, + "tokens": 7055 + } + }, + "69899": { + "compress": { + "chars": 36598, + "compressed": 12136 + }, + "safe_minify": { + "chars": 21854, + "compressed": 7913, + "tokens": 5448 + }, + "unsafe_minify": { + "chars": 18488, + "compressed": 7410, + "tokens": 5448 + } + }, + "72921": { + "compress": { + "chars": 37571, + "compressed": 13933 + }, + "safe_minify": { + "chars": 24739, + "compressed": 10969, + "tokens": 8101 + }, + "unsafe_minify": { + "chars": 22412, + "compressed": 10575, + "tokens": 8101 + } + }, + "75108": { + "compress": { + "chars": 9209, + "compressed": 3105 + }, + "safe_minify": { + "chars": 5078, + "compressed": 2236, + "tokens": 2695 + }, + "unsafe_minify": { + "chars": 5068, + "compressed": 2233, + "tokens": 2695 + } + }, + "75741": { + "compress": { + "chars": 28410, + "compressed": 8718 + }, + "safe_minify": { + "chars": 17567, + "compressed": 6467, + "tokens": 4596 + }, + "unsafe_minify": { + "chars": 17567, + "compressed": 6467, + "tokens": 4596 + } + }, + "78599": { + "compress": { + "chars": 44095, + "compressed": 15154 + }, + "safe_minify": { + "chars": 27067, + "compressed": 11188, + "tokens": 8056 + }, + "unsafe_minify": { + "chars": 25348, + "compressed": 10875, + "tokens": 8056 + } + }, + "82023": { + "compress": { + "chars": 25528, + "compressed": 9252 + }, + "safe_minify": { + "chars": 16204, + "compressed": 6491, + "tokens": 6308 + }, + "unsafe_minify": { + "chars": 15738, + "compressed": 6348, + "tokens": 6308 + } + }, + "83367": { + "compress": { + "chars": 39786, + "compressed": 15181 + }, + "safe_minify": { + "chars": 35634, + "compressed": 14189, + "tokens": 8075 + }, + "unsafe_minify": { + "chars": 33569, + "compressed": 13907, + "tokens": 8075 + } + }, + "85620": { + "compress": { + "chars": 42829, + "compressed": 15164 + }, + "safe_minify": { + "chars": 29108, + "compressed": 12344, + "tokens": 8132 + }, + "unsafe_minify": { + "chars": 29083, + "compressed": 12330, + "tokens": 8132 + } + }, + "86280": { + "compress": { + "chars": 35951, + "compressed": 14527 + }, + "safe_minify": { + "chars": 28828, + "compressed": 13257, + "tokens": 7707 + }, + "unsafe_minify": { + "chars": 28334, + "compressed": 13208, + "tokens": 7707 + } + }, + "89823": { + "compress": { + "chars": 35746, + "compressed": 10130 + }, + "safe_minify": { + "chars": 24617, + "compressed": 7737, + "tokens": 8108 + }, + "unsafe_minify": { + "chars": 22503, + "compressed": 7471, + "tokens": 8108 + } + }, + "89915": { + "compress": { + "chars": 30466, + "compressed": 14407 + }, + "safe_minify": { + "chars": 30730, + "compressed": 14283, + "tokens": 8147 + }, + "unsafe_minify": { + "chars": 30832, + "compressed": 14256, + "tokens": 8147 + } + }, + "90020": { + "compress": { + "chars": 42234, + "compressed": 12451 + }, + "safe_minify": { + "chars": 19222, + "compressed": 7361, + "tokens": 7590 + }, + "unsafe_minify": { + "chars": 19211, + "compressed": 7346, + "tokens": 7590 + } + }, + "91453": { + "compress": { + "chars": 54034, + "compressed": 13353 + }, + "safe_minify": { + "chars": 27443, + "compressed": 9173, + "tokens": 7965 + }, + "unsafe_minify": { + "chars": 21296, + "compressed": 8310, + "tokens": 7965 + } + }, + "94408": { + "compress": { + "chars": 48356, + "compressed": 13608 + }, + "safe_minify": { + "chars": 34403, + "compressed": 11336, + "tokens": 4504 + }, + "unsafe_minify": { + "chars": 34367, + "compressed": 11334, + "tokens": 4504 + } + }, + "96334": { + "compress": { + "chars": 51283, + "compressed": 14899 + }, + "safe_minify": { + "chars": 25991, + "compressed": 8780, + "tokens": 8148 + }, + "unsafe_minify": { + "chars": 21404, + "compressed": 8214, + "tokens": 8148 + } + }, + "97636": { + "compress": { + "chars": 19446, + "compressed": 5849 + }, + "safe_minify": { + "chars": 10084, + "compressed": 4007, + "tokens": 4284 + }, + "unsafe_minify": { + "chars": 9640, + "compressed": 3919, + "tokens": 4284 + } + }, + "9983": { + "compress": { + "chars": 15248, + "compressed": 6109 + }, + "safe_minify": { + "chars": 12099, + "compressed": 5143, + "tokens": 5096 + }, + "unsafe_minify": { + "chars": 11656, + "compressed": 5044, + "tokens": 5096 + } + } +} \ No newline at end of file diff --git a/test_compare/bbs/normal.json b/test_compare/bbs/normal.json new file mode 100644 index 0000000..4dc7f4e --- /dev/null +++ b/test_compare/bbs/normal.json @@ -0,0 +1,930 @@ +{ + "100973": { + "compress": { + "chars": 39288, + "compressed": 8841 + }, + "safe_minify": { + "chars": 22048, + "compressed": 6529, + "tokens": 6821 + }, + "unsafe_minify": { + "chars": 18666, + "compressed": 6051, + "tokens": 6821 + } + }, + "101541": { + "compress": { + "chars": 34820, + "compressed": 12510 + }, + "safe_minify": { + "chars": 30590, + "compressed": 11703, + "tokens": 2274 + }, + "unsafe_minify": { + "chars": 30245, + "compressed": 11615, + "tokens": 2274 + } + }, + "103651": { + "compress": { + "chars": 40092, + "compressed": 15173 + }, + "safe_minify": { + "chars": 34313, + "compressed": 13558, + "tokens": 6352 + }, + "unsafe_minify": { + "chars": 31606, + "compressed": 13151, + "tokens": 6352 + } + }, + "10388": { + "compress": { + "chars": 31061, + "compressed": 12033 + }, + "safe_minify": { + "chars": 19726, + "compressed": 8976, + "tokens": 7853 + }, + "unsafe_minify": { + "chars": 19191, + "compressed": 8837, + "tokens": 7853 + } + }, + "107459": { + "compress": { + "chars": 43307, + "compressed": 15204 + }, + "safe_minify": { + "chars": 28293, + "compressed": 12050, + "tokens": 8154 + }, + "unsafe_minify": { + "chars": 27297, + "compressed": 11847, + "tokens": 8154 + } + }, + "109575": { + "compress": { + "chars": 31993, + "compressed": 10330 + }, + "safe_minify": { + "chars": 19996, + "compressed": 7009, + "tokens": 7144 + }, + "unsafe_minify": { + "chars": 17600, + "compressed": 6681, + "tokens": 7144 + } + }, + "109673": { + "compress": { + "chars": 14845, + "compressed": 5257 + }, + "safe_minify": { + "chars": 7611, + "compressed": 3559, + "tokens": 3104 + }, + "unsafe_minify": { + "chars": 7465, + "compressed": 3514, + "tokens": 3104 + } + }, + "109822": { + "compress": { + "chars": 35953, + "compressed": 14758 + }, + "safe_minify": { + "chars": 35366, + "compressed": 14610, + "tokens": 8100 + }, + "unsafe_minify": { + "chars": 34398, + "compressed": 14515, + "tokens": 8100 + } + }, + "112308": { + "compress": { + "chars": 52322, + "compressed": 15038 + }, + "safe_minify": { + "chars": 25046, + "compressed": 8748, + "tokens": 8081 + }, + "unsafe_minify": { + "chars": 19576, + "compressed": 8110, + "tokens": 8081 + } + }, + "112740": { + "compress": { + "chars": 49966, + "compressed": 14828 + }, + "safe_minify": { + "chars": 21274, + "compressed": 8770, + "tokens": 7956 + }, + "unsafe_minify": { + "chars": 18710, + "compressed": 8350, + "tokens": 7956 + } + }, + "112916": { + "compress": { + "chars": 39179, + "compressed": 13730 + }, + "safe_minify": { + "chars": 39027, + "compressed": 13545, + "tokens": 8171 + }, + "unsafe_minify": { + "chars": 36939, + "compressed": 13345, + "tokens": 8171 + } + }, + "114060": { + "compress": { + "chars": 45477, + "compressed": 13836 + }, + "safe_minify": { + "chars": 23479, + "compressed": 8670, + "tokens": 8053 + }, + "unsafe_minify": { + "chars": 21423, + "compressed": 8358, + "tokens": 8053 + } + }, + "114663": { + "compress": { + "chars": 49512, + "compressed": 15070 + }, + "safe_minify": { + "chars": 24911, + "compressed": 9335, + "tokens": 7927 + }, + "unsafe_minify": { + "chars": 20462, + "compressed": 8753, + "tokens": 7927 + } + }, + "115136": { + "compress": { + "chars": 4643, + "compressed": 1767 + }, + "safe_minify": { + "chars": 2729, + "compressed": 1194, + "tokens": 1348 + }, + "unsafe_minify": { + "chars": 2693, + "compressed": 1178, + "tokens": 1348 + } + }, + "116823": { + "compress": { + "chars": 50155, + "compressed": 15048 + }, + "safe_minify": { + "chars": 26442, + "compressed": 10851, + "tokens": 7956 + }, + "unsafe_minify": { + "chars": 22663, + "compressed": 10386, + "tokens": 7956 + } + }, + "116846": { + "compress": { + "chars": 39925, + "compressed": 12687 + }, + "safe_minify": { + "chars": 23180, + "compressed": 8629, + "tokens": 7629 + }, + "unsafe_minify": { + "chars": 20422, + "compressed": 8229, + "tokens": 7629 + } + }, + "11722": { + "compress": { + "chars": 26589, + "compressed": 7659 + }, + "safe_minify": { + "chars": 15257, + "compressed": 5198, + "tokens": 5847 + }, + "unsafe_minify": { + "chars": 13162, + "compressed": 4881, + "tokens": 5847 + } + }, + "119614": { + "compress": { + "chars": 40128, + "compressed": 14758 + }, + "safe_minify": { + "chars": 31395, + "compressed": 11861, + "tokens": 4790 + }, + "unsafe_minify": { + "chars": 27016, + "compressed": 11159, + "tokens": 4790 + } + }, + "12502": { + "compress": { + "chars": 13973, + "compressed": 5327 + }, + "safe_minify": { + "chars": 5199, + "compressed": 2541, + "tokens": 2321 + }, + "unsafe_minify": { + "chars": 5199, + "compressed": 2541, + "tokens": 2321 + } + }, + "12682": { + "compress": { + "chars": 31669, + "compressed": 10000 + }, + "safe_minify": { + "chars": 15003, + "compressed": 6585, + "tokens": 6200 + }, + "unsafe_minify": { + "chars": 14762, + "compressed": 6551, + "tokens": 6200 + } + }, + "13057": { + "compress": { + "chars": 16596, + "compressed": 6066 + }, + "safe_minify": { + "chars": 10377, + "compressed": 4860, + "tokens": 3190 + }, + "unsafe_minify": { + "chars": 10377, + "compressed": 4860, + "tokens": 3190 + } + }, + "131586": { + "compress": { + "chars": 27177, + "compressed": 8808 + }, + "safe_minify": { + "chars": 15450, + "compressed": 6163, + "tokens": 4723 + }, + "unsafe_minify": { + "chars": 15290, + "compressed": 6137, + "tokens": 4723 + } + }, + "132559": { + "compress": { + "chars": 40781, + "compressed": 14582 + }, + "safe_minify": { + "chars": 26937, + "compressed": 11751, + "tokens": 8015 + }, + "unsafe_minify": { + "chars": 25841, + "compressed": 11596, + "tokens": 8015 + } + }, + "142353": { + "compress": { + "chars": 41588, + "compressed": 15275 + }, + "safe_minify": { + "chars": 41525, + "compressed": 15251, + "tokens": 6098 + }, + "unsafe_minify": { + "chars": 40631, + "compressed": 15095, + "tokens": 6098 + } + }, + "15116": { + "compress": { + "chars": 23927, + "compressed": 6482 + }, + "safe_minify": { + "chars": 8336, + "compressed": 3404, + "tokens": 3643 + }, + "unsafe_minify": { + "chars": 7902, + "compressed": 3356, + "tokens": 3643 + } + }, + "18483": { + "compress": { + "chars": 30450, + "compressed": 9078 + }, + "safe_minify": { + "chars": 19788, + "compressed": 7070, + "tokens": 7421 + }, + "unsafe_minify": { + "chars": 18256, + "compressed": 6895, + "tokens": 7421 + } + }, + "20407": { + "compress": { + "chars": 7151, + "compressed": 2749 + }, + "safe_minify": { + "chars": 3229, + "compressed": 1502, + "tokens": 1324 + }, + "unsafe_minify": { + "chars": 3130, + "compressed": 1477, + "tokens": 1324 + } + }, + "21098": { + "compress": { + "chars": 31448, + "compressed": 11668 + }, + "safe_minify": { + "chars": 19323, + "compressed": 8612, + "tokens": 8107 + }, + "unsafe_minify": { + "chars": 17851, + "compressed": 8345, + "tokens": 8107 + } + }, + "24899": { + "compress": { + "chars": 38142, + "compressed": 12622 + }, + "safe_minify": { + "chars": 22351, + "compressed": 10027, + "tokens": 7659 + }, + "unsafe_minify": { + "chars": 21644, + "compressed": 9930, + "tokens": 7659 + } + }, + "26851": { + "compress": { + "chars": 28608, + "compressed": 13229 + }, + "safe_minify": { + "chars": 25277, + "compressed": 11858, + "tokens": 8081 + }, + "unsafe_minify": { + "chars": 24751, + "compressed": 11702, + "tokens": 8081 + } + }, + "33331": { + "compress": { + "chars": 17491, + "compressed": 5821 + }, + "safe_minify": { + "chars": 9916, + "compressed": 4251, + "tokens": 4017 + }, + "unsafe_minify": { + "chars": 9427, + "compressed": 4185, + "tokens": 4017 + } + }, + "41037": { + "compress": { + "chars": 45875, + "compressed": 12936 + }, + "safe_minify": { + "chars": 32716, + "compressed": 10617, + "tokens": 7294 + }, + "unsafe_minify": { + "chars": 32645, + "compressed": 10597, + "tokens": 7294 + } + }, + "42655": { + "compress": { + "chars": 22577, + "compressed": 8001 + }, + "safe_minify": { + "chars": 15162, + "compressed": 6109, + "tokens": 6163 + }, + "unsafe_minify": { + "chars": 13717, + "compressed": 5852, + "tokens": 6163 + } + }, + "43229": { + "compress": { + "chars": 39178, + "compressed": 11639 + }, + "safe_minify": { + "chars": 24714, + "compressed": 9060, + "tokens": 8111 + }, + "unsafe_minify": { + "chars": 22010, + "compressed": 8743, + "tokens": 8111 + } + }, + "44028": { + "compress": { + "chars": 45968, + "compressed": 12556 + }, + "safe_minify": { + "chars": 22786, + "compressed": 7588, + "tokens": 7428 + }, + "unsafe_minify": { + "chars": 18963, + "compressed": 7044, + "tokens": 7428 + } + }, + "47025": { + "compress": { + "chars": 13939, + "compressed": 4228 + }, + "safe_minify": { + "chars": 9221, + "compressed": 3439, + "tokens": 3763 + }, + "unsafe_minify": { + "chars": 8147, + "compressed": 3343, + "tokens": 3763 + } + }, + "59366": { + "compress": { + "chars": 34386, + "compressed": 12092 + }, + "safe_minify": { + "chars": 27471, + "compressed": 10428, + "tokens": 7377 + }, + "unsafe_minify": { + "chars": 24397, + "compressed": 9969, + "tokens": 7377 + } + }, + "59497": { + "compress": { + "chars": 24156, + "compressed": 11305 + }, + "safe_minify": { + "chars": 19336, + "compressed": 10362, + "tokens": 2882 + }, + "unsafe_minify": { + "chars": 19336, + "compressed": 10362, + "tokens": 2882 + } + }, + "59509": { + "compress": { + "chars": 39238, + "compressed": 11676 + }, + "safe_minify": { + "chars": 21398, + "compressed": 7361, + "tokens": 8085 + }, + "unsafe_minify": { + "chars": 19131, + "compressed": 7079, + "tokens": 8085 + } + }, + "66786": { + "compress": { + "chars": 25587, + "compressed": 8130 + }, + "safe_minify": { + "chars": 13465, + "compressed": 5396, + "tokens": 5502 + }, + "unsafe_minify": { + "chars": 12343, + "compressed": 5222, + "tokens": 5502 + } + }, + "66935": { + "compress": { + "chars": 42758, + "compressed": 12530 + }, + "safe_minify": { + "chars": 34978, + "compressed": 11332, + "tokens": 7055 + }, + "unsafe_minify": { + "chars": 31790, + "compressed": 10857, + "tokens": 7055 + } + }, + "69899": { + "compress": { + "chars": 36598, + "compressed": 12136 + }, + "safe_minify": { + "chars": 20978, + "compressed": 7907, + "tokens": 5448 + }, + "unsafe_minify": { + "chars": 17463, + "compressed": 7417, + "tokens": 5448 + } + }, + "72921": { + "compress": { + "chars": 37571, + "compressed": 13933 + }, + "safe_minify": { + "chars": 23204, + "compressed": 10928, + "tokens": 8101 + }, + "unsafe_minify": { + "chars": 20748, + "compressed": 10535, + "tokens": 8101 + } + }, + "75108": { + "compress": { + "chars": 9209, + "compressed": 3105 + }, + "safe_minify": { + "chars": 5066, + "compressed": 2234, + "tokens": 2695 + }, + "unsafe_minify": { + "chars": 5056, + "compressed": 2231, + "tokens": 2695 + } + }, + "75741": { + "compress": { + "chars": 28410, + "compressed": 8718 + }, + "safe_minify": { + "chars": 16853, + "compressed": 6478, + "tokens": 4596 + }, + "unsafe_minify": { + "chars": 16853, + "compressed": 6478, + "tokens": 4596 + } + }, + "78599": { + "compress": { + "chars": 44095, + "compressed": 15154 + }, + "safe_minify": { + "chars": 25755, + "compressed": 11203, + "tokens": 8056 + }, + "unsafe_minify": { + "chars": 23899, + "compressed": 10903, + "tokens": 8056 + } + }, + "82023": { + "compress": { + "chars": 25528, + "compressed": 9252 + }, + "safe_minify": { + "chars": 15126, + "compressed": 6470, + "tokens": 6308 + }, + "unsafe_minify": { + "chars": 14578, + "compressed": 6340, + "tokens": 6308 + } + }, + "83367": { + "compress": { + "chars": 39786, + "compressed": 15181 + }, + "safe_minify": { + "chars": 33984, + "compressed": 14181, + "tokens": 8075 + }, + "unsafe_minify": { + "chars": 31767, + "compressed": 13923, + "tokens": 8075 + } + }, + "85620": { + "compress": { + "chars": 42829, + "compressed": 15164 + }, + "safe_minify": { + "chars": 28886, + "compressed": 12338, + "tokens": 8132 + }, + "unsafe_minify": { + "chars": 28861, + "compressed": 12322, + "tokens": 8132 + } + }, + "86280": { + "compress": { + "chars": 35951, + "compressed": 14527 + }, + "safe_minify": { + "chars": 28335, + "compressed": 13250, + "tokens": 7707 + }, + "unsafe_minify": { + "chars": 27830, + "compressed": 13193, + "tokens": 7707 + } + }, + "89823": { + "compress": { + "chars": 35746, + "compressed": 10130 + }, + "safe_minify": { + "chars": 23525, + "compressed": 7770, + "tokens": 8108 + }, + "unsafe_minify": { + "chars": 21184, + "compressed": 7507, + "tokens": 8108 + } + }, + "89915": { + "compress": { + "chars": 30466, + "compressed": 14407 + }, + "safe_minify": { + "chars": 29670, + "compressed": 14277, + "tokens": 8147 + }, + "unsafe_minify": { + "chars": 29668, + "compressed": 14277, + "tokens": 8147 + } + }, + "90020": { + "compress": { + "chars": 42234, + "compressed": 12451 + }, + "safe_minify": { + "chars": 17879, + "compressed": 7311, + "tokens": 7590 + }, + "unsafe_minify": { + "chars": 17868, + "compressed": 7295, + "tokens": 7590 + } + }, + "91453": { + "compress": { + "chars": 54034, + "compressed": 13353 + }, + "safe_minify": { + "chars": 26579, + "compressed": 9175, + "tokens": 7965 + }, + "unsafe_minify": { + "chars": 20214, + "compressed": 8346, + "tokens": 7965 + } + }, + "94408": { + "compress": { + "chars": 48356, + "compressed": 13608 + }, + "safe_minify": { + "chars": 34246, + "compressed": 11358, + "tokens": 4504 + }, + "unsafe_minify": { + "chars": 34210, + "compressed": 11354, + "tokens": 4504 + } + }, + "96334": { + "compress": { + "chars": 51283, + "compressed": 14899 + }, + "safe_minify": { + "chars": 25209, + "compressed": 8896, + "tokens": 8148 + }, + "unsafe_minify": { + "chars": 20426, + "compressed": 8322, + "tokens": 8148 + } + }, + "97636": { + "compress": { + "chars": 19446, + "compressed": 5849 + }, + "safe_minify": { + "chars": 9583, + "compressed": 3993, + "tokens": 4284 + }, + "unsafe_minify": { + "chars": 9136, + "compressed": 3907, + "tokens": 4284 + } + }, + "9983": { + "compress": { + "chars": 15248, + "compressed": 6109 + }, + "safe_minify": { + "chars": 11053, + "compressed": 5149, + "tokens": 5096 + }, + "unsafe_minify": { + "chars": 10517, + "compressed": 5058, + "tokens": 5096 + } + } +} \ No newline at end of file diff --git a/test_compare/bbs/tokens.json b/test_compare/bbs/tokens.json new file mode 100644 index 0000000..3eca04a --- /dev/null +++ b/test_compare/bbs/tokens.json @@ -0,0 +1,930 @@ +{ + "100973": { + "compress": { + "chars": 39288, + "compressed": 8841 + }, + "safe_minify": { + "chars": 22057, + "compressed": 6534, + "tokens": 6812 + }, + "unsafe_minify": { + "chars": 18723, + "compressed": 6070, + "tokens": 6744 + } + }, + "101541": { + "compress": { + "chars": 34820, + "compressed": 12510 + }, + "safe_minify": { + "chars": 30592, + "compressed": 11703, + "tokens": 2272 + }, + "unsafe_minify": { + "chars": 30258, + "compressed": 11618, + "tokens": 2261 + } + }, + "103651": { + "compress": { + "chars": 40092, + "compressed": 15173 + }, + "safe_minify": { + "chars": 34314, + "compressed": 13558, + "tokens": 6351 + }, + "unsafe_minify": { + "chars": 31646, + "compressed": 13172, + "tokens": 6303 + } + }, + "10388": { + "compress": { + "chars": 31061, + "compressed": 12033 + }, + "safe_minify": { + "chars": 19726, + "compressed": 8974, + "tokens": 7852 + }, + "unsafe_minify": { + "chars": 19287, + "compressed": 8912, + "tokens": 7709 + } + }, + "107459": { + "compress": { + "chars": 43307, + "compressed": 15204 + }, + "safe_minify": { + "chars": 28294, + "compressed": 12051, + "tokens": 8153 + }, + "unsafe_minify": { + "chars": 27310, + "compressed": 11846, + "tokens": 8140 + } + }, + "109575": { + "compress": { + "chars": 31993, + "compressed": 10330 + }, + "safe_minify": { + "chars": 19996, + "compressed": 7010, + "tokens": 7143 + }, + "unsafe_minify": { + "chars": 17651, + "compressed": 6722, + "tokens": 7058 + } + }, + "109673": { + "compress": { + "chars": 14845, + "compressed": 5257 + }, + "safe_minify": { + "chars": 7612, + "compressed": 3560, + "tokens": 3102 + }, + "unsafe_minify": { + "chars": 7490, + "compressed": 3529, + "tokens": 3064 + } + }, + "109822": { + "compress": { + "chars": 35953, + "compressed": 14758 + }, + "safe_minify": { + "chars": 35373, + "compressed": 14613, + "tokens": 8087 + }, + "unsafe_minify": { + "chars": 34419, + "compressed": 14517, + "tokens": 8064 + } + }, + "112308": { + "compress": { + "chars": 52322, + "compressed": 15038 + }, + "safe_minify": { + "chars": 25050, + "compressed": 8758, + "tokens": 8071 + }, + "unsafe_minify": { + "chars": 19741, + "compressed": 8180, + "tokens": 7855 + } + }, + "112740": { + "compress": { + "chars": 49966, + "compressed": 14828 + }, + "safe_minify": { + "chars": 21278, + "compressed": 8767, + "tokens": 7952 + }, + "unsafe_minify": { + "chars": 18808, + "compressed": 8380, + "tokens": 7808 + } + }, + "112916": { + "compress": { + "chars": 39179, + "compressed": 13730 + }, + "safe_minify": { + "chars": 39027, + "compressed": 13545, + "tokens": 8171 + }, + "unsafe_minify": { + "chars": 36941, + "compressed": 13346, + "tokens": 8166 + } + }, + "114060": { + "compress": { + "chars": 45477, + "compressed": 13836 + }, + "safe_minify": { + "chars": 23483, + "compressed": 8669, + "tokens": 8041 + }, + "unsafe_minify": { + "chars": 21471, + "compressed": 8369, + "tokens": 7977 + } + }, + "114663": { + "compress": { + "chars": 49512, + "compressed": 15070 + }, + "safe_minify": { + "chars": 24913, + "compressed": 9341, + "tokens": 7923 + }, + "unsafe_minify": { + "chars": 20624, + "compressed": 8797, + "tokens": 7697 + } + }, + "115136": { + "compress": { + "chars": 4643, + "compressed": 1767 + }, + "safe_minify": { + "chars": 2732, + "compressed": 1191, + "tokens": 1343 + }, + "unsafe_minify": { + "chars": 2700, + "compressed": 1170, + "tokens": 1334 + } + }, + "116823": { + "compress": { + "chars": 50155, + "compressed": 15048 + }, + "safe_minify": { + "chars": 26445, + "compressed": 10855, + "tokens": 7948 + }, + "unsafe_minify": { + "chars": 22756, + "compressed": 10452, + "tokens": 7800 + } + }, + "116846": { + "compress": { + "chars": 39925, + "compressed": 12687 + }, + "safe_minify": { + "chars": 23184, + "compressed": 8635, + "tokens": 7624 + }, + "unsafe_minify": { + "chars": 20502, + "compressed": 8296, + "tokens": 7509 + } + }, + "11722": { + "compress": { + "chars": 26589, + "compressed": 7659 + }, + "safe_minify": { + "chars": 15257, + "compressed": 5198, + "tokens": 5847 + }, + "unsafe_minify": { + "chars": 13258, + "compressed": 4951, + "tokens": 5709 + } + }, + "119614": { + "compress": { + "chars": 40128, + "compressed": 14758 + }, + "safe_minify": { + "chars": 31396, + "compressed": 11863, + "tokens": 4789 + }, + "unsafe_minify": { + "chars": 27020, + "compressed": 11166, + "tokens": 4763 + } + }, + "12502": { + "compress": { + "chars": 13973, + "compressed": 5327 + }, + "safe_minify": { + "chars": 5199, + "compressed": 2541, + "tokens": 2321 + }, + "unsafe_minify": { + "chars": 5288, + "compressed": 2562, + "tokens": 2204 + } + }, + "12682": { + "compress": { + "chars": 31669, + "compressed": 10000 + }, + "safe_minify": { + "chars": 15005, + "compressed": 6586, + "tokens": 6198 + }, + "unsafe_minify": { + "chars": 14836, + "compressed": 6484, + "tokens": 6010 + } + }, + "13057": { + "compress": { + "chars": 16596, + "compressed": 6066 + }, + "safe_minify": { + "chars": 10377, + "compressed": 4860, + "tokens": 3190 + }, + "unsafe_minify": { + "chars": 10458, + "compressed": 4893, + "tokens": 3088 + } + }, + "131586": { + "compress": { + "chars": 27177, + "compressed": 8808 + }, + "safe_minify": { + "chars": 15451, + "compressed": 6167, + "tokens": 4722 + }, + "unsafe_minify": { + "chars": 15320, + "compressed": 6153, + "tokens": 4688 + } + }, + "132559": { + "compress": { + "chars": 40781, + "compressed": 14582 + }, + "safe_minify": { + "chars": 26941, + "compressed": 11749, + "tokens": 8008 + }, + "unsafe_minify": { + "chars": 25848, + "compressed": 11597, + "tokens": 8001 + } + }, + "142353": { + "compress": { + "chars": 41588, + "compressed": 15275 + }, + "safe_minify": { + "chars": 41526, + "compressed": 15252, + "tokens": 6097 + }, + "unsafe_minify": { + "chars": 40656, + "compressed": 15093, + "tokens": 6067 + } + }, + "15116": { + "compress": { + "chars": 23927, + "compressed": 6482 + }, + "safe_minify": { + "chars": 8340, + "compressed": 3405, + "tokens": 3637 + }, + "unsafe_minify": { + "chars": 7987, + "compressed": 3349, + "tokens": 3534 + } + }, + "18483": { + "compress": { + "chars": 30450, + "compressed": 9078 + }, + "safe_minify": { + "chars": 19788, + "compressed": 7070, + "tokens": 7421 + }, + "unsafe_minify": { + "chars": 18435, + "compressed": 6969, + "tokens": 7122 + } + }, + "20407": { + "compress": { + "chars": 7151, + "compressed": 2749 + }, + "safe_minify": { + "chars": 3229, + "compressed": 1502, + "tokens": 1324 + }, + "unsafe_minify": { + "chars": 3137, + "compressed": 1478, + "tokens": 1315 + } + }, + "21098": { + "compress": { + "chars": 31448, + "compressed": 11668 + }, + "safe_minify": { + "chars": 19328, + "compressed": 8614, + "tokens": 8102 + }, + "unsafe_minify": { + "chars": 18001, + "compressed": 8532, + "tokens": 7841 + } + }, + "24899": { + "compress": { + "chars": 38142, + "compressed": 12622 + }, + "safe_minify": { + "chars": 22356, + "compressed": 10026, + "tokens": 7645 + }, + "unsafe_minify": { + "chars": 21729, + "compressed": 9976, + "tokens": 7487 + } + }, + "26851": { + "compress": { + "chars": 28608, + "compressed": 13229 + }, + "safe_minify": { + "chars": 25279, + "compressed": 11861, + "tokens": 8079 + }, + "unsafe_minify": { + "chars": 24755, + "compressed": 11705, + "tokens": 8077 + } + }, + "33331": { + "compress": { + "chars": 17491, + "compressed": 5821 + }, + "safe_minify": { + "chars": 9916, + "compressed": 4251, + "tokens": 4017 + }, + "unsafe_minify": { + "chars": 9461, + "compressed": 4209, + "tokens": 3966 + } + }, + "41037": { + "compress": { + "chars": 45875, + "compressed": 12936 + }, + "safe_minify": { + "chars": 32716, + "compressed": 10617, + "tokens": 7294 + }, + "unsafe_minify": { + "chars": 32743, + "compressed": 10593, + "tokens": 7127 + } + }, + "42655": { + "compress": { + "chars": 22577, + "compressed": 8001 + }, + "safe_minify": { + "chars": 15163, + "compressed": 6111, + "tokens": 6161 + }, + "unsafe_minify": { + "chars": 13746, + "compressed": 5862, + "tokens": 6121 + } + }, + "43229": { + "compress": { + "chars": 39178, + "compressed": 11639 + }, + "safe_minify": { + "chars": 24715, + "compressed": 9062, + "tokens": 8104 + }, + "unsafe_minify": { + "chars": 22054, + "compressed": 8762, + "tokens": 8046 + } + }, + "44028": { + "compress": { + "chars": 45968, + "compressed": 12556 + }, + "safe_minify": { + "chars": 22791, + "compressed": 7592, + "tokens": 7422 + }, + "unsafe_minify": { + "chars": 19063, + "compressed": 7059, + "tokens": 7295 + } + }, + "47025": { + "compress": { + "chars": 13939, + "compressed": 4228 + }, + "safe_minify": { + "chars": 9227, + "compressed": 3459, + "tokens": 3751 + }, + "unsafe_minify": { + "chars": 8205, + "compressed": 3421, + "tokens": 3641 + } + }, + "59366": { + "compress": { + "chars": 34386, + "compressed": 12092 + }, + "safe_minify": { + "chars": 27473, + "compressed": 10429, + "tokens": 7375 + }, + "unsafe_minify": { + "chars": 24404, + "compressed": 9976, + "tokens": 7362 + } + }, + "59497": { + "compress": { + "chars": 24156, + "compressed": 11305 + }, + "safe_minify": { + "chars": 19341, + "compressed": 10366, + "tokens": 2868 + }, + "unsafe_minify": { + "chars": 19351, + "compressed": 10374, + "tokens": 2853 + } + }, + "59509": { + "compress": { + "chars": 39238, + "compressed": 11676 + }, + "safe_minify": { + "chars": 21398, + "compressed": 7361, + "tokens": 8085 + }, + "unsafe_minify": { + "chars": 19250, + "compressed": 7078, + "tokens": 7917 + } + }, + "66786": { + "compress": { + "chars": 25587, + "compressed": 8130 + }, + "safe_minify": { + "chars": 13469, + "compressed": 5392, + "tokens": 5490 + }, + "unsafe_minify": { + "chars": 12394, + "compressed": 5239, + "tokens": 5417 + } + }, + "66935": { + "compress": { + "chars": 42758, + "compressed": 12530 + }, + "safe_minify": { + "chars": 34980, + "compressed": 11336, + "tokens": 7053 + }, + "unsafe_minify": { + "chars": 31800, + "compressed": 10857, + "tokens": 7040 + } + }, + "69899": { + "compress": { + "chars": 36598, + "compressed": 12136 + }, + "safe_minify": { + "chars": 20981, + "compressed": 7906, + "tokens": 5442 + }, + "unsafe_minify": { + "chars": 17518, + "compressed": 7458, + "tokens": 5357 + } + }, + "72921": { + "compress": { + "chars": 37571, + "compressed": 13933 + }, + "safe_minify": { + "chars": 23205, + "compressed": 10928, + "tokens": 8100 + }, + "unsafe_minify": { + "chars": 20816, + "compressed": 10531, + "tokens": 8005 + } + }, + "75108": { + "compress": { + "chars": 9209, + "compressed": 3105 + }, + "safe_minify": { + "chars": 5067, + "compressed": 2235, + "tokens": 2694 + }, + "unsafe_minify": { + "chars": 5060, + "compressed": 2232, + "tokens": 2691 + } + }, + "75741": { + "compress": { + "chars": 28410, + "compressed": 8718 + }, + "safe_minify": { + "chars": 16853, + "compressed": 6478, + "tokens": 4595 + }, + "unsafe_minify": { + "chars": 16901, + "compressed": 6470, + "tokens": 4529 + } + }, + "78599": { + "compress": { + "chars": 44095, + "compressed": 15154 + }, + "safe_minify": { + "chars": 25755, + "compressed": 11205, + "tokens": 8054 + }, + "unsafe_minify": { + "chars": 23905, + "compressed": 10904, + "tokens": 8046 + } + }, + "82023": { + "compress": { + "chars": 25528, + "compressed": 9252 + }, + "safe_minify": { + "chars": 15129, + "compressed": 6472, + "tokens": 6305 + }, + "unsafe_minify": { + "chars": 14638, + "compressed": 6367, + "tokens": 6214 + } + }, + "83367": { + "compress": { + "chars": 39786, + "compressed": 15181 + }, + "safe_minify": { + "chars": 33993, + "compressed": 14174, + "tokens": 8064 + }, + "unsafe_minify": { + "chars": 31824, + "compressed": 13950, + "tokens": 7981 + } + }, + "85620": { + "compress": { + "chars": 42829, + "compressed": 15164 + }, + "safe_minify": { + "chars": 28886, + "compressed": 12338, + "tokens": 8132 + }, + "unsafe_minify": { + "chars": 28923, + "compressed": 12341, + "tokens": 8059 + } + }, + "86280": { + "compress": { + "chars": 35951, + "compressed": 14527 + }, + "safe_minify": { + "chars": 28335, + "compressed": 13250, + "tokens": 7707 + }, + "unsafe_minify": { + "chars": 27831, + "compressed": 13193, + "tokens": 7705 + } + }, + "89823": { + "compress": { + "chars": 35746, + "compressed": 10130 + }, + "safe_minify": { + "chars": 23527, + "compressed": 7770, + "tokens": 8106 + }, + "unsafe_minify": { + "chars": 21246, + "compressed": 7500, + "tokens": 8024 + } + }, + "89915": { + "compress": { + "chars": 30466, + "compressed": 14407 + }, + "safe_minify": { + "chars": 29670, + "compressed": 14277, + "tokens": 8146 + }, + "unsafe_minify": { + "chars": 29670, + "compressed": 14276, + "tokens": 8143 + } + }, + "90020": { + "compress": { + "chars": 42234, + "compressed": 12451 + }, + "safe_minify": { + "chars": 17896, + "compressed": 7302, + "tokens": 7567 + }, + "unsafe_minify": { + "chars": 17927, + "compressed": 7291, + "tokens": 7498 + } + }, + "91453": { + "compress": { + "chars": 54034, + "compressed": 13353 + }, + "safe_minify": { + "chars": 26581, + "compressed": 9181, + "tokens": 7959 + }, + "unsafe_minify": { + "chars": 20271, + "compressed": 8417, + "tokens": 7872 + } + }, + "94408": { + "compress": { + "chars": 48356, + "compressed": 13608 + }, + "safe_minify": { + "chars": 34252, + "compressed": 11359, + "tokens": 4496 + }, + "unsafe_minify": { + "chars": 34287, + "compressed": 11400, + "tokens": 4386 + } + }, + "96334": { + "compress": { + "chars": 51283, + "compressed": 14899 + }, + "safe_minify": { + "chars": 25210, + "compressed": 8893, + "tokens": 8143 + }, + "unsafe_minify": { + "chars": 20547, + "compressed": 8362, + "tokens": 7944 + } + }, + "97636": { + "compress": { + "chars": 19446, + "compressed": 5849 + }, + "safe_minify": { + "chars": 9583, + "compressed": 3993, + "tokens": 4284 + }, + "unsafe_minify": { + "chars": 9174, + "compressed": 3899, + "tokens": 4234 + } + }, + "9983": { + "compress": { + "chars": 15248, + "compressed": 6109 + }, + "safe_minify": { + "chars": 11053, + "compressed": 5149, + "tokens": 5096 + }, + "unsafe_minify": { + "chars": 10626, + "compressed": 5133, + "tokens": 4941 + } + } +} \ No newline at end of file diff --git a/test_compare/const.p8 b/test_compare/const.p8 index 4646f4f..86e133b 100644 --- a/test_compare/const.p8 +++ b/test_compare/const.p8 @@ -7,7 +7,7 @@ function print(value) end -- neg ?0 -?65535 +?-1 ?1 ?32768 ?32768.00002 @@ -24,42 +24,42 @@ if (ERROR) ?-nil ?5 ?5 ?0 -?65531 -?65530 -?65530 -?65535 +?-5 +?-6 +?-6 +?-1 ?32768 -- ceil ?5 ?6 ?6 ?1 -?65531 -?65531 -?65531 +?-5 +?-5 +?-5 ?0 ?ceil(0x7fff.0001) -- add ?3 -?32768.99999 +?~32767 ?.99999 ?"1" + "2" if (ERROR) ?me + 1 if (ERROR) ?1 + me -- sub -?65535 -?65535.99999 +?-1 +?~0 if (ERROR) ?"a" - "a" -- mul ?4.5 ?3.29998 -?65442.52021 +?-93.4798 ?5535 ?60001 ?0x4000 * 2 ?32768 ?123 * 456 -?65413 * 456 +?-123 * 456 ?1245 * 4253 -- div ?4 @@ -68,25 +68,25 @@ if (ERROR) ?"a" - "a" ?0 / 0 ?1008.24614 ?100 / 0.001 -?65535.6154 +?~.3846 ?52932.87871 -?65535.25 -?65535.25 +?-.75 +?-.75 ?.75 -- idiv ?4 ?2 -?65533 -?65533 +?-3 +?-3 ?2 ?8 -?65527 +?-9 ?4 \ 0 -- mod ?2 ?3 -?12 % 65531 -?65524 % 65531 +?12 % -5 +?-12 % -5 ?12 % 0 ?2.2 ?1.2 @@ -147,22 +147,22 @@ if (ERROR) ?false <= true ?1 ?max(4) -- min -?65413 +?-123 ?3 ?32768 -- mid ?3 ?3 ?3 -?65533 +?-3 ?123.456 -- bnot -?65535.99999 -?65534.99999 +?~0 +?~1 ?.99999 if (ERROR) ?~true if (ERROR) ?~"x" -?65534.8 +?~1.2 ?bnot(1,2) -- band ?544.32935 @@ -184,17 +184,17 @@ if (ERROR) ?~"x" ?0 ?2330.16889 ?0x1234.5678 << 0.9 -?65520 +?-16 -- shr ?.00123 ?.00002 -?65535.99999 +?~0 ?4660.33777 ?0 -?65535.99999 -?65535.99999 +?~0 +?~0 ?0xe468.acf -?65533.5 +?-2.5 -- lshr ?.00123 ?.00002 @@ -261,6 +261,18 @@ local function --[[const]] nocrash() end local --[[const]] f = max() ?8 menuitem,chr=41,42 +-- misc1.5 +local --[[non-const]] ncval = 4 +?(-3)*ncval +?(-3)^ncval +?ncval^(-3) +?65533^2 +?-65533^2 +?2^-3 +?3 +?2.99999 +?false +if (ERROR) ?#65533 -- misc2 --[[const]] ; ?61.5 --[[const]] ; ?579 diff --git a/test_compare/const.p8.printh b/test_compare/const.p8.printh index e40e358..2c6d505 100644 --- a/test_compare/const.p8.printh +++ b/test_compare/const.p8.printh @@ -204,6 +204,15 @@ bla◝ナ 0x0023.0000 0x0042.0000 0x0008.0000 +0xfff4.0000 +0x0051.0000 +0x0000.0400 +0x0009.0000 +0xfff7.0000 +0x0000.2000 +0x0003.0000 +0x0002.ffff +false 0x003d.8000 0x0243.0000 0x0243.0000 diff --git a/test_compare/constmin.p8 b/test_compare/constmin.p8 index 6cd765f..60f1fd9 100644 --- a/test_compare/constmin.p8 +++ b/test_compare/constmin.p8 @@ -194,15 +194,15 @@ if(e)?~"x" ?false ?l ?nil -?i and l -?i and 4 +?n and l +?n and 4 ?true ?3 ?4 ?l ?3 -?i or l -?i or 4 +?n or l +?n or 4 if(e)?#123 ?0 ?3 @@ -214,35 +214,54 @@ if(e)?#123 ?"-32768-2" ?"1"..2.3 if(e)?"1"..false -function n()return 10end?23 +function f()return 10end?23 ?35 -local e=n()?e*3+36 -local function l()end local l=max()?8 -menuitem,chr=41,42?61.5 +local l=f()?l*3+36 +local function n()end local n=max()?8 +menuitem,chr=41,42local n=4?-3*n +?(-3)^n +?n^-3 +?65533^2 +?-65533^2 +?2^-3 +?3 +?2.99999 +?false +if(e)?#65533 +?61.5 ?579 -s=456,789?579 +a=456,789?579 ?123 ?nil -f,a=n(),n()?123 -f=n()?579 -d,r=n()?r +i,s=f(),f()?123 +i=f()?579 +d,r=f()?r u=nil?5 u=1?5 ?nil -local l?5 -l=1?5 +local e?5 +e=1?5 ?nil -local l l=l,l l,l=l?nil -local l=n();({}).e=n();({}).e=n();({}).e=n()?n() +local e e=e,e e,e=e?nil +local e=f();({}).e=f();({}).e=f();({}).e=f()?f() ;({}).e=4print(true)?false -print(true)print(false)print(true)print(nil)print(false)print(nil)print(0)print(false)if n then print(nil)else print(false)end print(nil)print(true)if n then print(true)else print(nil)end if n then print(true)else print(false)end if n then print(true)else print(nil)end if n then print(true)end if n then print(true)else print(nil)end if n then print(true)else print(0)end if n then print(true)else print(false)end if n then print(true)elseif f then print(1)else print(nil)end if n then print(true)elseif f then print(1)else print(false)end if n then print(true)elseif f then print(1)else print(nil)end if n then print(true)elseif f then print(1)end if n then print(true)elseif f then print(1)else print(nil)end if n then print(true)elseif f then print(1)else print(0)end if n then print(true)elseif f then print(1)else print(false)end?"" +print(true)print(false)print(true)print(nil)print(false)print(nil)print(0)print(false)if(f)print(nil)else print(false) +print(nil)print(true)if(f)print(true)else print(nil) +if(f)print(true)else print(false) +if(f)print(true)else print(nil) +if(f)print(true) +if(f)print(true)else print(nil) +if(f)print(true)else print(0) +if(f)print(true)else print(false) +if f then print(true)elseif i then print(1)else print(nil)end if f then print(true)elseif i then print(1)else print(false)end if f then print(true)elseif i then print(1)else print(nil)end if f then print(true)elseif i then print(1)end if f then print(true)elseif i then print(1)else print(nil)end if f then print(true)elseif i then print(1)else print(0)end if f then print(true)elseif i then print(1)else print(false)end?"" ?"" -do local e=3end?e -?e -if n then local e=3end?e -?e -do local function e()end end?e -?e +do local e=3end?l +?l +if(f)local e=3 +?l +?l +do local function e()end end?l +?l do do::e::end goto e end::e::do goto l end::l::do return end?3 __meta:title__ [[non-const]] local ERROR = false diff --git a/test_compare/input-reformat.p8 b/test_compare/input-reformat.p8 index 5535e90..7d8491d 100644 --- a/test_compare/input-reformat.p8 +++ b/test_compare/input-reformat.p8 @@ -167,6 +167,7 @@ until (1 == 1) for a in (all({})) do end print("test" .. (@16) .. "str") +?(calls3) + ((({})[1]) and (({}).🐱) or (...) or (xxx())) + (3) + (-3) -- shorthands if true then ?"sh1" diff --git a/test_compare/input-un.p8 b/test_compare/input-un.p8 index a923251..50ffc95 100644 --- a/test_compare/input-un.p8 +++ b/test_compare/input-un.p8 @@ -4,7 +4,7 @@ __lua__ print = printh ?"hello ᶜ7there♥ら" -🐱, a, h, u, s, x, e, e = 11, 12, 13, 14, 15, 16, 17, 17 +🐱, h, u, s, x, k, e, e = 11, 12, 13, 14, 15, 16, 17, 17 t(stat(band())) -- this one comment, i do want! t() @@ -121,7 +121,7 @@ e += 1 l, n = sin(1, 2), cos((cos())) o, f = (cos((cos()))) -function k() +function r() return 1, 2, ord "1", (ord "1") end @@ -136,6 +136,7 @@ until 1 == 1 for e in (all {}) do end print("test" .. @16 .. "str") +?e + (({})[1] and ({}).x or ... or r()) + 3 + -3 if true then ?"sh1" end @@ -156,12 +157,12 @@ if true then end j = "renaming bug" -function r() +function d() local e, l, n, o, f, i, c, r, d, a, t, h, u, s, x, k, y, v, p, b, w, g, _, m, E, N, D return j end -?r() +?d() c = 0 c = 1 @@ -174,10 +175,10 @@ function new_name(new_name2, e, l) return new_name2.new_member end -function d(l, e, f, n, o, i) +function a(l, e, f, n, o, i) return l + e + f + n + o + i end -?d(1, 2, 4, 8, 16, 32) +?a(1, 2, 4, 8, 16, 32) y = ?"END!" diff --git a/test_compare/output-simp.p8 b/test_compare/output-simp.p8 index 513df83..8b3cfb6 100644 --- a/test_compare/output-simp.p8 +++ b/test_compare/output-simp.p8 @@ -2,7 +2,7 @@ pico-8 cartridge // http://www.pico-8.com version 42 __lua__ print=printh?"hello ᶜ7there♥ら" -🐱,u,h,s,k,y,l,l=11,12,13,14,15,16,17,17t(stat(band()))-- this one comment, i do want! +🐱,h,s,k,y,x,l,l=11,12,13,14,15,16,17,17t(stat(band()))-- this one comment, i do want! t()a=0e=0e=0print"this is included"?"#[disable[[this for now/ever]]]" local l={1,2,3}print(#l)print(22)local l,e="preserved_key",{preserved_key=123}?e[l] local l="preserved_glob"preserved_glob=123?_ENV[l] @@ -24,9 +24,10 @@ local l={1},{1,2,3,4}local l,e=true,1,1.2345,4660,4660.33777,-1,-1.2345,60875.66 ]]]=]]===]]==]local e=-256,64512,65280^4,256,255.99999if(not l)l=-1 function r(...)return 1.2 ..4 .. .....0end?r(3) ?1 -?((~(((((((tonum(true)|1)~2)&3)>>1)..1)-(4))*3))^2)^1 -local l=({})[1],(function()end)()local e,n,o,l,c=sin(1,2),cos((cos())),(cos((cos()))),{d=ord,f=pal}local l=ord"123",pal{1,2},l:d("ord"),l:f({1,2}),sin(1)local r={ord"1",[2]=3,o=4,(ord"1")}l+=1e,n=sin(1,2),cos((cos()))o,c=(cos((cos())))function x()return 1,2,ord"1",(ord"1")end while false do end repeat until true for l in(all{})do end print("test"..@16 .."str")?"sh1" +?((~(((((((tonum(true)|1)~2)&3)>>1)..1)-4)*3))^2)^1 +local l=({})[1],(function()end)()local e,n,o,l,c=sin(1,2),cos((cos())),(cos((cos()))),{d=ord,f=pal}local l=ord"123",pal{1,2},l:d("ord"),l:f({1,2}),sin(1)local r={ord"1",[2]=3,o=4,(ord"1")}l+=1e,n=sin(1,2),cos((cos()))o,c=(cos((cos())))function i()return 1,2,ord"1",(ord"1")end while false do end repeat until true for l in(all{})do end print("test"..@16 .."str")?l+(({})[1]and({}).k or...or i())+3+-3 +?"sh1" ?"sh2" -print"sh3"print"sh4"i="renaming bug"function d()return i end?d() -a=0a=1function new_name(new_name,l)return new_name.new_member,l.new_member end function new_name(new_name2,l,e)return new_name2.new_member end function f(l,e,f,n,o,c)return l+e+f+n+o+c end?f(1,2,4,8,16,32) +print"sh3"print"sh4"d="renaming bug"function f()return d end?f() +a=0a=1function new_name(new_name,l)return new_name.new_member,l.new_member end function new_name(new_name2,l,e)return new_name2.new_member end function u(l,e,f,n,o,c)return l+e+f+n+o+c end?u(1,2,4,8,16,32) v=?"END!" diff --git a/test_compare/output.p8 b/test_compare/output.p8 index a53dde6..22215df 100644 --- a/test_compare/output.p8 +++ b/test_compare/output.p8 @@ -2,7 +2,7 @@ pico-8 cartridge // http://www.pico-8.com version 42 __lua__ print=printh?"hello ᶜ7there♥ら" -🐱,a,h,u,s,x,e,e=11,12,13,14,15,16,17,17t(stat(band()))-- this one comment, i do want! +🐱,h,u,s,x,k,e,e=11,12,13,14,15,16,17,17t(stat(band()))-- this one comment, i do want! t()c=0l=0l=0print"this is included"?"#[disable[[this for now/ever]]]" local e={1,2,3}print(#e)print(#[[#include notaninclude ]])local e,l="preserved_key",{preserved_key=123}?l[e] @@ -28,9 +28,10 @@ local e={1},{1,2,3,4}local e,l=1~=2,1,1.2345,4660,4660.33777,-1,-1.2345,-4660.33 function i(...)return 1.2 ..4 .. .....0end?i(3) ?1or 1or 2and 3==4>=4|5~6<<1>><1 ..2 ..3- -1^4^1/1&7 ?((~(((((((tonum(((3or 4)and 5)~=2)|1)~2)&3)>>1)..1)-(1+3))*3))^2)^1 -local e=({})[1],(function()end)()local l,n,o,e,f=sin(1,2),cos((cos())),(cos((cos()))),{d=ord,a=pal}local e=ord"123",pal{1,2},e:d("ord"),e:a({1,2}),sin(1)local i={ord"1",[2]=3,o=4,(ord"1")}e+=1l,n=sin(1,2),cos((cos()))o,f=(cos((cos())))function k()return 1,2,ord"1",(ord"1")end if 1==2then elseif 1==2then else end while 1==2do end repeat until 1==1for e in(all{})do end print("test"..@16 .."str")if(true)?"sh1" +local e=({})[1],(function()end)()local l,n,o,e,f=sin(1,2),cos((cos())),(cos((cos()))),{d=ord,a=pal}local e=ord"123",pal{1,2},e:d("ord"),e:a({1,2}),sin(1)local i={ord"1",[2]=3,o=4,(ord"1")}e+=1l,n=sin(1,2),cos((cos()))o,f=(cos((cos())))function r()return 1,2,ord"1",(ord"1")end if 1==2then elseif 1==2then else end while 1==2do end repeat until 1==1for e in(all{})do end print("test"..@16 .."str")?e+(({})[1]and({}).x or...or r())+3+-3 +if(true)?"sh1" if true then?"sh2" end if(true)if false then else print"sh3"end -if true then if false then else print"sh4"end end j="renaming bug"function r()local e,l,n,o,f,i,c,r,d,a,t,h,u,s,x,k,y,v,p,b,w,g,_,m,E,N,D return j end?r() -c=0c=1function new_name(new_name,e)return new_name.new_member,e.new_member end function new_name(new_name2,e,l)local e,l return new_name2.new_member end function d(l,e,f,n,o,i)return l+e+f+n+o+i end?d(1,2,4,8,16,32) +if true then if false then else print"sh4"end end j="renaming bug"function d()local e,l,n,o,f,i,c,r,d,a,t,h,u,s,x,k,y,v,p,b,w,g,_,m,E,N,D return j end?d() +c=0c=1function new_name(new_name,e)return new_name.new_member,e.new_member end function new_name(new_name2,e,l)local e,l return new_name2.new_member end function a(l,e,f,n,o,i)return l+e+f+n+o+i end?a(1,2,4,8,16,32) y=?"END!" diff --git a/test_compare/output.p8.printh b/test_compare/output.p8.printh index 84beb3f..72da2d9 100644 --- a/test_compare/output.p8.printh +++ b/test_compare/output.p8.printh @@ -17,6 +17,7 @@ this is included 1 55.8009 test0str +51 sh1 sh2 sh3 diff --git a/test_compare/output_min.p8 b/test_compare/output_min.p8 index e89013b..ba9cd4f 100644 --- a/test_compare/output_min.p8 +++ b/test_compare/output_min.p8 @@ -105,6 +105,7 @@ while 1==2do end repeat until 1==1 for a in(all{})do end print("test"..@16 .."str") +?calls3+(({})[1]and({}).🐱 or...or xxx())+3+-3 if(true)?"sh1" if true then?"sh2" end diff --git a/test_compare/output_minrename-ih.p8 b/test_compare/output_minrename-ih.p8 index b40c863..fb46a76 100644 --- a/test_compare/output_minrename-ih.p8 +++ b/test_compare/output_minrename-ih.p8 @@ -27,7 +27,8 @@ local e={1},{1,2,3,4}local e,n=1~=2,1,1.2345,4660,4660.33777,-1,-1.2345,-4660.33 function tokenhell(...)return 1.2 ..4 .. .....0end?tokenhell(3) ?1or 1or 2and 3==4>=4|5~6<<1>><1 ..2 ..3- -1^4^1/1&7 ?((~(((((((tonum(((3or 4)and 5)~=2)|1)~2)&3)>>1)..1)-(1+3))*3))^2)^1 -local e=({})[1],(function()end)()local n,o,f,e,i=sin(1,2),cos((cos())),(cos((cos()))),{ord=ord,pal=pal}local e=ord"123",pal{1,2},e:ord("ord"),e:pal({1,2}),sin(1)local c={ord"1",[2]=3,x=4,(ord"1")}e+=1n,o=sin(1,2),cos((cos()))f,i=(cos((cos())))function xxx()return 1,2,ord"1",(ord"1")end if 1==2then elseif 1==2then else end while 1==2do end repeat until 1==1for e in(all{})do end print("test"..@16 .."str")if(true)?"sh1" +local e=({})[1],(function()end)()local n,o,f,e,i=sin(1,2),cos((cos())),(cos((cos()))),{ord=ord,pal=pal}local e=ord"123",pal{1,2},e:ord("ord"),e:pal({1,2}),sin(1)local c={ord"1",[2]=3,x=4,(ord"1")}e+=1n,o=sin(1,2),cos((cos()))f,i=(cos((cos())))function xxx()return 1,2,ord"1",(ord"1")end if 1==2then elseif 1==2then else end while 1==2do end repeat until 1==1for e in(all{})do end print("test"..@16 .."str")?e+(({})[1]and({}).🐱 or...or xxx())+3+-3 +if(true)?"sh1" if true then?"sh2" end if(true)if false then else print"sh3"end if true then if false then else print"sh4"end end l="renaming bug"function fff()local e,n,o,f,i,c,r,d,a,t,h,u,s,x,k,y,v,p,b,w,g,_,m,E,N,D,j return l end?fff() diff --git a/test_compare/output_minrename-ob.p8 b/test_compare/output_minrename-ob.p8 index 2962697..145822a 100644 --- a/test_compare/output_minrename-ob.p8 +++ b/test_compare/output_minrename-ob.p8 @@ -22,7 +22,8 @@ local e={assert=assert,add=add}do local _ENV=e assert(add({},1)==1)end do local ]]]=]]===]]==]local n=-256,-256*4,65280^4,-65280,~65280if not e then e=-1end function tokenhell(...)return 1.2 ..4 .. .....0end?tokenhell(3) ?1or 1or 2and 3==4>=4|5~6<<1>><1 ..2 ..3- -1^4^1/1&7 ?((~(((((((tonum(((3or 4)and 5)~=2)|1)~2)&3)>>1)..1)-(1+3))*3))^2)^1 -local e=({})[1],(function()end)()local n,o,f,e,i=sin(1,2),cos((cos())),(cos((cos()))),{ord=ord,pal=pal}local e=ord"123",pal{1,2},e:ord("ord"),e:pal({1,2}),sin(1)local c={ord"1",[2]=3,x=4,(ord"1")}e+=1n,o=sin(1,2),cos((cos()))f,i=(cos((cos())))function xxx()return 1,2,ord"1",(ord"1")end if 1==2then elseif 1==2then else end while 1==2do end repeat until 1==1for e in(all{})do end print("test"..@16 .."str")if true then?"sh1" +local e=({})[1],(function()end)()local n,o,f,e,i=sin(1,2),cos((cos())),(cos((cos()))),{ord=ord,pal=pal}local e=ord"123",pal{1,2},e:ord("ord"),e:pal({1,2}),sin(1)local c={ord"1",[2]=3,x=4,(ord"1")}e+=1n,o=sin(1,2),cos((cos()))f,i=(cos((cos())))function xxx()return 1,2,ord"1",(ord"1")end if 1==2then elseif 1==2then else end while 1==2do end repeat until 1==1for e in(all{})do end print("test"..@16 .."str")?e+(({})[1]and({}).🐱 or...or xxx())+3+-3 +if true then?"sh1" end if true then?"sh2" end if true then if false then else print"sh3"end end if true then if false then else print"sh4"end end l="renaming bug"function fff()local e,n,o,f,i,c,r,d,a,t,h,u,s,x,k,y,v,p,b,w,g,_,m,j,q,z,ee return l end?fff() x=0 x=1function old_name(e,l)return e.old_member,l.old_member end function old_name(e,l,n)local l,n return e.old_member end function ggg(e,l,n,o,f,i)return e+l+n+o+f+i end?ggg(1,2,4,8,16,32) diff --git a/test_compare/output_minrename-oc.p8 b/test_compare/output_minrename-oc.p8 index b3eaf51..558b825 100644 --- a/test_compare/output_minrename-oc.p8 +++ b/test_compare/output_minrename-oc.p8 @@ -32,7 +32,8 @@ function tokenhell(...)return 1.2 ..4 .. .....0end?tokenhell(3) ?1or 1or 2and 3==4>=4|5~6<<1>><1 ..2 ..3- -1^4^1/1&7 ?((~(((((((tonum(((3or 4)and 5)~=2)|1)~2)&3)>>1)..1)-(1+3))*3))^2)^1 local e=({})[1],(function()end)()local n,o,f,e,i=sin(1,2),cos((cos())),(cos((cos()))),{ord=ord,pal=pal}local e=ord"123",pal{1,2},e:ord("ord"),e:pal({1,2}),sin(1)local c={ord"1",[2]=3,x=4,(ord"1")}e+=1n,o=sin(1,2),cos((cos()))f,i=(cos((cos())))function xxx()return 1,2,ord"1",(ord"1")end if 1==2then elseif 1==2then else end while(1==2); -repeat until 1==1for e in(all{})do end print("test"..@16 .."str")if(true)?"sh1" +repeat until 1==1for e in(all{})do end print("test"..@16 .."str")?e+(({})[1]and({}).🐱 or...or xxx())+3+-3 +if(true)?"sh1" if true then?"sh2" end if(true)if false then else print"sh3"end if true then if(false);else print"sh4" diff --git a/test_compare/output_minrename.p8 b/test_compare/output_minrename.p8 index 14e2abf..fba9b98 100644 --- a/test_compare/output_minrename.p8 +++ b/test_compare/output_minrename.p8 @@ -28,7 +28,8 @@ local e={1},{1,2,3,4}local e,n=1~=2,1,1.2345,4660,4660.33777,-1,-1.2345,-4660.33 function tokenhell(...)return 1.2 ..4 .. .....0end?tokenhell(3) ?1or 1or 2and 3==4>=4|5~6<<1>><1 ..2 ..3- -1^4^1/1&7 ?((~(((((((tonum(((3or 4)and 5)~=2)|1)~2)&3)>>1)..1)-(1+3))*3))^2)^1 -local e=({})[1],(function()end)()local n,o,f,e,i=sin(1,2),cos((cos())),(cos((cos()))),{ord=ord,pal=pal}local e=ord"123",pal{1,2},e:ord("ord"),e:pal({1,2}),sin(1)local c={ord"1",[2]=3,x=4,(ord"1")}e+=1n,o=sin(1,2),cos((cos()))f,i=(cos((cos())))function xxx()return 1,2,ord"1",(ord"1")end if 1==2then elseif 1==2then else end while 1==2do end repeat until 1==1for e in(all{})do end print("test"..@16 .."str")if(true)?"sh1" +local e=({})[1],(function()end)()local n,o,f,e,i=sin(1,2),cos((cos())),(cos((cos()))),{ord=ord,pal=pal}local e=ord"123",pal{1,2},e:ord("ord"),e:pal({1,2}),sin(1)local c={ord"1",[2]=3,x=4,(ord"1")}e+=1n,o=sin(1,2),cos((cos()))f,i=(cos((cos())))function xxx()return 1,2,ord"1",(ord"1")end if 1==2then elseif 1==2then else end while 1==2do end repeat until 1==1for e in(all{})do end print("test"..@16 .."str")?e+(({})[1]and({}).🐱 or...or xxx())+3+-3 +if(true)?"sh1" if true then?"sh2" end if(true)if false then else print"sh3"end if true then if false then else print"sh4"end end l="renaming bug"function fff()local e,n,o,f,i,c,r,d,a,t,h,u,s,x,k,y,v,p,b,w,g,_,m,E,N,D,j return l end?fff() diff --git a/test_compare/output_semiob.p8 b/test_compare/output_semiob.p8 index be548fc..ef4d49a 100644 --- a/test_compare/output_semiob.p8 +++ b/test_compare/output_semiob.p8 @@ -3,7 +3,7 @@ version 42 __lua__ print=printh ?"hello ᶜ7there♥ら" -🐱,a,h,u,s,x,e,e=11,12,13,14,15,16,17,17 +🐱,h,u,s,x,k,e,e=11,12,13,14,15,16,17,17 t(stat(band())) @@ -120,12 +120,13 @@ local i = {ord"1",[2]=3,x=4,(ord"1")} e += 1 l, n = sin(1,2), cos((cos())) o, f = (cos((cos()))) -function k() return 1, 2, ord"1", (ord"1") end +function r() return 1, 2, ord"1", (ord"1") end if 1 == 2 then elseif 1 == 2 then else end while 1 == 2 do end repeat until 1 == 1 for e in (all{}) do end print("test"..@16 .."str") +?e+(({})[1] and ({}).🐱 or ... or r())+3+-3 if(true) ?"sh1" if true then ?"sh2" @@ -134,11 +135,11 @@ if(true) if false then else print"sh3" end if true then if false then else print"sh4" end end j="renaming bug" -function r() +function d() local e,l,n,o,f,i,c,r,d,a,t,h,u,s,x,k,y,v,p,b,w,g,_,m,E,N,D return j end -?r() +?d() c=0c=1 function new_name(new_name, e) @@ -148,9 +149,9 @@ function new_name( new_name2, e, l) local e, l return new_name2. new_member end -function d( l, e, f, n, o, i) +function a( l, e, f, n, o, i) return l+e+f+n+o+i end -?d(1,2,4,8,16,32) +?a(1,2,4,8,16,32) y=?"END!" diff --git a/test_compare/output_tokens.p8 b/test_compare/output_tokens.p8 index b3e0090..ec1dadb 100644 --- a/test_compare/output_tokens.p8 +++ b/test_compare/output_tokens.p8 @@ -144,6 +144,7 @@ while 1 == 2 do end repeat until 1 == 1 for a in (all{}) do end print("test"..@16 .."str") +?calls3+(({})[1] and ({}).🐱 or ... or xxx())+3+-3 -- shorthands if(true) ?"sh1" diff --git a/test_compare/repl-com.png b/test_compare/repl-com.png index 467e0ea..50924ec 100644 Binary files a/test_compare/repl-com.png and b/test_compare/repl-com.png differ diff --git a/test_compare/repl-ob.p8 b/test_compare/repl-ob.p8 index 34d61e1..1593dcb 100644 --- a/test_compare/repl-ob.p8 +++ b/test_compare/repl-ob.p8 @@ -6,7 +6,7 @@ __lua__ -- for the original commented source code -- (The below had the comments stripped due to cart size limits) -------------------------------------- -local e,n,l=_ENV,{},{}for e,t in pairs(_ENV)do n[e]=t if type(t)=="function"then l[e]=true end end local _ENV=n nc,nk=true function p(t,e)for n=1,#e do if sub(e,n,n)==t then return n end end end function b(e,n)return sub(e,n,n)end local n,t,o=split"a,b,f,n,r,t,v,\\,\",',\n,*,#,-,|,+,^",split"⁷,⁸,ᶜ,\n,\r, ,ᵇ,\\,\",',\n,¹,²,³,⁴,⁵,⁶",{}for e=1,#n do o[n[e]]=t[e]end function y(n)return n>="0"and n<="9"end function nl(n)return n>="A"and n<="Z"or n>="a"and n<="z"or n=="_"or n>="█"or y(n)end function en(l,n,i,r)local e=""while n<=#l do local t=b(l,n)if t==i then break end if t=="\\"then n+=1local e=b(l,n)t=o[e]if e=="x"then e=tonum("0x"..sub(l,n+1,n+2))if e then n+=2else r"bad hex escape"end t=chr(e)elseif y(e)then local o=n while y(e)and n=256then r"bad decimal escape"end t=chr(e)elseif e=="z"then repeat n+=1e=b(l,n)until not p(e," \r ᶜᵇ\n")if e==""then r()end t=""n-=1elseif e==""then r()t=""end if not t then r("bad escape: "..e)t=""end elseif t=="\n"then r"unterminated string"break end e..=t n+=1end if n>#l then r("unterminated string",true)end return e,n+1end function nn(e,n,t,l)if b(e,n)=="["then n+=1local l=n while b(e,n)=="="do n+=1end local l="]"..sub(e,l,n-1).."]"local r=#l if b(e,n)=="["then n+=1if b(e,n)=="\n"then n+=1end local o=n while n<=#e and sub(e,n,n+r-1)~=l do n+=1end if n>=#e then t()end return sub(e,o,n-1),n+r end end if l then t"invalid long brackets"end return nil,n end function n4(t,u)local n,a,r,c,s,h,f,o=1,1,{},{},{},{}local function i(n,e)if u then n9(n,o)end f=n and not e end while n<=#t do o=n local e,d,l=b(t,n)if p(e," \r ᶜᵇ\n")then n+=1d=true if e=="\n"then a+=1end elseif e=="-"and b(t,n+1)=="-"then n+=2if b(t,n)=="["then l,n=nn(t,n,i)end if not l then while n<=#t and b(t,n)~="\n"do n+=1end end if u then d=true else add(r,true)end elseif y(e)or e=="."and y(b(t,n+1))then local f,d="0123456789",true if e=="0"and p(b(t,n+1),"xX")then f..="AaBbCcDdEeFf"n+=2elseif e=="0"and p(b(t,n+1),"bB")then f="01"n+=2end while true do e=b(t,n)if e=="."and d then d=false elseif not p(e,f)then break end n+=1end l=sub(t,o,n-1)if not tonum(l)then i"bad number"l="0"end add(r,tonum(l))elseif nl(e)then while nl(b(t,n))do n+=1end add(r,sub(t,o,n-1))elseif e=="'"or e=='"'then l,n=en(t,n+1,e,i)add(r,{t=l})elseif e=="["and p(b(t,n+1),"=[")then l,n=nn(t,n,i,true)add(r,{t=l})else n+=1local l,f,d=unpack(split(sub(t,n,n+2),""))if l==e and f==e and p(e,".>")then n+=2if d=="="and p(e,">")then n+=1end elseif l==e and f~=e and p(e,"<>")and p(f,"<>")then n+=2if d=="="then n+=1end elseif l==e and p(e,".:^<>")then n+=1if f=="="and p(e,".^<>")then n+=1end elseif l=="="and p(e,"+-*/\\%^&|<>=~!")then n+=1elseif p(e,"+-*/\\%^&|<>=~#(){}[];,?@$.:")then else i("bad char: "..e)end add(r,sub(t,o,n-1))end if not d then add(c,a)add(s,o)add(h,n-1)end if f then r[#r],f=false,false end end return r,c,s,h end function nf(t,n)for e=1,#n do if n[e]==t then return e end end end function nu(n)return unpack(n,1,n.n)end function ee(e)local n={}for e,t in next,e do n[e]=t end return n end local n=split"and,break,do,else,elseif,end,false,for,function,goto,if,in,local,nil,not,or,repeat,return,then,true,until,while"ns={}for n in all(n)do ns[n]=true end local function nn(n)return type(n)=="string"and b(n,#n)=="="end nv=split"end,else,elseif,until"function ny(n,ne)local r,q,t=n4(n,true)local n,i,u,x,f,s,h,e,c,m,a,v=1,0,0,{}local function o(e)n9(e,t[n-1]or 1)end local function p(n)return function()return n end end local function _(e)local n=f[e]if n then return function(t)return t[n][e]end else n=f._ENV return function(t)return t[n]._ENV[e]end end end local function nt()local n=f["..."]if not n or n~=v then o"unexpected '...'"end return function(e)return nu(e[n]["..."])end end local function z(e)local n=f[e]if n then return function(t)return t[n],e end else n=f._ENV return function(t)return t[n]._ENV,e end end end local function t(e)local t=r[n]n+=1if t==e then return end if t==nil then o()end o("expected: "..e)end local function d(e)if not e then e=r[n]n+=1end if e==nil then o()end if type(e)=="string"and nl(b(e,1))and not ns[e]then return e end if type(e)=="string"then o("invalid identifier: "..e)end o"identifier expected"end local function l(e)if r[n]==e then n+=1return true end end local function g()f=setmetatable({},{__index=f})i+=1end local function k()f=getmetatable(f).__index i-=1end local function b(l,t)local e,n={},#t for n=1,n-1do e[n]=t[n](l)end if n>0then local t=pack(t[n](l))if t.n~=1then for l=1,t.n do e[n+l-1]=t[l]end n+=t.n-1else e[n]=t[1]end end e.n=n return e end local function w(e)local n={}add(n,(e()))while l","do add(n,(e()))end return n end local function y(r,o,i)local n={}if i then add(n,i)elseif not l")"then while true do add(n,(e()))if l")"then break end t","end end if o then return function(e)local t=r(e)return t[o](t,nu(b(e,n)))end,true,nil,function(e)local t=r(e)return t[o],pack(t,nu(b(e,n)))end else return function(e)return r(e)(nu(b(e,n)))end,true,nil,function(e)return r(e),b(e,n)end end end local function nl()local o,u,c,a={},{},1while not l"}"do a=nil local i,f if l"["then i=e()t"]"t"="f=e()elseif r[n+1]=="="then i=p(d())t"="f=e()else i=p(c)f=e()c+=1a=#o+1end add(o,i)add(u,f)if l"}"then break end if not l";"then t","end end return function(e)local t={}for n=1,#o do if n==a then local l,n=o[n](e),pack(u[n](e))for e=1,n.n do t[l+e-1]=n[e]end else t[o[n](e)]=u[n](e)end end return t end end local function j(s,h)local n,b,e if s then if h then g()n=d()f[n]=i e=z(n)else n={d()}while l"."do add(n,d())end if l":"then add(n,d())b=true end if#n==1then e=z(n[1])else local t=_(n[1])for e=2,#n-1do local l=t t=function(t)return l(t)[n[e]]end end e=function(e)return t(e),n[#n]end end end end local n,r={}if b then add(n,"self")end t"("if not l")"then while true do if l"..."then r=true else add(n,d())end if l")"then break end t","if r then o"unexpected param after '...'"end end end g()for n in all(n)do f[n]=i end if r then f["..."]=i end local l,o,f=x,a,v x,a,v={},u+1,i local i=c()for n in all(x)do n()end x,a,v=l,o,f t"end"k()return function(t)if h then add(t,{})end local l=ee(t)local o=#l local n=function(...)local t,e=pack(...),l if#e~=o then local n={}for t=0,o do n[t]=e[t]end e=n end local l={}for e=1,#n do l[n[e]]=t[e]end if r then l["..."]=pack(unpack(t,#n+1,t.n))end add(e,l)local n=i(e)deli(e)if n then if type(n)=="table"then return nu(n)end return n()end end if s then local e,t=e(t)e[t]=n else return n end end end local function v()local l=r[n]n+=1local n if l==nil then o()end if l=="nil"then return p()end if l=="true"then return p(true)end if l=="false"then return p(false)end if type(l)=="number"then return p(l)end if type(l)=="table"then return p(l.t)end if l=="{"then return nl()end if l=="("then n=e()t")"return function(e)return(n(e))end,true end if l=="-"then n=e(11)return function(e)return-n(e)end end if l=="~"then n=e(11)return function(e)return~n(e)end end if l=="not"then n=e(11)return function(e)return not n(e)end end if l=="#"then n=e(11)return function(e)return#n(e)end end if l=="@"then n=e(11)return function(e)return@n(e)end end if l=="%"then n=e(11)return function(e)return%n(e)end end if l=="$"then n=e(11)return function(e)return$n(e)end end if l=="function"then return j()end if l=="..."then return nt()end if l=="\\"then n=d()return function()return et(n)end,true,function()return el(n)end end if d(l)then return _(l),true,z(l)end o("unexpected token: "..l)end local function z(e,t,l,r)local n if e=="^"and t<=12then n=r(12)return function(e)return l(e)^n(e)end end if e=="*"and t<10then n=r(10)return function(e)return l(e)*n(e)end end if e=="/"and t<10then n=r(10)return function(e)return l(e)/n(e)end end if e=="\\"and t<10then n=r(10)return function(e)return l(e)\n(e)end end if e=="%"and t<10then n=r(10)return function(e)return l(e)%n(e)end end if e=="+"and t<9then n=r(9)return function(e)return l(e)+n(e)end end if e=="-"and t<9then n=r(9)return function(e)return l(e)-n(e)end end if e==".."and t<=8then n=r(8)return function(e)return l(e)..n(e)end end if e=="<<"and t<7then n=r(7)return function(e)return l(e)<>"and t<7then n=r(7)return function(e)return l(e)>>n(e)end end if e==">>>"and t<7then n=r(7)return function(e)return l(e)>>>n(e)end end if e=="<<>"and t<7then n=r(7)return function(e)return l(e)<<>n(e)end end if e==">><"and t<7then n=r(7)return function(e)return l(e)>>"and t<3then n=r(3)return function(e)return l(e)>n(e)end end if e=="<="and t<3then n=r(3)return function(e)return l(e)<=n(e)end end if e==">="and t<3then n=r(3)return function(e)return l(e)>=n(e)end end if e=="=="and t<3then n=r(3)return function(e)return l(e)==n(e)end end if(e=="~="or e=="!=")and t<3then n=r(3)return function(e)return l(e)~=n(e)end end if e=="and"and t<2then n=r(2)return function(e)return l(e)and n(e)end end if e=="or"and t<1then n=r(1)return function(e)return l(e)or n(e)end end end local function nt(u,l,a)local i=r[n]n+=1local o,f if a then if i=="."then o=d()return function(n)return l(n)[o]end,true,function(n)return l(n),o end end if i=="["then o=e()t"]"return function(n)return l(n)[o(n)]end,true,function(n)return l(n),o(n)end end if i=="("then return y(l)end if i=="{"or type(i)=="table"then n-=1f=v()return y(l,nil,f)end if i==":"then o=d()if r[n]=="{"or type(r[n])=="table"then f=v()return y(l,o,f)end t"("return y(l,o)end end local e=z(i,u,l,e)if not e then n-=1end return e end e=function(r)local n,e,t,l=v()while true do local r,o,i,f=nt(r or 0,n,e)if not r then break end n,e,t,l=r,o,i,f end return n,t,l end local function v()local e,n=e()if not n then o"cannot assign to value"end return n end local function nt()local n=w(v)t"="local e=w(e)if#n==1and#e==1then return function(t)local n,l=n[1](t)n[l]=e[1](t)end else return function(t)local l,r={},{}for e=1,#n do local n,e=n[e](t)add(l,n)add(r,e)end local e=b(t,e)for n=#n,1,-1do l[n][r[n]]=e[n]end end end end local function nl(t,l)local r=r[n]n+=1local n=sub(r,1,-2)local n=z(n,0,t,function()return e()end)if not n then o"invalid compound assignment"end return function(e)local t,l=l(e)t[l]=n(e)end end local function nr()if l"function"then return j(true,true)else local n,e=w(d),l"="and w(e)or{}g()for e=1,#n do f[n[e]]=i end if#n==1and#e==1then return function(t)add(t,{[n[1]]=e[1](t)})end else return function(t)local l,r={},b(t,e)for e=1,#n do l[n[e]]=r[e]end add(t,l)end end end end local function z(e)local t=q[n-1]h=function()return t~=q[n]end if not e or h()then o(n<=#r and"bad shorthand"or nil)end end local function q()local r,o,e,n=r[n]=="(",e()if l"then"then e,n=c()if l"else"then n=c()t"end"elseif l"elseif"then n=q()else t"end"end else z(r)e=c()if not h()and l"else"then n=c()end h=nil end return function(t)if o(t)then return e(t)elseif n then return n(t)end end end local function v(...)local n=m m=u+1local e=c(...)m=n return e end local function y(n,e)if n==true then return end return n,e end local function no()local r,o,n=r[n]=="(",e()if l"do"then n=v()t"end"else z(r)n=v()h=nil end return function(e)while o(e)do if stat(1)>=1then na()end local n,e=n(e)if n then return y(n,e)end end end end local function z()local l,r=i,v(true)t"until"local o=e()while i>l do k()end return function(n)repeat if stat(1)>=1then na()end local e,t=r(n)if not e then t=o(n)end while#n>l do deli(n)end if e then return y(e,t)end until t end end local function ni()if r[n+1]=="="then local r=d()t"="local o=e()t","local d,e=e(),l","and e()or p(1)t"do"g()f[r]=i local l=v()t"end"k()return function(n)for e=o(n),d(n),e(n)do if stat(1)>=1then na()end add(n,{[r]=e})local e,t=l(n)deli(n)if e then return y(e,t)end end end else local l=w(d)t"in"local e=w(e)t"do"g()for n in all(l)do f[n]=i end local o=v()t"end"k()return function(n)local e=b(n,e)while true do local r,t={},{e[1](e[2],e[3])}if t[1]==nil then break end e[3]=t[1]for n=1,#l do r[l[n]]=t[n]end if stat(1)>=1then na()end add(n,r)local e,t=o(n)deli(n)if e then return y(e,t)end end end end end local function p()if not m or a and m=1then na()end return function()return n(nu(e))end end else return function(e)return b(e,n)end end end end local function g(e)local n=d()t"::"if s[n]and s[n].e==u then o"label already defined"end s[n]={l=i,e=u,o=e,r=#e}end local function v()local t,e,l,n=d(),s,i add(x,function()n=e[t]if not n then o"label not found"end if a and n.ee and n.r<#n.o then o"goto past local"end end)return function()if stat(1)>=1then na()end return 0,n end end local function d(f)local i=r[n]n+=1if i==";"then return end if i=="do"then local n=c()t"end"return n end if i=="if"then return q()end if i=="while"then return no()end if i=="repeat"then return z()end if i=="for"then return ni()end if i=="break"then return p()end if i=="return"then return m(),true end if i=="local"then return nr()end if i=="goto"then return v()end if i=="::"then return g(f)end if i=="function"and r[n]~="("then return j(true)end if i=="?"then local e,t=_"print",w(e)return function(n)e(n)(nu(b(n,t)))end end n-=1local i,e,f,t=n,e()if l","or l"="then n=i return nt()elseif nn(r[n])then return nl(e,f)elseif u<=1and nc then return function(n)local n=pack(e(n))if not(t and n.n==0)then add(nd,n)end nk=n[1]end else if not t then o"statement has no effect"end return function(n)e(n)end end end c=function(e)s=setmetatable({},{__index=s})s[u]=i u+=1local a,f,o=u,e and 32767or i,{}while n<=#r and not nf(r[n],nv)and not(h and h())do local n,e=d(o)if n then add(o,n)end if e then l";"break end end while i>f do k()end u-=1s=getmetatable(s).__index return function(e)local l,r,t,n=1,#o while l<=r do t,n=o[l](e)if t then if type(t)~="number"then break end if n.e~=a then break end l=n.r while#e>n.l do deli(e)end t,n=nil end l+=1end while#e>f do deli(e)end return t,n end end f=nc and{_ENV=0,_env=0,_=0}or{_ENV=0}local e=c()if n<=#r then o"unexpected end"end for n in all(x)do n()end return function(n)local n=nc and{_ENV=n,_env=n,_=nk}or{_ENV=n}local n=e{[0]=n}if n then return nu(n)end end end np,nw=10,false local t={["\0"]="000",["ᵉ"]="014",["ᶠ"]="015"}for n,e in pairs(o)do if not p(n,"'\n")then t[e]=n end end function er(n)local e=1while e<=#n do local l=b(n,e)local t=t[l]if t then n=sub(n,1,e-1).."\\"..t..sub(n,e+1)e+=#t end e+=1end return'"'..n..'"'end function eo(n)if type(n)~="string"then return false end if ns[n]then return false end if#n==0or y(b(n,1))then return false end for e=1,#n do if not nl(b(n,e))then return false end end return true end function f(e,t)local n=type(e)if n=="nil"then return"nil"elseif n=="boolean"then return e and"true"or"false"elseif n=="number"then return tostr(e,nw)elseif n=="string"then return er(e)elseif n=="table"and not t then local n,t,r="{",0,0for e,l in next,e do if t==np then n=n..",<...>"break end if t>0then n=n..","end local l=f(l,1)if e==r+1then n=n..l r=e elseif eo(e)then n=n..e.."="..l else n=n.."["..f(e,1).."]="..l end t+=1end return n.."}"else return"<"..tostr(n)..">"end end function ei(n,e)if e==nil then return n end if not n then n=""end local t=min(21,#e)for t=1,t do if#n>0then n..="\n"end local t=e[t]if type(t)=="table"then local e=""for n=1,t.n do if#e>0then e=e..", "end e=e..f(t[n])end n..=e else n..=t end end local l={}for n=t+1,#e do l[n-t]=e[n]end return n,l end poke(24365,1)cls()h="> "a,x,_="",1,0c,z=1,20w,j={""},1ne=false m,u=0,1nh,n0=true,true s={7,4,3,5,6,8,5,12,14,7,11,5}e.print=function(n,...)if pack(...).n~=0or not nh then return print(n,...)end add(nd,tostr(n))end function n_()poke(24368,1)end function nz()return function()if stat(30)then return stat(31)end end end function nx(l,r)local e,n,t=1,0,0if not l then return e,n,t end while e<=#l do local l=b(l,e)local o=l>="█"if n>=(o and 31or 32)then t+=1n=0end if r then r(e,l,n,t)end if l=="\n"then t+=1n=0else n+=o and 2or 1end e+=1end return e,n,t end function nt(t,l)local n,e=0,0local o,r,t=nx(t,function(t,i,r,o)if l==t then n,e=r,o end end)if l>=o then n,e=r,t end if r>0then t+=1end return n,e,t end function nr(l,r,e)local t,n=1,false local r,o,l=nx(l,function(o,f,i,l)if e==l and r==i and not n then t=o n=true end if(e=l and r or r-1end if o>0then l+=1end return t,l end function n6(n,t,l,e)if type(e)=="function"then nx(n,function(n,r,o,i)print(r,t+o*4,l+i*6,e(n))end)else print(n and"⁶rw"..n,t,l,e)end end function ef(n,r,o)local i,e,f,t=n4(n)local e=1n6(n,r,o,function(r)while e<=#t and t[e]e then u-=1end rectfill(0,u*6,127,(u+1)*6-1,0)end end local function d(n,e)for t=0,2do local l=pget(n+t,e+5)pset(n+t,e+5,l==0and s[12]or 0)end end local function l(r)local l=h..a.." "local o,t,e=nt(l,#h+c)if e>x then n(e-x)elseif e=21then _-=1goto n end local n=n*6rectfill(0,n,127,n+x*6-1,0)if x>21then rectfill(0,126,127,127,0)end ef(l,0,n)print(h,0,n,s[4])if z>=10and r~=false and not v then d(o*4,n+t*6)end end local function f(e)n(1)u-=1print("[enter] ('esc' to abort)",0,u*6,s[3])while true do flip()n_()for n in nz()do if n=="•"then ne=true g=""nd={}return false end if n=="\r"or n=="\n"then m+=e return true end end end end::n::local t,e if nd or g then t,e=nr(g,0,m)if e-m<=20and nd then g,nd=ei(g,nd)t,e=nr(g,0,m)if#nd==0and not v then nd=nil end end end if not v then camera()end if m==0and not v then l(not g)end if g then local r,t=sub(g,t),min(e-m,20)n(t)n6(r,0,(u-t)*6,s[1])if t0or stat(n,...)elseif n==31then if#ni>0then return deli(ni,1)else local n=stat(n,...)if n=="•"then ne=true end return n end else return stat(n,...)end end function ec(n)if _set_fps then _set_fps(n._update60 and 60or 30)end if n._init then n._init()end d=true while true do if _update_buttons then _update_buttons()end if holdframe then holdframe()end if n._update60 then n._update60()elseif n._update then n._update()end if n._draw then n._draw()end flip()no=true na()end d=false end function et(n)if nf(n,{"i","interrupt"})then return nh elseif nf(n,{"f","flip"})then return n0 elseif nf(n,{"r","repl"})then return nc elseif nf(n,{"mi","max_items"})then return np elseif nf(n,{"h","hex"})then return nw elseif nf(n,{"cl","colors"})then return s elseif nf(n,{"c","code"})then local n={[0]=a}for e=1,#w-1do n[e]=w[#w-e]end return n elseif nf(n,{"cm","compile"})then return function(n)return eu(n)end elseif nf(n,{"x","exec"})then return function(n,e)nm(n,e)end elseif nf(n,{"v","eval"})then return function(n,e)return n7(n,e)end elseif nf(n,{"p","print"})then return function(n,...)e.print(f(n),...)end elseif nf(n,{"ts","tostr"})then return function(n)return f(n)end elseif nf(n,{"rst","reset"})then run()elseif nf(n,{"run"})then ec(e)else assert(false,"unknown \\-command")end end function el(e)local function t(n)return n and n~=0and true or false end local n if nf(e,{"i","interrupt"})then n=function(n)nh=t(n)end elseif nf(e,{"f","flip"})then n=function(n)n0=t(n)end elseif nf(e,{"r","repl"})then n=function(n)nc=t(n)end elseif nf(e,{"mi","max_items"})then n=function(n)np=tonum(n)or-1end elseif nf(e,{"h","hex"})then n=function(n)nw=t(n)end elseif nf(e,{"cl","colors"})then n=function(n)s=n end else assert(false,"unknown \\-command assign")end local n={__newindex=function(t,l,e)n(e)end}return setmetatable(n,n),0end nb=stat(4)n1,n3=0,false poke(24412,10,2)function k(n)if stat(28,n)then if n~=ng then ng,n1=n,0end return n1==0or n1>=10and n1%2==0elseif ng==n then ng=nil end end function _update()local e=false local function t(t)local e,n,l=nt(h..a,#h+c)if n8 then e=n8 end n+=t if not(n>=0and n0and 100or 0c=max(nr(h..a,n,l)-#h,1)e=true end local function f(n)w[j]=a j+=n a=w[j]if n<0then c=#a+1else c=max(nr(h..a,32,0)-#h,1)local n=b(a,c)if n~=""and n~="\n"then c-=1end end e=true end local function i()if#a>0then if#w>50then del(w,w[1])end w[#w]=a add(w,"")j=#w e=true end end local function d(n)if c+n>0then a=sub(a,1,c+n-1)..sub(a,c+n+1)c+=n e=true end end local function l(n)a=sub(a,1,c-1)..n..sub(a,c)c+=#n e=true end local r,u,n=stat(28,224)or stat(28,228),stat(28,225)or stat(28,229),-1if k(80)then if c>1then c-=1e=true end elseif k(79)then if c<=#a then c+=1e=true end elseif k(82)then if(r or not t(-1))and j>1then f(-1)end elseif k(81)then if(r or not t(1))and j<#w then f(1)end else local t=stat(31)n=ord(t)if t=="•"then if#a==0then extcmd"pause"else nd,n2={}i()end elseif t=="\r"or t=="\n"then if u then l"\n"else nj(a)if not nd then l"\n"else i()end end elseif r and k(40)then nj(a,true)i()elseif t~=""and n>=32and n<154then if n3 and n>=128then t=chr(n-63)end l(t)elseif n==193then l"\n"elseif n==192then o(-1)elseif n==196then o(1)elseif n==203then n3=not n3 q,n5="shift now selects "..(n3 and"punycase"or"symbols"),40elseif k(74)then if r then c=1e=true else o(-1)end elseif k(77)then if r then c=#a+1e=true else o(1)end elseif k(42)then d(-1)elseif k(76)then d(0)end end local t=stat(4)if t~=nb or n==213then l(t)nb=t end if n==194or n==215then if a~=""and a~=nb then nb=a printh(a,"@clip")if n==215then a=""c=1end q="press again to put in clipboard"else q=""end end if stat(120)then local n repeat n=serial(2048,24448,128)l(chr(peek(24448,n)))until n==0end if e then z,n8=20end n1+=1n_()end function nq(n,e)local e,t=coresume(cocreate(e))if not e then printh("error #"..n..": "..t)print("error #"..n.."\npico8 broke something again,\nthis cart may not work.\npress any button to ignore")while btnp()==0do flip()end cls()end end nq(1,function()assert(pack(n7"(function (...) return ... end)(1,2,nil,nil)").n==4)end)nq(2,function()assert(n7"function() local temp, temp2 = {max(1,3)}, -20;return temp[1] + temp2; end"()==-17)end)printh"finished"stop()while true do if holdframe then holdframe()end _update()_draw()flip()end +local e,n,l=_ENV,{},{}for e,t in pairs(_ENV)do n[e]=t if type(t)=="function"then l[e]=true end end local _ENV=n nc,nk=true function p(t,e)for n=1,#e do if sub(e,n,n)==t then return n end end end function b(e,n)return sub(e,n,n)end local n,t,o=split"a,b,f,n,r,t,v,\\,\",',\n,*,#,-,|,+,^",split"⁷,⁸,ᶜ,\n,\r, ,ᵇ,\\,\",',\n,¹,²,³,⁴,⁵,⁶",{}for e=1,#n do o[n[e]]=t[e]end function y(n)return n>="0"and n<="9"end function nl(n)return n>="A"and n<="Z"or n>="a"and n<="z"or n=="_"or n>="█"or y(n)end function en(l,n,i,r)local e=""while n<=#l do local t=b(l,n)if t==i then break end if t=="\\"then n+=1local e=b(l,n)t=o[e]if e=="x"then e=tonum("0x"..sub(l,n+1,n+2))if e then n+=2else r"bad hex escape"end t=chr(e)elseif y(e)then local o=n while y(e)and n=256then r"bad decimal escape"end t=chr(e)elseif e=="z"then repeat n+=1e=b(l,n)until not p(e," \r ᶜᵇ\n")if e==""then r()end t=""n-=1elseif e==""then r()t=""end if not t then r("bad escape: "..e)t=""end elseif t=="\n"then r"unterminated string"break end e..=t n+=1end if n>#l then r("unterminated string",true)end return e,n+1end function nn(e,n,t,l)if b(e,n)=="["then n+=1local l=n while b(e,n)=="="do n+=1end local l="]"..sub(e,l,n-1).."]"local r=#l if b(e,n)=="["then n+=1if b(e,n)=="\n"then n+=1end local o=n while n<=#e and sub(e,n,n+r-1)~=l do n+=1end if n>=#e then t()end return sub(e,o,n-1),n+r end end if l then t"invalid long brackets"end return nil,n end function n4(t,u)local n,a,r,c,s,h,f,o=1,1,{},{},{},{}local function i(n,e)if u then n9(n,o)end f=n and not e end while n<=#t do o=n local e,d,l=b(t,n)if p(e," \r ᶜᵇ\n")then n+=1d=true if e=="\n"then a+=1end elseif e=="-"and b(t,n+1)=="-"then n+=2if b(t,n)=="["then l,n=nn(t,n,i)end if not l then while n<=#t and b(t,n)~="\n"do n+=1end end if u then d=true else add(r,true)end elseif y(e)or e=="."and y(b(t,n+1))then local f,d="0123456789",true if e=="0"and p(b(t,n+1),"xX")then f..="AaBbCcDdEeFf"n+=2elseif e=="0"and p(b(t,n+1),"bB")then f="01"n+=2end while true do e=b(t,n)if e=="."and d then d=false elseif not p(e,f)then break end n+=1end l=sub(t,o,n-1)if not tonum(l)then i"bad number"l="0"end add(r,tonum(l))elseif nl(e)then while nl(b(t,n))do n+=1end add(r,sub(t,o,n-1))elseif e=="'"or e=='"'then l,n=en(t,n+1,e,i)add(r,{t=l})elseif e=="["and p(b(t,n+1),"=[")then l,n=nn(t,n,i,true)add(r,{t=l})else n+=1local l,f,d=unpack(split(sub(t,n,n+2),""))if l==e and f==e and p(e,".>")then n+=2if d=="="and p(e,">")then n+=1end elseif l==e and f~=e and p(e,"<>")and p(f,"<>")then n+=2if d=="="then n+=1end elseif l==e and p(e,".:^<>")then n+=1if f=="="and p(e,".^<>")then n+=1end elseif l=="="and p(e,"+-*/\\%^&|<>=~!")then n+=1elseif p(e,"+-*/\\%^&|<>=~#(){}[];,?@$.:")then else i("bad char: "..e)end add(r,sub(t,o,n-1))end if not d then add(c,a)add(s,o)add(h,n-1)end if f then r[#r],f=false,false end end return r,c,s,h end function nf(t,n)for e=1,#n do if n[e]==t then return e end end end function nu(n)return unpack(n,1,n.n)end function ee(e)local n={}for e,t in next,e do n[e]=t end return n end local n=split"and,break,do,else,elseif,end,false,for,function,goto,if,in,local,nil,not,or,repeat,return,then,true,until,while"ns={}for n in all(n)do ns[n]=true end local function nn(n)return type(n)=="string"and b(n,#n)=="="end nv=split"end,else,elseif,until"function ny(n,ne)local r,q,t=n4(n,true)local n,i,u,x,f,s,h,e,c,m,a,v=1,0,0,{}local function o(e)n9(e,t[n-1]or 1)end local function p(n)return function()return n end end local function _(e)local n=f[e]if n then return function(t)return t[n][e]end else n=f._ENV return function(t)return t[n]._ENV[e]end end end local function nt()local n=f["..."]if not n or n~=v then o"unexpected '...'"end return function(e)return nu(e[n]["..."])end end local function z(e)local n=f[e]if n then return function(t)return t[n],e end else n=f._ENV return function(t)return t[n]._ENV,e end end end local function t(e)local t=r[n]n+=1if t==e then return end if t==nil then o()end o("expected: "..e)end local function d(e)if not e then e=r[n]n+=1end if e==nil then o()end if type(e)=="string"and nl(b(e,1))and not ns[e]then return e end if type(e)=="string"then o("invalid identifier: "..e)end o"identifier expected"end local function l(e)if r[n]==e then n+=1return true end end local function g()f=setmetatable({},{__index=f})i+=1end local function k()f=getmetatable(f).__index i-=1end local function b(l,t)local e,n={},#t for n=1,n-1do e[n]=t[n](l)end if n>0then local t=pack(t[n](l))if t.n~=1then for l=1,t.n do e[n+l-1]=t[l]end n+=t.n-1else e[n]=t[1]end end e.n=n return e end local function w(e)local n={}add(n,(e()))while l","do add(n,(e()))end return n end local function y(r,o,i)local n={}if i then add(n,i)elseif not l")"then while true do add(n,(e()))if l")"then break end t","end end if o then return function(e)local t=r(e)return t[o](t,nu(b(e,n)))end,true,nil,function(e)local t=r(e)return t[o],pack(t,nu(b(e,n)))end else return function(e)return r(e)(nu(b(e,n)))end,true,nil,function(e)return r(e),b(e,n)end end end local function nl()local o,u,c,a={},{},1while not l"}"do a=nil local i,f if l"["then i=e()t"]"t"="f=e()elseif r[n+1]=="="then i=p(d())t"="f=e()else i=p(c)f=e()c+=1a=#o+1end add(o,i)add(u,f)if l"}"then break end if not l";"then t","end end return function(e)local t={}for n=1,#o do if n==a then local l,n=o[n](e),pack(u[n](e))for e=1,n.n do t[l+e-1]=n[e]end else t[o[n](e)]=u[n](e)end end return t end end local function j(s,h)local n,b,e if s then if h then g()n=d()f[n]=i e=z(n)else n={d()}while l"."do add(n,d())end if l":"then add(n,d())b=true end if#n==1then e=z(n[1])else local t=_(n[1])for e=2,#n-1do local l=t t=function(t)return l(t)[n[e]]end end e=function(e)return t(e),n[#n]end end end end local n,r={}if b then add(n,"self")end t"("if not l")"then while true do if l"..."then r=true else add(n,d())end if l")"then break end t","if r then o"unexpected param after '...'"end end end g()for n in all(n)do f[n]=i end if r then f["..."]=i end local l,o,f=x,a,v x,a,v={},u+1,i local i=c()for n in all(x)do n()end x,a,v=l,o,f t"end"k()return function(t)if h then add(t,{})end local l=ee(t)local o=#l local n=function(...)local t,e=pack(...),l if#e~=o then local n={}for t=0,o do n[t]=e[t]end e=n end local l={}for e=1,#n do l[n[e]]=t[e]end if r then l["..."]=pack(unpack(t,#n+1,t.n))end add(e,l)local n=i(e)deli(e)if n then if type(n)=="table"then return nu(n)end return n()end end if s then local e,t=e(t)e[t]=n else return n end end end local function v()local l=r[n]n+=1local n if l==nil then o()end if l=="nil"then return p()end if l=="true"then return p(true)end if l=="false"then return p(false)end if type(l)=="number"then return p(l)end if type(l)=="table"then return p(l.t)end if l=="{"then return nl()end if l=="("then n=e()t")"return function(e)return(n(e))end,true end if l=="-"then n=e(11)return function(e)return-n(e)end end if l=="~"then n=e(11)return function(e)return~n(e)end end if l=="not"then n=e(11)return function(e)return not n(e)end end if l=="#"then n=e(11)return function(e)return#n(e)end end if l=="@"then n=e(11)return function(e)return@n(e)end end if l=="%"then n=e(11)return function(e)return%n(e)end end if l=="$"then n=e(11)return function(e)return$n(e)end end if l=="function"then return j()end if l=="..."then return nt()end if l=="\\"then n=d()return function()return et(n)end,true,function()return el(n)end end if d(l)then return _(l),true,z(l)end o("unexpected token: "..l)end local function z(e,t,l,r)local n if e=="^"and t<=12then n=r(12)return function(e)return l(e)^n(e)end end if e=="*"and t<10then n=r(10)return function(e)return l(e)*n(e)end end if e=="/"and t<10then n=r(10)return function(e)return l(e)/n(e)end end if e=="\\"and t<10then n=r(10)return function(e)return l(e)\n(e)end end if e=="%"and t<10then n=r(10)return function(e)return l(e)%n(e)end end if e=="+"and t<9then n=r(9)return function(e)return l(e)+n(e)end end if e=="-"and t<9then n=r(9)return function(e)return l(e)-n(e)end end if e==".."and t<=8then n=r(8)return function(e)return l(e)..n(e)end end if e=="<<"and t<7then n=r(7)return function(e)return l(e)<>"and t<7then n=r(7)return function(e)return l(e)>>n(e)end end if e==">>>"and t<7then n=r(7)return function(e)return l(e)>>>n(e)end end if e=="<<>"and t<7then n=r(7)return function(e)return l(e)<<>n(e)end end if e==">><"and t<7then n=r(7)return function(e)return l(e)>>"and t<3then n=r(3)return function(e)return l(e)>n(e)end end if e=="<="and t<3then n=r(3)return function(e)return l(e)<=n(e)end end if e==">="and t<3then n=r(3)return function(e)return l(e)>=n(e)end end if e=="=="and t<3then n=r(3)return function(e)return l(e)==n(e)end end if(e=="~="or e=="!=")and t<3then n=r(3)return function(e)return l(e)~=n(e)end end if e=="and"and t<2then n=r(2)return function(e)return l(e)and n(e)end end if e=="or"and t<1then n=r(1)return function(e)return l(e)or n(e)end end end local function nt(u,l,a)local i=r[n]n+=1local o,f if a then if i=="."then o=d()return function(n)return l(n)[o]end,true,function(n)return l(n),o end end if i=="["then o=e()t"]"return function(n)return l(n)[o(n)]end,true,function(n)return l(n),o(n)end end if i=="("then return y(l)end if i=="{"or type(i)=="table"then n-=1f=v()return y(l,nil,f)end if i==":"then o=d()if r[n]=="{"or type(r[n])=="table"then f=v()return y(l,o,f)end t"("return y(l,o)end end local e=z(i,u,l,e)if not e then n-=1end return e end e=function(r)local n,e,t,l=v()while true do local r,o,i,f=nt(r or 0,n,e)if not r then break end n,e,t,l=r,o,i,f end return n,t,l end local function v()local e,n=e()if not n then o"cannot assign to value"end return n end local function nt()local n=w(v)t"="local e=w(e)if#n==1and#e==1then return function(t)local n,l=n[1](t)n[l]=e[1](t)end else return function(t)local l,r={},{}for e=1,#n do local n,e=n[e](t)add(l,n)add(r,e)end local e=b(t,e)for n=#n,1,-1do l[n][r[n]]=e[n]end end end end local function nl(t,l)local r=r[n]n+=1local n=sub(r,1,-2)local n=z(n,0,t,function()return e()end)if not n then o"invalid compound assignment"end return function(e)local t,l=l(e)t[l]=n(e)end end local function nr()if l"function"then return j(true,true)else local n,e=w(d),l"="and w(e)or{}g()for e=1,#n do f[n[e]]=i end if#n==1and#e==1then return function(t)add(t,{[n[1]]=e[1](t)})end else return function(t)local l,r={},b(t,e)for e=1,#n do l[n[e]]=r[e]end add(t,l)end end end end local function z(e)local t=q[n-1]h=function()return t~=q[n]end if not e or h()then o(n<=#r and"bad shorthand"or nil)end end local function q()local r,o,e,n=r[n]=="(",e()if l"then"then e,n=c()if l"else"then n=c()t"end"elseif l"elseif"then n=q()else t"end"end else z(r)e=c()if not h()and l"else"then n=c()end h=nil end return function(t)if o(t)then return e(t)elseif n then return n(t)end end end local function v(...)local n=m m=u+1local e=c(...)m=n return e end local function y(n,e)if n==true then return end return n,e end local function no()local r,o,n=r[n]=="(",e()if l"do"then n=v()t"end"else z(r)n=v()h=nil end return function(e)while o(e)do if stat(1)>=1then na()end local n,e=n(e)if n then return y(n,e)end end end end local function z()local l,r=i,v(true)t"until"local o=e()while i>l do k()end return function(n)repeat if stat(1)>=1then na()end local e,t=r(n)if not e then t=o(n)end while#n>l do deli(n)end if e then return y(e,t)end until t end end local function ni()if r[n+1]=="="then local r=d()t"="local o=e()t","local d,e=e(),l","and e()or p(1)t"do"g()f[r]=i local l=v()t"end"k()return function(n)for e=o(n),d(n),e(n)do if stat(1)>=1then na()end add(n,{[r]=e})local e,t=l(n)deli(n)if e then return y(e,t)end end end else local l=w(d)t"in"local e=w(e)t"do"g()for n in all(l)do f[n]=i end local o=v()t"end"k()return function(n)local e=b(n,e)while true do local r,t={},{e[1](e[2],e[3])}if t[1]==nil then break end e[3]=t[1]for n=1,#l do r[l[n]]=t[n]end if stat(1)>=1then na()end add(n,r)local e,t=o(n)deli(n)if e then return y(e,t)end end end end end local function p()if not m or a and m=1then na()end return function()return n(nu(e))end end else return function(e)return b(e,n)end end end end local function g(e)local n=d()t"::"if s[n]and s[n].e==u then o"label already defined"end s[n]={l=i,e=u,o=e,r=#e}end local function v()local t,e,l,n=d(),s,i add(x,function()n=e[t]if not n then o"label not found"end if a and n.ee and n.r<#n.o then o"goto past local"end end)return function()if stat(1)>=1then na()end return 0,n end end local function d(f)local i=r[n]n+=1if i==";"then return end if i=="do"then local n=c()t"end"return n end if i=="if"then return q()end if i=="while"then return no()end if i=="repeat"then return z()end if i=="for"then return ni()end if i=="break"then return p()end if i=="return"then return m(),true end if i=="local"then return nr()end if i=="goto"then return v()end if i=="::"then return g(f)end if i=="function"and r[n]~="("then return j(true)end if i=="?"then local e,t=_"print",w(e)return function(n)e(n)(nu(b(n,t)))end end n-=1local i,e,f,t=n,e()if l","or l"="then n=i return nt()elseif nn(r[n])then return nl(e,f)elseif u<=1and nc then return function(n)local n=pack(e(n))if not(t and n.n==0)then add(nd,n)end nk=n[1]end else if not t then o"statement has no effect"end return function(n)e(n)end end end c=function(e)s=setmetatable({},{__index=s})s[u]=i u+=1local a,f,o=u,e and 32767or i,{}while n<=#r and not nf(r[n],nv)and not(h and h())do local n,e=d(o)if n then add(o,n)end if e then l";"break end end while i>f do k()end u-=1s=getmetatable(s).__index return function(e)local l,r,t,n=1,#o while l<=r do t,n=o[l](e)if t then if type(t)~="number"then break end if n.e~=a then break end l=n.r while#e>n.l do deli(e)end t,n=nil end l+=1end while#e>f do deli(e)end return t,n end end f=nc and{_ENV=0,_env=0,_=0}or{_ENV=0}local e=c()if n<=#r then o"unexpected end"end for n in all(x)do n()end return function(n)local n=nc and{_ENV=n,_env=n,_=nk}or{_ENV=n}local n=e{[0]=n}if n then return nu(n)end end end nx,n3=10,false local t={["\0"]="000",["ᵉ"]="014",["ᶠ"]="015"}for n,e in pairs(o)do if not p(n,"'\n")then t[e]=n end end function er(n)local e=1while e<=#n do local l=b(n,e)local t=t[l]if t then n=sub(n,1,e-1).."\\"..t..sub(n,e+1)e+=#t end e+=1end return'"'..n..'"'end function eo(n)if type(n)~="string"then return false end if ns[n]then return false end if#n==0or y(b(n,1))then return false end for e=1,#n do if not nl(b(n,e))then return false end end return true end function f(e,t)local n=type(e)if n=="nil"then return"nil"elseif n=="boolean"then return e and"true"or"false"elseif n=="number"then return tostr(e,n3)elseif n=="string"then return er(e)elseif n=="table"and not t then local n,t,r="{",0,0for e,l in next,e do if t==nx then n=n..",<...>"break end if t>0then n=n..","end local l=f(l,1)if e==r+1then n=n..l r=e elseif eo(e)then n=n..e.."="..l else n=n.."["..f(e,1).."]="..l end t+=1end return n.."}"else return"<"..tostr(n)..">"end end function ei(n,e)if e==nil then return n end if not n then n=""end local t=min(21,#e)for t=1,t do if#n>0then n..="\n"end local t=e[t]if type(t)=="table"then local e=""for n=1,t.n do if#e>0then e=e..", "end e=e..f(t[n])end n..=e else n..=t end end local l={}for n=t+1,#e do l[n-t]=e[n]end return n,l end poke(24365,1)cls()h="> "a,x,_="",1,0c,z=1,20w,j={""},1ne=false m,u=0,1nh,n0=true,true s={7,4,3,5,6,8,5,12,14,7,11,5}e.print=function(n,...)if pack(...).n~=0or not nh then return print(n,...)end add(nd,tostr(n))end function n_()poke(24368,1)end function nz()return function()if stat(30)then return stat(31)end end end function nm(l,r)local e,n,t=1,0,0if not l then return e,n,t end while e<=#l do local l=b(l,e)local o=l>="█"if n>=(o and 31or 32)then t+=1n=0end if r then r(e,l,n,t)end if l=="\n"then t+=1n=0else n+=o and 2or 1end e+=1end return e,n,t end function nt(t,l)local n,e=0,0local o,r,t=nm(t,function(t,i,r,o)if l==t then n,e=r,o end end)if l>=o then n,e=r,t end if r>0then t+=1end return n,e,t end function nr(l,r,e)local t,n=1,false local r,o,l=nm(l,function(o,f,i,l)if e==l and r==i and not n then t=o n=true end if(e=l and r or r-1end if o>0then l+=1end return t,l end function n7(n,t,l,e)if type(e)=="function"then nm(n,function(n,r,o,i)print(r,t+o*4,l+i*6,e(n))end)else print(n and"⁶rw"..n,t,l,e)end end function ef(n,r,o)local i,e,f,t=n4(n)local e=1n7(n,r,o,function(r)while e<=#t and t[e]e then u-=1end rectfill(0,u*6,127,(u+1)*6-1,0)end end local function d(n,e)for t=0,2do local l=pget(n+t,e+5)pset(n+t,e+5,l==0and s[12]or 0)end end local function l(r)local l=h..a.." "local o,t,e=nt(l,#h+c)if e>x then n(e-x)elseif e=21then _-=1goto n end local n=n*6rectfill(0,n,127,n+x*6-1,0)if x>21then rectfill(0,126,127,127,0)end ef(l,0,n)print(h,0,n,s[4])if z>=10and r~=false and not v then d(o*4,n+t*6)end end local function f(e)n(1)u-=1print("[enter] ('esc' to abort)",0,u*6,s[3])while true do flip()n_()for n in nz()do if n=="•"then ne=true g=""nd={}return false end if n=="\r"or n=="\n"then m+=e return true end end end end::n::local t,e if nd or g then t,e=nr(g,0,m)if e-m<=20and nd then g,nd=ei(g,nd)t,e=nr(g,0,m)if#nd==0and not v then nd=nil end end end if not v then camera()end if m==0and not v then l(not g)end if g then local r,t=sub(g,t),min(e-m,20)n(t)n7(r,0,(u-t)*6,s[1])if t0or stat(n,...)elseif n==31then if#ni>0then return deli(ni,1)else local n=stat(n,...)if n=="•"then ne=true end return n end else return stat(n,...)end end function ec(n)if _set_fps then _set_fps(n._update60 and 60or 30)end if n._init then n._init()end d=true while true do if _update_buttons then _update_buttons()end if holdframe then holdframe()end if n._update60 then n._update60()elseif n._update then n._update()end if n._draw then n._draw()end flip()no=true na()end d=false end function et(n)if nf(n,{"i","interrupt"})then return nh elseif nf(n,{"f","flip"})then return n0 elseif nf(n,{"r","repl"})then return nc elseif nf(n,{"mi","max_items"})then return nx elseif nf(n,{"h","hex"})then return n3 elseif nf(n,{"cl","colors"})then return s elseif nf(n,{"c","code"})then local n={[0]=a}for e=1,#w-1do n[e]=w[#w-e]end return n elseif nf(n,{"cm","compile"})then return function(n)return eu(n)end elseif nf(n,{"x","exec"})then return function(n,e)n5(n,e)end elseif nf(n,{"v","eval"})then return function(n,e)return n6(n,e)end elseif nf(n,{"p","print"})then return function(n,...)e.print(f(n),...)end elseif nf(n,{"ts","tostr"})then return function(n)return f(n)end elseif nf(n,{"rst","reset"})then run()elseif nf(n,{"run"})then ec(e)else assert(false,"unknown \\-command")end end function el(e)local function t(n)return n and n~=0and true or false end local n if nf(e,{"i","interrupt"})then n=function(n)nh=t(n)end elseif nf(e,{"f","flip"})then n=function(n)n0=t(n)end elseif nf(e,{"r","repl"})then n=function(n)nc=t(n)end elseif nf(e,{"mi","max_items"})then n=function(n)nx=tonum(n)or-1end elseif nf(e,{"h","hex"})then n=function(n)n3=t(n)end elseif nf(e,{"cl","colors"})then n=function(n)s=n end else assert(false,"unknown \\-command assign")end local n={__newindex=function(t,l,e)n(e)end}return setmetatable(n,n),0end np=stat(4)n1,nw=0,false poke(24412,10,2)function k(n)if stat(28,n)then if n~=ng then ng,n1=n,0end return n1==0or n1>=10and n1%2==0elseif ng==n then ng=nil end end function _update()local e=false local function t(t)local e,n,l=nt(h..a,#h+c)if n8 then e=n8 end n+=t if not(n>=0and n0and 100or 0c=max(nr(h..a,n,l)-#h,1)e=true end local function f(n)w[j]=a j+=n a=w[j]if n<0then c=#a+1else c=max(nr(h..a,32,0)-#h,1)local n=b(a,c)if n~=""and n~="\n"then c-=1end end e=true end local function i()if#a>0then if#w>50then del(w,w[1])end w[#w]=a add(w,"")j=#w e=true end end local function d(n)if c+n>0then a=sub(a,1,c+n-1)..sub(a,c+n+1)c+=n e=true end end local function l(n)a=sub(a,1,c-1)..n..sub(a,c)c+=#n e=true end local r,u,n=stat(28,224)or stat(28,228),stat(28,225)or stat(28,229),-1if k(80)then if c>1then c-=1e=true end elseif k(79)then if c<=#a then c+=1e=true end elseif k(82)then if(r or not t(-1))and j>1then f(-1)end elseif k(81)then if(r or not t(1))and j<#w then f(1)end else local t=stat(31)n=ord(t)if t=="•"then if#a==0then extcmd"pause"else nd,n2={}i()end elseif t=="\r"or t=="\n"then if u then l"\n"else nj(a)if not nd then l"\n"else i()end end elseif r and k(40)then nj(a,true)i()elseif t~=""and n>=32and n<154then if nw and n>=128then t=chr(n-63)end l(t)elseif n==193then l"\n"elseif n==192then o(-1)elseif n==196then o(1)elseif n==203then nw=not nw q,nb="shift now selects "..(nw and"punycase"or"symbols"),40elseif k(74)then if r then c=1e=true else o(-1)end elseif k(77)then if r then c=#a+1e=true else o(1)end elseif k(42)then d(-1)elseif k(76)then d(0)end end local t=stat(4)if t~=np or n==213then l(t)np=t end if n==194or n==215then if a~=""and a~=np then np=a printh(a,"@clip")if n==215then a=""c=1end q="press again to put in clipboard"else q=""end end if stat(120)then local n repeat n=serial(2048,24448,128)l(chr(peek(24448,n)))until n==0end if e then z,n8=20end n1+=1n_()end function nq(n,e)local e,t=coresume(cocreate(e))if not e then printh("error #"..n..": "..t)print("error #"..n.."\npico8 broke something again,\nthis cart may not work.\npress any button to ignore")while btnp()==0do flip()end cls()end end nq(1,function()assert(pack(n6"(function (...) return ... end)(1,2,nil,nil)").n==4)end)nq(2,function()assert(n6"function() local temp, temp2 = {max(1,3)}, -20;return temp[1] + temp2; end"()==-17)end)printh"finished"stop()while true do if holdframe then holdframe()end _update()_draw()flip()end __meta:title__ keep:------------------------------------ keep: Please see 'Commented Source Code' section in the BBS diff --git a/test_compare/repl-un.p8 b/test_compare/repl-un.p8 index 68b545f..e0eaa64 100644 --- a/test_compare/repl-un.p8 +++ b/test_compare/repl-un.p8 @@ -1411,7 +1411,7 @@ function f(e, t) end end -function n5(n, e) +function nb(n, e) if e == nil then return n end @@ -1546,7 +1546,7 @@ function V(n, t, l, e) end end -function nb(n, r, o) +function np(n, r, o) local i, e, f, t = nl(n) local e = 1 V(n, r, o, function(r) @@ -1632,7 +1632,7 @@ function _draw() if x > 21 then rectfill(0, 126, 127, 127, 0) end - nb(l, 0, n) + np(l, 0, n) print(h, 0, n, s[4]) if A >= 10 and r ~= false and not v then d(o * 4, n + t * 6) @@ -1666,7 +1666,7 @@ function _draw() if G or g then t, e = E(g, 0, m) if e - m <= 20 and G then - g, G = n5(g, G) + g, G = nb(g, G) t, e = E(g, 0, m) if #G == 0 and not v then G = nil @@ -1731,7 +1731,7 @@ r, d, F = false, false, false j = {} function nr(n, e) - i, n3 = n, e + i, nw = n, e assert(false, n) end @@ -1743,7 +1743,7 @@ function Y(n, e) return W("return " .. n, e, true) end -function np(n) +function nx(n) local e = cocreate(ni) ::n:: local n, e = coresume(e, n) @@ -1756,7 +1756,7 @@ function np(n) return n, e end -function nw(n, e) +function n3(n, e) local n, e = C(n, e) return "line " .. e + 1 .. " col " .. n + 1 end @@ -1806,7 +1806,7 @@ function nu(e, l) end end if i then - n, i = i .. "\nat " .. nw(e, n3) + n, i = i .. "\nat " .. n3(e, nw) end O = n j = {} @@ -1850,7 +1850,7 @@ e.stat = function(n, ...) end end -function nx(n) +function nm(n) if _set_fps then _set_fps(n._update60 and 60 or 30) end @@ -1901,7 +1901,7 @@ function ns(n) return n elseif q(n, {"cm", "compile"}) then return function(n) - return np(n) + return nx(n) end elseif q(n, {"x", "exec"}) then return function(n, e) @@ -1922,7 +1922,7 @@ function ns(n) elseif q(n, {"rst", "reset"}) then run() elseif q(n, {"run"}) then - nx(e) + nm(e) else assert(false, "unknown \\-command") end diff --git a/test_compare/repl.map b/test_compare/repl.map index d26dd68..2a3129e 100644 --- a/test_compare/repl.map +++ b/test_compare/repl.map @@ -68,12 +68,12 @@ global ns <- cmd_exec global nh <- cmd_assign global n0 <- requote global n2 <- is_identifier -global n5 <- results_to_str -global nb <- str_print_input -global n3 <- g_error_idx -global np <- try_parse -global nw <- pos_to_str -global nx <- do_mainloop +global nb <- results_to_str +global np <- str_print_input +global nw <- g_error_idx +global nx <- try_parse +global n3 <- pos_to_str +global nm <- do_mainloop local n <- right local n <- i local n <- ti diff --git a/test_compare/repl.p8 b/test_compare/repl.p8 index 0880249..7e6703e 100644 --- a/test_compare/repl.p8 +++ b/test_compare/repl.p8 @@ -171,7 +171,7 @@ if(#n==0or y(b(n,1)))return false for e=1,#n do if(not D(b(n,e)))return false end return true end function f(e,t)local n=type(e)if n=="nil"then return"nil"elseif n=="boolean"then return e and"true"or"false"elseif n=="number"then return tostr(e,T)elseif n=="string"then return n0(e)elseif n=="table"and not t then local n,t,r="{",0,0for e,l in next,e do if(t==S)n=n..",<...>"break if(t>0)n=n.."," -local l=f(l,1)if e==r+1then n=n..l r=e elseif n2(e)then n=n..e.."="..l else n=n.."["..f(e,1).."]="..l end t+=1end return n.."}"else return"<"..tostr(n)..">"end end function n5(n,e)if(e==nil)return n +local l=f(l,1)if e==r+1then n=n..l r=e elseif n2(e)then n=n..e.."="..l else n=n.."["..f(e,1).."]="..l end t+=1end return n.."}"else return"<"..tostr(n)..">"end end function nb(n,e)if(e==nil)return n if(not n)n="" local t=min(21,#e)for t=1,t do if(#n>0)n..="\n" local t=e[t]if type(t)=="table"then local e=""for n=1,t.n do if(#e>0)e=e..", " @@ -189,16 +189,16 @@ if((e=l and r or r-1 if(o>0)l+=1 return t,l end function V(n,t,l,e)if(type(e)=="function")U(n,function(n,r,o,i)print(r,t+o*4,l+i*6,e(n))end)else print(n and"⁶rw"..n,t,l,e) -end function nb(n,r,o)local i,e,f,t=nl(n)local e=1V(n,r,o,function(r)while e<=#t and t[e]e)u-=1 rectfill(0,u*6,127,(u+1)*6-1,0)end end local function d(n,e)for t=0,2do local l=pget(n+t,e+5)pset(n+t,e+5,l==0and s[12]or 0)end end local function l(r)local l=h..a.." "local o,t,e=C(l,#h+c)if e>x then n(e-x)elseif e=21)_-=1goto n local n=n*6rectfill(0,n,127,n+x*6-1,0)if(x>21)rectfill(0,126,127,127,0) -nb(l,0,n)print(h,0,n,s[4])if(A>=10and r~=false and not v)d(o*4,n+t*6) +np(l,0,n)print(h,0,n,s[4])if(A>=10and r~=false and not v)d(o*4,n+t*6) end local function f(e)n(1)u-=1print("[enter] ('esc' to abort)",0,u*6,s[3])while true do flip()nf()for n in nd()do if(n=="•")X=true g=""G={}return false if(n=="\r"or n=="\n")m+=e return true -end end end::n::local t,e if G or g then t,e=E(g,0,m)if e-m<=20and G then g,G=n5(g,G)t,e=E(g,0,m)if(#G==0and not v)G=nil +end end end::n::local t,e if G or g then t,e=E(g,0,m)if e-m<=20and G then g,G=nb(g,G)t,e=E(g,0,m)if(#G==0and not v)G=nil end end if(not v)camera() if(m==0and not v)l(not g) if g then local r,t=sub(g,t),min(e-m,20)n(t)V(r,0,(u-t)*6,s[1])if t0or stat(n,...)elseif n==31then if#j>0then return deli(j,1)else local n=stat(n,...)if(n=="•")X=true -return n end else return stat(n,...)end end function nx(n)if(_set_fps)_set_fps(n._update60 and 60or 30) +return n end else return stat(n,...)end end function nm(n)if(_set_fps)_set_fps(n._update60 and 60or 30) if(n._init)n._init() d=true while true do if(_update_buttons)_update_buttons() if(holdframe)holdframe() if n._update60 then n._update60()elseif n._update then n._update()end if(n._draw)n._draw() -flip()F=true I()end d=false end function ns(n)if q(n,{"i","interrupt"})then return M elseif q(n,{"f","flip"})then return N elseif q(n,{"r","repl"})then return J elseif q(n,{"mi","max_items"})then return S elseif q(n,{"h","hex"})then return T elseif q(n,{"cl","colors"})then return s elseif q(n,{"c","code"})then local n={[0]=a}for e=1,#w-1do n[e]=w[#w-e]end return n elseif q(n,{"cm","compile"})then return function(n)return np(n)end elseif q(n,{"x","exec"})then return function(n,e)W(n,e)end elseif q(n,{"v","eval"})then return function(n,e)return Y(n,e)end elseif q(n,{"p","print"})then return function(n,...)e.print(f(n),...)end elseif q(n,{"ts","tostr"})then return function(n)return f(n)end elseif q(n,{"rst","reset"})then run()elseif q(n,{"run"})then nx(e)else assert(false,"unknown \\-command")end end function nh(e)local function t(n)return n and n~=0and true or false end local n if q(e,{"i","interrupt"})then n=function(n)M=t(n)end elseif q(e,{"f","flip"})then n=function(n)N=t(n)end elseif q(e,{"r","repl"})then n=function(n)J=t(n)end elseif q(e,{"mi","max_items"})then n=function(n)S=tonum(n)or-1end elseif q(e,{"h","hex"})then n=function(n)T=t(n)end elseif q(e,{"cl","colors"})then n=function(n)s=n end else assert(false,"unknown \\-command assign")end local n={__newindex=function(t,l,e)n(e)end}return setmetatable(n,n),0end Q=stat(4)K,R=0,false poke(24412,10,2)function k(n)if stat(28,n)then if(n~=nn)nn,K=n,0 +flip()F=true I()end d=false end function ns(n)if q(n,{"i","interrupt"})then return M elseif q(n,{"f","flip"})then return N elseif q(n,{"r","repl"})then return J elseif q(n,{"mi","max_items"})then return S elseif q(n,{"h","hex"})then return T elseif q(n,{"cl","colors"})then return s elseif q(n,{"c","code"})then local n={[0]=a}for e=1,#w-1do n[e]=w[#w-e]end return n elseif q(n,{"cm","compile"})then return function(n)return nx(n)end elseif q(n,{"x","exec"})then return function(n,e)W(n,e)end elseif q(n,{"v","eval"})then return function(n,e)return Y(n,e)end elseif q(n,{"p","print"})then return function(n,...)e.print(f(n),...)end elseif q(n,{"ts","tostr"})then return function(n)return f(n)end elseif q(n,{"rst","reset"})then run()elseif q(n,{"run"})then nm(e)else assert(false,"unknown \\-command")end end function nh(e)local function t(n)return n and n~=0and true or false end local n if q(e,{"i","interrupt"})then n=function(n)M=t(n)end elseif q(e,{"f","flip"})then n=function(n)N=t(n)end elseif q(e,{"r","repl"})then n=function(n)J=t(n)end elseif q(e,{"mi","max_items"})then n=function(n)S=tonum(n)or-1end elseif q(e,{"h","hex"})then n=function(n)T=t(n)end elseif q(e,{"cl","colors"})then n=function(n)s=n end else assert(false,"unknown \\-command assign")end local n={__newindex=function(t,l,e)n(e)end}return setmetatable(n,n),0end Q=stat(4)K,R=0,false poke(24412,10,2)function k(n)if stat(28,n)then if(n~=nn)nn,K=n,0 return K==0or K>=10and K%2==0elseif nn==n then nn=nil end end function _update()local e=false local function t(t)local e,n,l=C(h..a,#h+c)if(ne)e=ne n+=t if(not(n>=0and n0and 100or 0c=max(E(h..a,n,l)-#h,1)e=true end local function f(n)w[z]=a z+=n a=w[z]if n<0then c=#a+1else c=max(E(h..a,32,0)-#h,1)local n=b(a,c)if(n~=""and n~="\n")c-=1 diff --git a/test_input/const.p8 b/test_input/const.p8 index a830577..5932919 100644 --- a/test_input/const.p8 +++ b/test_input/const.p8 @@ -263,6 +263,19 @@ local --[[const]] d, --[[const]] e = nil, false local --[[const]] f = max() ?3 + max(4, 5) menuitem,chr=41,42 +-- misc1.5 +local --[[non-const]] ncval = 4 +local --[[const]] cval = -3 +?(1-4)*ncval +?(1-4)^ncval +?ncval^(1-4) +?cval^2 +?-cval^2 +?2^cval +?-cval +?~cval +?not cval +if (ERROR) ?#cval -- misc2 --[[const]] ssog1 = 123; ?ssog1/2 --[[const]] ssog2, --[[const]] ssog3 = 123, 456; ?ssog2+ssog3 diff --git a/test_input/input.p8 b/test_input/input.p8 index 68b9b17..460bdee 100644 --- a/test_input/input.p8 +++ b/test_input/input.p8 @@ -150,6 +150,7 @@ while (1 == 2) do end repeat until (1 == 1); for a in (all({})) do end print("test"..(@16).."str") +?(calls3)+((({})[1]) and (({}).🐱) or (...) or (xxx()))+(3)+(-3) -- shorthands if(true) ?"sh1"