@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "scryer-prolog"
|
name = "scryer-prolog"
|
||||||
version = "0.8.33"
|
version = "0.8.34"
|
||||||
authors = ["Mark Thom <markjordanthom@gmail.com>"]
|
authors = ["Mark Thom <markjordanthom@gmail.com>"]
|
||||||
repository = "https://github.com/mthom/scryer-prolog"
|
repository = "https://github.com/mthom/scryer-prolog"
|
||||||
description = "A modern Prolog implementation written mostly in Rust."
|
description = "A modern Prolog implementation written mostly in Rust."
|
||||||
@@ -14,7 +14,7 @@ cfg-if = "0.1.7"
|
|||||||
downcast = "0.10.0"
|
downcast = "0.10.0"
|
||||||
num = "0.2"
|
num = "0.2"
|
||||||
ordered-float = "0.5.0"
|
ordered-float = "0.5.0"
|
||||||
prolog_parser = "0.8.10"
|
prolog_parser = "0.8.11"
|
||||||
readline_rs_compat = { version = "0.1.7", optional = true }
|
readline_rs_compat = { version = "0.1.7", optional = true }
|
||||||
ref_thread_local = "0.0.0"
|
ref_thread_local = "0.0.0"
|
||||||
|
|
||||||
|
|||||||
@@ -408,7 +408,8 @@ impl<'a, TermMarker: Allocator<'a>> CodeGenerator<TermMarker>
|
|||||||
},
|
},
|
||||||
&InlinedClauseType::IsInteger(..) =>
|
&InlinedClauseType::IsInteger(..) =>
|
||||||
match terms[0].as_ref() {
|
match terms[0].as_ref() {
|
||||||
&Term::Constant(_, Constant::Number(Number::Integer(_))) => {
|
&Term::Constant(_, Constant::CharCode(_))
|
||||||
|
| &Term::Constant(_, Constant::Number(Number::Integer(_))) => {
|
||||||
code.push(succeed!());
|
code.push(succeed!());
|
||||||
},
|
},
|
||||||
&Term::Var(ref vr, ref name) => {
|
&Term::Var(ref vr, ref name) => {
|
||||||
|
|||||||
@@ -536,16 +536,15 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter>
|
|||||||
|
|
||||||
fn print_atom(&mut self, atom: &ClauseName) {
|
fn print_atom(&mut self, atom: &ClauseName) {
|
||||||
push_space_if_amb!(self, atom.as_str(), {
|
push_space_if_amb!(self, atom.as_str(), {
|
||||||
match atom.as_str() {
|
self.print_op_addendum(atom.as_str());
|
||||||
"''" => self.append_str("''"),
|
|
||||||
s => self.print_op_addendum(s)
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_op_addendum(&mut self, atom: &str) {
|
fn print_op_addendum(&mut self, atom: &str) {
|
||||||
if !self.quoted || non_quoted_token(atom.chars()) {
|
if !self.quoted || non_quoted_token(atom.chars()) {
|
||||||
self.append_str(atom);
|
self.append_str(atom);
|
||||||
|
} else if atom == "''" {
|
||||||
|
self.append_str("''");
|
||||||
} else {
|
} else {
|
||||||
if self.quoted {
|
if self.quoted {
|
||||||
self.push_char('\'');
|
self.push_char('\'');
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
:- op(400, yfx, /).
|
:- op(400, yfx, /).
|
||||||
|
|
||||||
:- module(builtins, [(=)/2, (\=)/2, (\+)/1, (+)/1, (+)/2, (**)/2,
|
:- module(builtins, [(=)/2, (\=)/2, (\+)/1, (^)/2, (\)/1, (+)/1,
|
||||||
(*)/2, (-)/1, (-)/2, (/)/2, (/\)/2, (\/)/2, (is)/2, (xor)/2,
|
(+)/2, (**)/2, (*)/2, (-)/1, (-)/2, (/)/2, (/\)/2, (\/)/2,
|
||||||
(div)/2, (//)/2, (rdiv)/2, (<<)/2, (>>)/2, (mod)/2, (rem)/2,
|
(is)/2, (xor)/2, (div)/2, (//)/2, (rdiv)/2, (<<)/2, (>>)/2,
|
||||||
(>)/2, (<)/2, (=\=)/2, (=:=)/2, (>=)/2, (=<)/2, (,)/2, (->)/2,
|
(mod)/2, (rem)/2, (>)/2, (<)/2, (=\=)/2, (=:=)/2, (>=)/2,
|
||||||
(;)/2, (=..)/2, (==)/2, (\==)/2, (@=<)/2, (@>=)/2, (@<)/2,
|
(=<)/2, (,)/2, (->)/2, (;)/2, (=..)/2, (==)/2, (\==)/2,
|
||||||
(@>)/2, (=@=)/2, (\=@=)/2, (:)/2, abolish/1, asserta/1,
|
(@=<)/2, (@>=)/2, (@<)/2, (@>)/2, (=@=)/2, (\=@=)/2, (:)/2,
|
||||||
assertz/1, bagof/3, bb_b_put/2, bb_get/2, bb_put/2,
|
abolish/1, asserta/1, assertz/1, bagof/3, bb_b_put/2,
|
||||||
call_cleanup/2, call_with_inference_limit/3, catch/3,
|
bb_get/2, bb_put/2, call_cleanup/2,
|
||||||
clause/2, current_predicate/1, current_prolog_flag/2,
|
call_with_inference_limit/3, catch/3, clause/2,
|
||||||
expand_goal/2, expand_term/2, findall/3, findall/4, halt/0,
|
current_predicate/1, current_prolog_flag/2, expand_goal/2,
|
||||||
once/1, op/3, repeat/0, retract/1, set_prolog_flag/2, setof/3,
|
expand_term/2, findall/3, findall/4, halt/0, once/1, op/3,
|
||||||
|
repeat/0, retract/1, set_prolog_flag/2, setof/3,
|
||||||
setup_call_cleanup/3, term_variables/2, throw/1, true/0,
|
setup_call_cleanup/3, term_variables/2, throw/1, true/0,
|
||||||
false/0, write/1, write_canonical/1, writeq/1, write_term/2]).
|
false/0, write/1, write_canonical/1, writeq/1, write_term/2]).
|
||||||
|
|
||||||
@@ -33,11 +34,11 @@ expand_op_list([Op | OtherOps], Pred, Spec, [(:- op(Pred, Spec, Op)) | OtherResu
|
|||||||
:- op(700, xfx, is).
|
:- op(700, xfx, is).
|
||||||
:- op(500, yfx, [+, -]).
|
:- op(500, yfx, [+, -]).
|
||||||
:- op(400, yfx, *).
|
:- op(400, yfx, *).
|
||||||
:- op(200, xfy, **).
|
:- op(200, xfy, [**, ^]).
|
||||||
:- op(500, yfx, [/\, \/, xor]).
|
:- op(500, yfx, [/\, \/, xor]).
|
||||||
:- op(400, yfx, [div, //, rdiv]).
|
:- op(400, yfx, [div, //, rdiv]).
|
||||||
:- op(400, yfx, [<<, >>, mod, rem]).
|
:- op(400, yfx, [<<, >>, mod, rem]).
|
||||||
:- op(200, fy, [+, -]).
|
:- op(200, fy, [+, -, \]).
|
||||||
|
|
||||||
% arithmetic comparison operators.
|
% arithmetic comparison operators.
|
||||||
:- op(700, xfx, [>, <, =\=, =:=, >=, =<]).
|
:- op(700, xfx, [>, <, =\=, =:=, >=, =<]).
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
:- module(dcgs, [(-->)/2, phrase/2, phrase/3]).
|
:- op(1200, xfx, -->).
|
||||||
|
|
||||||
|
:- module(dcgs, [phrase/2, phrase/3]).
|
||||||
|
|
||||||
:- use_module(library(lists), [append/3]).
|
:- use_module(library(lists), [append/3]).
|
||||||
:- use_module(library(terms)).
|
:- use_module(library(terms)).
|
||||||
|
|
||||||
:- op(1200, xfx, -->).
|
|
||||||
|
|
||||||
phrase(G, G) :-
|
phrase(G, G) :-
|
||||||
nonvar(G), G = [_|_], !.
|
nonvar(G), G = [_|_], !.
|
||||||
phrase(G, Ls0) :-
|
phrase(G, Ls0) :-
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use prolog::machine::or_stack::*;
|
|||||||
use prolog::machine::machine_errors::*;
|
use prolog::machine::machine_errors::*;
|
||||||
use prolog::machine::machine_indices::*;
|
use prolog::machine::machine_indices::*;
|
||||||
use prolog::machine::machine_state::*;
|
use prolog::machine::machine_state::*;
|
||||||
use prolog::num::{Integer, Signed, ToPrimitive, Zero};
|
use prolog::num::{Integer, Signed, ToPrimitive, One, Zero};
|
||||||
use prolog::num::bigint::{BigInt, BigUint};
|
use prolog::num::bigint::{BigInt, BigUint};
|
||||||
use prolog::num::rational::Ratio;
|
use prolog::num::rational::Ratio;
|
||||||
|
|
||||||
@@ -1913,6 +1913,13 @@ impl MachineState {
|
|||||||
|
|
||||||
match d {
|
match d {
|
||||||
Addr::Con(Constant::Number(Number::Integer(_))) => self.p += 1,
|
Addr::Con(Constant::Number(Number::Integer(_))) => self.p += 1,
|
||||||
|
Addr::Con(Constant::CharCode(_)) => self.p += 1,
|
||||||
|
Addr::Con(Constant::Number(Number::Rational(r))) =>
|
||||||
|
if r.denom() == &BigInt::one() {
|
||||||
|
self.p += 1;
|
||||||
|
} else {
|
||||||
|
self.fail = true;
|
||||||
|
},
|
||||||
_ => self.fail = true
|
_ => self.fail = true
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user