From a843394883ee215dc97b26dddae588b6a3308950 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Thu, 19 Nov 2015 09:47:35 -0600 Subject: update neotoma plugin --- rebar.config | 5 +---- src/rlx_goal.erl | 10 +++++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/rebar.config b/rebar.config index 647efa8..747f415 100644 --- a/rebar.config +++ b/rebar.config @@ -24,10 +24,7 @@ %% Profiles ==================================================================== -{profiles, [{dev, [{deps, [{neotoma, ".*", - {git, "https://github.com/seancribbs/neotoma.git", {branch, "master"}}} - ]} - ]}, +{profiles, [{dev, [{plugins, [rebar3_neotoma_plugin]}]}, {test, [{erl_opts, [debug_info]}]} ]}. diff --git a/src/rlx_goal.erl b/src/rlx_goal.erl index e588a0e..354aa48 100644 --- a/src/rlx_goal.erl +++ b/src/rlx_goal.erl @@ -16,9 +16,9 @@ file(Filename) -> case file:read_file(Filename) of {ok,Bin} -> parse(Bin); Err -> Err end. -spec parse(binary() | list()) -> any(). -parse(List) when is_list(List) -> parse(list_to_binary(List)); +parse(List) when is_list(List) -> parse(unicode:characters_to_binary(List)); parse(Input) when is_binary(Input) -> - setup_memo(), + _ = setup_memo(), Result = case 'constraint'(Input,{{line,1},{column,1}}) of {AST, <<>>, _Index} -> AST; Any -> Any @@ -115,7 +115,7 @@ setup_memo() -> release_memo() -> ets:delete(memo_table_name()). --spec memoize(index(), atom(), term()) -> true. +-spec memoize(index(), atom(), parse_result()) -> true. memoize(Index, Name, Result) -> Memo = case ets:lookup(memo_table_name(), Index) of [] -> []; @@ -252,8 +252,8 @@ p_label(Tag, P) -> -endif. -ifdef(p_scan). --spec p_scan(parse_fun(), input(), index(), [term()]) -> parse_result(). -p_scan(_, [], Index, Accum) -> {lists:reverse( Accum ), [], Index}; +-spec p_scan(parse_fun(), input(), index(), [term()]) -> {[term()], input(), index()}. +p_scan(_, <<>>, Index, Accum) -> {lists:reverse(Accum), <<>>, Index}; p_scan(P, Inp, Index, Accum) -> case P(Inp, Index) of {fail,_} -> {lists:reverse(Accum), Inp, Index}; -- cgit v1.2.3