Negative numbers working
This commit is contained in:
parent
4e9d1ec760
commit
bfb580c566
@ -313,6 +313,12 @@ print_all_stored_variables([]).
|
||||
%
|
||||
% Flatten a polynomail tree into a simple polynomial
|
||||
%
|
||||
polynomial_tree_to_polynomial(op(neg, T), P1) :-
|
||||
%% If it matched on the version with a node, don't go back
|
||||
!,
|
||||
%% Delegate
|
||||
polynomial_tree_to_polynomial(T, P),
|
||||
atom_concat('-', P, P1).
|
||||
polynomial_tree_to_polynomial(op(Op, TL, TR), P) :-
|
||||
%% If it matched on the version with a node, don't go back
|
||||
!,
|
||||
@ -473,6 +479,7 @@ parse_floating_number(TN) -->
|
||||
%@ TN = op('.', 2, 4).
|
||||
%% ?- parse_floating_number(TN, [negative, two, dot, 4], _).
|
||||
%@ TN = op('.', op(neg, 2), 4).
|
||||
%@ TN = op('.', op(neg, 2), 4).
|
||||
|
||||
%% parse_positive_integer_number(-tree, +stream, -not_consumed) is det
|
||||
%
|
||||
@ -498,7 +505,7 @@ parse_integer_number(N) -->
|
||||
parse_integer_number(op(neg, T)) --> % TODO
|
||||
%% A number can start with "negative", to negate it
|
||||
[negative],
|
||||
parse_number_explicit(void, void, T).
|
||||
parse_integer_number(T).
|
||||
parse_integer_number(T) -->
|
||||
parse_number_explicit(void, void, T).
|
||||
%% Tests:
|
||||
|
Reference in New Issue
Block a user