Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[nrx] Support exhaustion of match lists
  • Loading branch information
sorear committed Sep 5, 2010
1 parent ebb3662 commit 6652b77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/Cursor.cs
Expand Up @@ -63,7 +63,7 @@ public struct State {
lst.slots["items"] = Kernel.NewROScalar(obs);
lst.slots["rest"] = Kernel.NewROScalar(its);
lst.slots["flat"] = Kernel.NewROScalar(Kernel.AnyP);
th.caller.resultSlot = Kernel.NewROScalar(lst);
th.caller.resultSlot = Kernel.NewRWListVar(lst);
}

return th.caller;
Expand Down Expand Up @@ -145,7 +145,7 @@ public struct State {

public static DynMetaObject ListMO;
public static DynMetaObject LLArrayMO;
public static DynMetaObject RegexBacktrackIteratorMO;
public static DynMetaObject GatherIteratorMO;
public static IP6 EMPTYP;
public Frame End(Frame th) {
if (return_one) {
Expand All @@ -156,11 +156,11 @@ public struct State {
List<Variable> ks = new List<Variable>();
ks.Add(Kernel.NewROScalar(MakeCursor()));
obs.slots["value"] = ks;
DynObject it = new DynObject(RegexBacktrackIteratorMO);
DynObject it = new DynObject(GatherIteratorMO);
it.slots["value"] = Kernel.NewRWScalar(Kernel.AnyP);
it.slots["next"] = Kernel.NewRWScalar(Kernel.AnyP);
it.slots["valid"] = Kernel.NewRWScalar(Kernel.AnyP);
it.slots["rxframe"] = Kernel.NewRWScalar(th);
it.slots["frame"] = Kernel.NewRWScalar(th);
DynObject its = new DynObject(LLArrayMO);
List<Variable> iss = new List<Variable>();
iss.Add(Kernel.NewROScalar(it));
Expand All @@ -169,7 +169,7 @@ public struct State {
lst.slots["items"] = Kernel.NewROScalar(obs);
lst.slots["rest"] = Kernel.NewROScalar(its);
lst.slots["flat"] = Kernel.NewROScalar(Kernel.AnyP);
th.caller.resultSlot = Kernel.NewROScalar(lst);
th.caller.resultSlot = Kernel.NewRWListVar(lst);
}
return th.caller;
}
Expand Down
6 changes: 4 additions & 2 deletions test2.pl
Expand Up @@ -21,11 +21,13 @@ ($C)
(rawsset RxFrame.ListMO (getfield klass (cast DynObject (@ {List}))))
(rawsset RxFrame.LLArrayMO (getfield klass
(cast DynObject (@ {LLArray}))))
(rawsset RxFrame.GatherIteratorMO (getfield klass
(cast DynObject (@ {GatherIterator}))))
(null Variable))
}
}

ok rxt(Cursor.new("x")).Bool, "/x/ ~~ x";
ok !rxt(Cursor.new("y")).Bool, "/x/ !~ y";
is +rxt(Cursor.new("x")), 1, "/x/ ~~ x";
is +rxt(Cursor.new("y")), 0, "/x/ !~ y";

done-testing;

0 comments on commit 6652b77

Please sign in to comment.