From a34ee07571fea3e9388d1c4c1c7e2cd9adbc9fc6 Mon Sep 17 00:00:00 2001 From: BENJAMIN PEINHARDT Date: Sun, 25 Aug 2024 17:22:43 -0500 Subject: [PATCH] did I make changes? --- priv/static/squared_away.mjs | 16 +++++++++------- src/squared_away/lang/interpreter.gleam | 3 +-- src/squared_away/lang/scanner.gleam | 1 + 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/priv/static/squared_away.mjs b/priv/static/squared_away.mjs index 6abfd94..274a534 100644 --- a/priv/static/squared_away.mjs +++ b/priv/static/squared_away.mjs @@ -2879,7 +2879,7 @@ function do_scan(loop$src, loop$acc) { throw makeError( "assignment_no_match", "squared_away/lang/scanner", - 97, + 98, "do_scan", "Assignment pattern did not match", { value: $2 } @@ -2911,7 +2911,9 @@ function do_scan(loop$src, loop$acc) { } function scan(src) { let $ = trim2(src); - if ($.startsWith("=")) { + if ($ === "") { + return new Ok(toList([])); + } else if ($.startsWith("=")) { let rest = $.slice(1); return do_scan( (() => { @@ -3712,9 +3714,9 @@ function interpret(loop$env, loop$expr) { throw makeError( "panic", "squared_away/lang/interpreter", - 62, + 65, "", - "These should be the only options if the typecher is working", + "These should be the only options if the typechecker is working", {} ); } @@ -3818,7 +3820,7 @@ function interpret(loop$env, loop$expr) { throw makeError( "assignment_no_match", "squared_away/lang/interpreter", - 111, + 114, "", "Assignment pattern did not match", { value: $ } @@ -3834,7 +3836,7 @@ function interpret(loop$env, loop$expr) { throw makeError( "assignment_no_match", "squared_away/lang/interpreter", - 115, + 118, "", "Assignment pattern did not match", { value: $ } @@ -3862,7 +3864,7 @@ function interpret(loop$env, loop$expr) { throw makeError( "panic", "squared_away/lang/interpreter", - 125, + 129, "", "these should be the only options if the typechecker is working properly", {} diff --git a/src/squared_away/lang/interpreter.gleam b/src/squared_away/lang/interpreter.gleam index eb79828..4abb970 100644 --- a/src/squared_away/lang/interpreter.gleam +++ b/src/squared_away/lang/interpreter.gleam @@ -3,7 +3,6 @@ import gleam/dict import gleam/float import gleam/int import gleam/result -import gleam/string import squared_away/lang/environment import squared_away/lang/parser import squared_away/lang/scanner @@ -63,7 +62,7 @@ pub fn interpret( Ok(FloatingPointNumber(float.negate(f))) parser.Not, Boolean(b) -> Ok(Boolean(!b)) _, _ -> - panic as "These should be the only options if the typecher is working" + panic as "These should be the only options if the typechecker is working" } } typechecker.BinaryOp(_, lhs, op, rhs) -> { diff --git a/src/squared_away/lang/scanner.gleam b/src/squared_away/lang/scanner.gleam index 137230c..4b900fb 100644 --- a/src/squared_away/lang/scanner.gleam +++ b/src/squared_away/lang/scanner.gleam @@ -59,6 +59,7 @@ pub type ScanError { pub fn scan(src: String) -> Result(List(Token), ScanError) { case string.trim(src) { + "" -> Ok([]) "=" <> rest -> do_scan(rest |> string.trim_left, []) _ -> Ok([StringLiteral(src)]) }