diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2018-09-27 16:21:39 +0300 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-09-27 16:21:39 +0300 |
commit | 48ef6aa409c119130b1aa50fa6588db725d6e746 (patch) | |
tree | 53bfae2e5864f91a87fff5ba679d33217410edb2 /src | |
parent | 17944dc0508fbeca23896c738f362c60614a0cf5 (diff) |
expr: apparently strings are streams too
rename collapsestr and collapse to just stream
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/compiler.lm | 2 | ||||
-rw-r--r-- | src/compiler/expr.lm | 24 |
2 files changed, 7 insertions, 19 deletions
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 { |