%%
%% Just playing around testing functionality

-module(play).
-author('jeffm@ghostgun.com').

-export([
	 parse/1
	]).

parse(Filename) ->
    {ok, InFile} = file:open(Filename, [read]),
    Acc = loop(InFile, []),
    file:close(InFile),
    postfix_policy_parser:parse(Acc).

loop(InFile, Acc) ->
    case io:request(InFile, {get_until, prompt, postfix_policy_lexer, token, [1]}) of
	{ok, Token, EndLine} ->
	    io:format("Token: ~p EndLine: ~p~n", [Token, EndLine]),
	    loop(InFile, Acc ++ [Token]);
	{error, token} ->
	    exit(scanning_error);
	{eof,_} ->
	    Acc
    end.
