diff --git a/fzn-parser/fznslurp.pl b/fzn-parser/fznslurp.pl index 77c519c..4157f42 100644 --- a/fzn-parser/fznslurp.pl +++ b/fzn-parser/fznslurp.pl @@ -6,19 +6,22 @@ main :- argument_list(A), main(A). -main([ACTION|REST]) :- action(ACTION), !, main(REST). +main([ACTION_S|REST]) :- + read_term_from_atom(ACTION_S, ACTION, [end_of_term(eof)]), + action(ACTION), !, main(REST). main([]). -action(load) :- !, load_ast(AST), g_assign(ast, AST). -action(dump) :- !, g_read(ast, AST), dump_ast(AST). -action(name) :- !, - g_read(ast, AST), - sa_names(AST, NAST), - g_assign(ast, NAST). -action(halt) :- !, halt. -action(debug) :- g_read(ast_debug, true), !, g_assign(ast_debug, false). -action(debug) :- !, g_assign(ast_debug, true). -action(ACTION) :- format("%w: unknown action.\n", [ACTION]). +action(load(F)) :- !, see(F), action(load), seen. +action(load) :- !, load_ast(AST), g_assign(ast, AST). +action(dump) :- !, g_read(ast, AST), dump_ast(AST). +action(name) :- !, + g_read(ast, AST), + sa_names(AST, NAST), + g_assign(ast, NAST). +action(halt) :- !, halt. +action(debug) :- g_read(ast_debug, true), !, g_assign(ast_debug, false). +action(debug) :- !, g_assign(ast_debug, true). +action(ACTION) :- format("%w: unknown action.\n", [ACTION]). % ----------------------------------------------------------------------------- -- libgit2 0.21.2