reorganization for easier testing
This commit is contained in:
parent
c36f1a348c
commit
e7a7a40251
1 changed files with 10 additions and 7 deletions
|
@ -1,14 +1,17 @@
|
||||||
-module(akhamoth).
|
-module(akhamoth).
|
||||||
|
|
||||||
-export([compile/1, collect/2]).
|
-export([compile_file/1, compile_binary/1, collect/2]).
|
||||||
|
|
||||||
compile(Path) ->
|
compile_file(Path) ->
|
||||||
{ok, Src} = file:read_file(Path),
|
{ok, Source} = file:read_file(Path),
|
||||||
Lexer = akh_lexer:new(Src),
|
compile_binary(Source).
|
||||||
collect(Lexer, []).
|
|
||||||
|
|
||||||
collect(Lexer, Acc) ->
|
compile_binary(Source) ->
|
||||||
case akh_lexer:next(Lexer) of
|
Lx = akh_lexer:new(Source),
|
||||||
|
collect(Lx, []).
|
||||||
|
|
||||||
|
collect(Lx, Acc) ->
|
||||||
|
case akh_lexer:next(Lx) of
|
||||||
none -> Acc;
|
none -> Acc;
|
||||||
{ok, T, L} -> collect(L, [T | Acc])
|
{ok, T, L} -> collect(L, [T | Acc])
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Add table
Reference in a new issue