Skip to content

Commit

Permalink
Merge pull request #100 from fink-lang/remove-iter-blocks
Browse files Browse the repository at this point in the history
feat(iter): remove iter blocks
  • Loading branch information
kollhof authored Jul 14, 2021
2 parents 808f6cc + 522e8df commit 3e638cd
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 435 deletions.
48 changes: 24 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/ast/analyze.test.fnk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{describe, it, expect, to_match_snapshot} = import '@fink/jest/test.fnk'

{map, fold, flatten} = import '@fink/std-lib/iter.fnk'
{map, fold: fold_, flatten} = import '@fink/std-lib/iter.fnk'


{parse} = import '../parser.fnk'
Expand All @@ -10,7 +10,7 @@



collect_exprs = fold fn [expr], , , ctx: [expr, ctx]
collect_exprs = fold_ [], fn [expr], , , ctx: [expr, ctx]


collect_bindings = fn parsed:
Expand Down
24 changes: 5 additions & 19 deletions src/lang/block/init.fnk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{advance, curr_loc, curr_value, next_is} = import '@fink/prattler/parser.fnk'
{curr_loc, curr_value} = import '@fink/prattler/parser.fnk'

{add_separator, add_operator} = import '@fink/prattler/expressions.fnk'

Expand All @@ -24,27 +24,13 @@ named_block = fn token_type, expr_type, block_expr:
...prefix token_type

nud: fn: fn ctx:
{start, end} = curr_loc ctx
{start} = curr_loc ctx
op = curr_value ctx

match ctx:
next_is ?, 'fn':
[expr, next_ctx] = single_expression ctx
args = [expr]
callee = {type: 'ident', value: token_type, loc: {start, end}}
[{type: 'call', callee, args, loc: {...expr.loc, start}}, next_ctx]
[{exprs: args}, body_ctx] = terminated_block ctx, ':'

next_is ?, '=':
op = '='
left = {type: 'ident', value: token_type, loc: {start, end}}
[right, next_ctx] = single_expression advance ctx
[{type: 'assign', op, left, right, loc: {start, end: right.loc.end}}, next_ctx]

else:
[{exprs: args}, body_ctx] = terminated_block ctx, ':'

[{exprs, comments, loc}, next_ctx] = indented_block body_ctx, block_expr
[{type: expr_type, op, args, exprs, comments, loc: {start, end: loc.end}}, next_ctx]
[{exprs, comments, loc}, next_ctx] = indented_block body_ctx, block_expr
[{type: expr_type, op, args, exprs, comments, loc: {start, end: loc.end}}, next_ctx]



Expand Down
2 changes: 0 additions & 2 deletions src/lang/init.fnk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
{add_func} = import './func/init.fnk'
{add_group} = import './group/init.fnk'
{add_assignment_operators} = import './assignment/init.fnk'
{add_iterables} = import './iterable/init.fnk'
{add_spread_operator} = import './spread/init.fnk'
{add_async} = import './async/init.fnk'
{add_import} = import './import/init.fnk'
Expand All @@ -32,7 +31,6 @@ init_language = fn ctx:
add_func

add_conditionals
add_iterables

add_assignment_operators

Expand Down
12 changes: 0 additions & 12 deletions src/lang/iterable/init.fnk

This file was deleted.

154 changes: 0 additions & 154 deletions src/lang/iterable/init.test.fnk

This file was deleted.

Loading

0 comments on commit 3e638cd

Please sign in to comment.