Clauses being split by the :-
character sequence, if I intentionally put a blank space between the two characters, SWI-Prolog seems to only give an error when the body is composed by two or more goals, but not if the body is composed by only one.
Source that throws:
:- module(_, []).
a :- write(a), nl. % ok clause
b : - write(b), nl. % error (as expected)
Source that does not throw:
:- module(_, []).
a :- write(a), nl. % same
b : - write(b). % no error (removed the second goal)
I can’t seem to find what “happens” to that second rule.
listing
does not show it and predicate_property(<module_name>:Pred)
only yields a/0
, but if I do source_file_property(<file_path>, number_of_clauses(X))
I get 2 clauses, and I’m sure that b/0
is the second one because without it the source has only one.
So, what happens to a rule in the form of <head> : - <goal>.
and is this ISO behavior?
(I need to know this because I’m trying to implement an accurate TextMate grammar for VS Code, and I need to be sure of :-
not allowing any space in it.)