From 4b6f6a127f48a11e63ece5f1e7e3f7a4cd1f0067 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath <2+defunkt@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:27:56 -0800 Subject: [PATCH] disable errors... for now! --- src/compiler/compiler.ts | 16 +++++++++------- src/compiler/utils.ts | 17 +++++++++-------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/compiler/compiler.ts b/src/compiler/compiler.ts index fe18a09..b03b9b9 100644 --- a/src/compiler/compiler.ts +++ b/src/compiler/compiler.ts @@ -1,9 +1,10 @@ import { CompilerError } from '#compiler/compilerError.ts' +import { parse } from '#parser/parser2' +import { SyntaxNode, Tree } from '#parser/node' import { parser } from '#parser/shrimp.ts' import * as terms from '#parser/shrimp.terms' import { setGlobals } from '#parser/tokenizer' import { tokenizeCurlyString } from '#parser/curlyTokenizer' -import type { SyntaxNode, Tree } from '@lezer/common' import { assert, errorMessage } from '#utils/utils' import { toBytecode, type Bytecode, type ProgramItem, bytecodeToString } from 'reefvm' import { @@ -63,13 +64,14 @@ export class Compiler { constructor(public input: string, globals?: string[] | Record) { try { if (globals) setGlobals(Array.isArray(globals) ? globals : Object.keys(globals)) - const cst = parser.parse(input) - const errors = checkTreeForErrors(cst) + const ast = parse(input) + const cst = new Tree(ast) + // const errors = checkTreeForErrors(cst) - const firstError = errors[0] - if (firstError) { - throw firstError - } + // const firstError = errors[0] + // if (firstError) { + // throw firstError + // } this.#compileCst(cst, input) this.bytecode = toBytecode(this.instructions) diff --git a/src/compiler/utils.ts b/src/compiler/utils.ts index 446aab3..18dbda4 100644 --- a/src/compiler/utils.ts +++ b/src/compiler/utils.ts @@ -1,16 +1,17 @@ import { CompilerError } from '#compiler/compilerError.ts' import * as terms from '#parser/shrimp.terms' -import type { SyntaxNode, Tree } from '@lezer/common' +import type { SyntaxNode, Tree } from '#parser/node' export const checkTreeForErrors = (tree: Tree): CompilerError[] => { const errors: CompilerError[] = [] - tree.iterate({ - enter: (node) => { - if (node.type.isError) { - errors.push(new CompilerError(`Unexpected syntax.`, node.from, node.to)) - } - }, - }) + + // tree.iterate({ + // enter: (node) => { + // if (node.type.isError) { + // errors.push(new CompilerError(`Unexpected syntax.`, node.from, node.to)) + // } + // }, + // }) return errors }