From 48ef6aa409c119130b1aa50fa6588db725d6e746 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Thu, 27 Sep 2018 16:21:39 +0300 Subject: expr: apparently strings are streams too rename collapsestr and collapse to just stream --- src/compiler/compiler.lm | 2 +- src/compiler/expr.lm | 24 ++++++------------------ 2 files changed, 7 insertions(+), 19 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/compiler.lm b/src/compiler/compiler.lm index 21fc9fe..d5b16bb 100644 --- a/src/compiler/compiler.lm +++ b/src/compiler/compiler.lm @@ -151,7 +151,7 @@ context fspec f = '1' if (f != '') - lhs.length = collapser::collapsestr(f) + lhs.length = collapser::stream(f) } def type diff --git a/src/compiler/expr.lm b/src/compiler/expr.lm index 5b29577..1ecdc44 100644 --- a/src/compiler/expr.lm +++ b/src/compiler/expr.lm @@ -16,7 +16,7 @@ context expr def type collapsed:collapser::collapsed [EXPR+] { - lhs.collapsed = collapser::collapsestr($r1) + lhs.collapsed = collapser::stream($r1) if (!lhs.collapsed) reject } end @@ -31,7 +31,7 @@ context expr def type collapsed:collapser::collapsed [syntax+] { - lhs.collapsed = collapser::collapsestr($r1) + lhs.collapsed = collapser::stream($r1) if (!lhs.collapsed) reject } end @@ -48,7 +48,7 @@ context expr def type collapsed:collapser::collapsed [syntax+] { - lhs.collapsed = collapser::collapsestr($r1) + lhs.collapsed = collapser::stream($r1) if (!lhs.collapsed) reject } end @@ -65,7 +65,7 @@ context expr def type collapsed:collapser::collapsed [syntax+] { - lhs.collapsed = collapser::collapsestr($r1) + lhs.collapsed = collapser::stream($r1) if (!lhs.collapsed) reject } end @@ -396,19 +396,7 @@ context collapser [tok+] commit { flush_all() lhs.result = parse reducer::collapsed[values] if (!lhs.result) reject } collapsed - collapse(s:stream) - { - c:collapser = new collapser() - c->stack = op_stack_new() - c->values = '' - c->next_is_unary = true - parse r:collapsed(c)[s] - op_stack_free(c->stack) - return r - } - - collapsed - collapsestr(s:str) + stream(s:any) { c:collapser = new collapser() c->stack = op_stack_new() @@ -420,7 +408,7 @@ context collapser } end -# r:collapser::collapsed = collapser::collapse(stdin) +# r:collapser::collapsed = collapser::stream(stdin) # if (r) { # print($r.result, '\n') # } else { -- cgit v1.2.3-70-g09d2