Improve error handling for (:include )

The form (:include $(SCOPE_ROOT)\foo) requires quoting, but the error
message was cryptic ("Error: undefined symbol include").

Signed-off-by: David Allsopp <david.allsopp@metastack.com>
This commit is contained in:
David Allsopp 2017-08-25 11:12:15 +01:00
parent 7031e78778
commit 2d100b1150
1 changed files with 4 additions and 1 deletions

View File

@ -82,9 +82,12 @@ module Unexpanded = struct
let open Ast in
match t with
| Element s -> Element s
| Special (l, s) -> Special (l, s)
| Union [Special (_, "include"); Element fn] ->
Include (Sexp.Of_sexp.string fn)
| Union [Special (loc, "include"); _]
| Special (loc, "include") ->
Loc.fail loc "(:include expects a single element (do you need to quote the filename?)"
| Special (l, s) -> Special (l, s)
| Union l ->
Union (List.map l ~f:map)
| Diff (l, r) ->