<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Yes that was line 199 and arg/4 is<div class=""><br class=""></div><div class=""><font face="Courier" class="">    % arg(Data, NonCanon, Index, Argument)<br class="">    %<br class="">    % Given a data item (Data) and an argument index (Index), starting<br class="">    % at 0 for the first argument, binds Argument to that argument of<br class="">    % the functor of the data item. If the argument index is out of range<br class="">    % -- that is, greater than or equal to the arity of the functor or<br class="">    % lower than 0 -- then the call fails.<br class="">    %<br class="">    % Note that this predicate only returns an answer when NonCanon is<br class="">    % do_not_allow or canonicalize.  If you need the include_details_cc<br class="">    % behaviour use deconstruct.arg_cc/3.<br class="">    %<br class="">:- some [ArgT] pred arg(T, noncanon_handling, int, ArgT).<br class="">:- mode arg(in, in(do_not_allow), in, out) is semidet.<br class="">:- mode arg(in, in(canonicalize), in, out) is semidet.<br class="">:- mode arg(in, in(canonicalize_or_do_not_allow), in, out) is semidet.</font></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 18 May 2021, at 12:36, Volker Wysk <<a href="mailto:post@volker-wysk.de" class="">post@volker-wysk.de</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Am Dienstag, den 18.05.2021, 09:00 +0100 schrieb Sean Charles<br class="">(emacstheviking):<br class=""><blockquote type="cite" class="">Hi, I have a token definition like this:<br class=""><br class="">:- type location<br class="">           ---> pos(index::int, line::int, col::int).<br class=""><br class="">% for ast detection later.<br class="">:- type token<br class="">           ---> tk(location, string)<br class="">           ; '('(location) ; ')'(location)<br class="">           ; '['(location) ; ']'(location)<br class="">           ; '{'(location) ; '}'(location)<br class="">           ; c1(location, string) ; cn(location, string)<br class="">           ; s1(location, string) ; s2(location, string)<br class="">           .<br class=""><br class="">Given the above, I have now realised that I can’t easily (?) access the location part of any particulr instance of the token type because it doesn’t have a name and thus no field reader will be generated. As I understand it, I would have to give a unique name.<br class=""><br class="">I tried:<br class=""><br class="">    arg(Tok1, canonicalize, 0, Out),<br class=""><br class="">and was rewarded with this message from the compiler,<br class=""><br class="">repl.m:199: In clause for predicate `run_lex'/3:<br class="">repl.m:199: in argument 1 of call to predicate `lexer.on_string'/4:<br class="">repl.m:199: in argument 2 of functor `string.between/3’:<br class="">repl.m:199: in unification of argument<br class="">repl.m:199: and term `index(Out)’:<br class="">repl.m:199: type error in argument of functor `index'/1.<br class="">repl.m:199: Argument 1 (Out) has type `(some [ArgT] ArgT)’,<br class="">repl.m:199: expected type was `lexer.location’.<br class=""><br class="">Which is fair enough but how do I do it? That message is currently above my pay grade.<br class="">Have I overlooked something blindingly obvious?<br class=""></blockquote><br class="">Is that "arg(Tok1, canonicalize, 0, Out)" the line 199? There isn't any term<br class="">"index(Out)". What's the declaration of arg/4?<br class=""><br class="">Volker<br class=""></div></div></blockquote></div><br class=""></div></body></html>