Markus Triska
Markus Triska
The lexer seems to think that `.x` can still be completed to a token, the query is not even posted. For example, we have: ?- write(hello),get_char(C).% hello C = '%'....
I cannot reproduce this. For instance, with: term_expansion(a, b) :- write(hello). a. I get, upon consulting: hello Could you please include a test case? Thank you a lot!
Thank you! Even the following shorter program shows the issue: x. b, c.
Thank you a lot for your great help with this! Please consider reopening this issue until it is corrected, so we remember to take care of it.
I now briefly had access to Windows install, and I can confirm that **this issue still exists** with the Windows version. @jasagredo, thank you a lot for your excellent analysis!...
Currently, I get: ?- term_expansion(T, E). error(instantiation_error,throw/1). This seems reasonable I think? Certainly better than nontermination.
Regarding the test: I think a `nonvar/1` test should not be necessary, since `expand_term/2` should call `term_expansion/2` only for non-variable terms? At least that's how GNU Prolog documents it: http://www.gprolog.org/manual/gprolog.html#expand-term%2F2
As a workaround, does it work if you invoke Scryer with `-g run file.pl` instead of using the `initialization/1` directive? **EDIT**: It also crashes: $ scryer-prolog -g run issue3057.pl [tab]...
The interesting thing to me is that the point where the crash occurs is **not** the "reading of input" Rust part I would expect to be invoked in this example: https://github.com/mthom/scryer-prolog/blob/7ffd93c0d7a9521222d1e87acff17aad39e69e9e/src/repl_helper.rs#L71...
Your PR solves this nicely! I would also like to add: For your concrete use case, **`get_single_char/1`** from `library(charsio)` may also be useful, it truly reads a single character and...