• R/O
  • SSH

Joypy: Commit

Main interpreter and library.


Commit MetaInfo

Revisionc5823e327a835ecf4d167d4209ae9a9e7bcb7664 (tree)
Time2019-08-13 13:29:26
AuthorSimon Forman <sforman@hush...>
CommiterSimon Forman

Log Message

Numbers can be followed by space or [.

Change Summary

Incremental Difference

diff -r 7f9d45af6c88 -r c5823e327a83 thun/gnu-prolog/parser.pl
--- a/thun/gnu-prolog/parser.pl Mon Aug 12 21:13:11 2019 -0700
+++ b/thun/gnu-prolog/parser.pl Mon Aug 12 21:29:26 2019 -0700
@@ -35,7 +35,7 @@
3535
3636 % TODO: negative numbers, floats, scientific notation.
3737
38-num(N) --> signed_digits(Codes), !, { number_codes(N, Codes) }.
38+num(N) --> signed_digits(Codes), !, end_num, { number_codes(N, Codes) }.
3939
4040 % Groups of characters.
4141
@@ -49,10 +49,16 @@
4949 % Character types.
5050
5151 char(Ch) --> [Ch], { nonvar(Ch), Ch =\= 0'[, Ch =\= 0'], between(33, 126, Ch) }.
52-blank --> [Ch], { nonvar(Ch),(Ch =:= 32 ; between(9, 13, Ch)) }.
52+blank --> [Ch], { nonvar(Ch), is_space(Ch) }.
5353 digit(Ch) --> [Ch], { nonvar(Ch), between(48, 57, Ch) }.
5454
5555
56+end_num, [Ch] --> [Ch], { [Ch] = "[" ; is_space(Ch) }.
57+end_num([], []).
58+
59+is_space(Ch) :- Ch =:= 32 ; between(9, 13, Ch).
60+
61+
5662 % Line is the next new-line delimited line from standard input stream as
5763 % a list of character codes.
5864
Show on old repository browser