From df91fee4a7bb17f8822a0a5637533257d30e0743 Mon Sep 17 00:00:00 2001 From: s-ol Date: Mon, 2 Mar 2020 14:16:21 +0100 Subject: update lib.math and lib.logic to new op interface --- core/base.moon | 2 +- core/parsing.moon | 2 +- core/value.moon | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/base.moon b/core/base.moon index cf3d146..c6ea694 100644 --- a/core/base.moon +++ b/core/base.moon @@ -31,7 +31,7 @@ class Input -- -- during setup, only marked dirty if old and new stream differ in value class ValueInput extends Input - merge: (old) => @dirty_setup = not old or @stream\unwrap! != old\unwrap! + merge: (old) => @dirty_setup = not old or @stream != old.stream finish_setup: => @dirty_setup = false dirty: => @dirty_setup or @stream\dirty! diff --git a/core/parsing.moon b/core/parsing.moon index ac4f878..e919c41 100644 --- a/core/parsing.moon +++ b/core/parsing.moon @@ -15,7 +15,7 @@ mspace = (comment + wc)^0 / 1 -- optional whitespace -- atoms digit = R '09' -first = (R 'az', 'AZ') + S '-_+*/.!?=' +first = (R 'az', 'AZ') + S '-_+*/.!?=%' sym = first * (first + digit)^0 / Value\parse 'sym' strd = '"' * (C ((P '\\"') + (P '\\\\') + (1 - P '"'))^0) * '"' / Value\parse 'str', '\"' diff --git a/core/value.moon b/core/value.moon index d4a0de3..b882507 100644 --- a/core/value.moon +++ b/core/value.moon @@ -46,6 +46,11 @@ class Result assert not (next @side_inputs), msg or "eval-time const expected" @value + -- asserts a value exists and returns its type + type: => + assert @value, "Result with value expected" + @value.type + -- create a value-copy of this result that has the same impulses but without -- affecting the original's update logic make_ref: => -- cgit v1.2.3