Commit 8e94a489 authored by Thierry Martinez's avatar Thierry Martinez

Fixed priorities for /

parent ea097da5
...@@ -9,7 +9,7 @@ test( ...@@ -9,7 +9,7 @@ test(
[Influences == [((a, b) / c -> d), (b -< c), (/ a -< a)]] [Influences == [((a, b) / c -> d), (b -< c), (/ a -< a)]]
) :- ) :-
clear_model, clear_model,
command(((a, b) / c -> d)), command((a, b / c -> d)),
command(b -< c), command(b -< c),
command(/ a -< a), command(/ a -< a),
all_items([kind: influence], Influences). all_items([kind: influence], Influences).
......
:- module( :- module(
influence_rules, influence_rules,
[ [
influence_predicate/1, % Grammars
influence/1, influence/1,
basic_influence/1, basic_influence/1,
inputs/1, inputs/1,
enumeration/1, enumeration/1,
op(1050, xfx, (->)), op(1050, xfx, (->)),
op(1050, xfx, (-<)), op(1050, xfx, (-<)),
op(1025, fx, (/)) op(1025, fx, (/)),
% Public API
influence_predicate/1,
patch_inputs/2
] ]
). ).
influence_predicate(_ for Reaction) :- :- devdoc('\\section{Grammars}').
influence_predicate(Reaction).
influence_predicate(_ -> _).
influence_predicate(_ -< _).
:- grammar(influence). :- grammar(influence).
...@@ -74,3 +72,30 @@ enumeration((A, B)) :- ...@@ -74,3 +72,30 @@ enumeration((A, B)) :-
enumeration(A) :- enumeration(A) :-
object(A). object(A).
:- devdoc('\\section{Public API}').
influence_predicate(_ for Reaction) :-
influence_predicate(Reaction).
influence_predicate(_ -> _).
influence_predicate(_ -< _).
patch_inputs((Inputs0, Inputs1), Inputs) :-
!,
patch_inputs(Inputs0, Inputs1, Inputs).
patch_inputs(Inputs, Inputs).
patch_inputs(Inputs0, (Inputs1, Inputs2), Inputs) :-
patch_inputs((Inputs0, Inputs1), Inputs2, Inputs).
patch_inputs(Inputs0, Inputs1 / Inputs2, (Inputs0, Inputs1) / Inputs2) :-
!.
patch_inputs(Inputs0, Inputs1, (Inputs0, Inputs1)).
...@@ -140,6 +140,10 @@ check_type(Grammar, Item, NewItem) :- ...@@ -140,6 +140,10 @@ check_type(Grammar, Item, NewItem) :-
Grammar = solution Grammar = solution
-> ->
patch_solution(Item, Item0) patch_solution(Item, Item0)
;
Grammar = inputs
->
patch_inputs(Item, Item0)
; ;
Item0 = Item Item0 = Item
), ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment