Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[nrx] fix non-regex build aspects (TESTS NOW BROKEN)
  • Loading branch information
sorear committed Sep 4, 2010
1 parent 76cd7d9 commit 568bfa6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 29 deletions.
13 changes: 8 additions & 5 deletions lib/Cursor.cs
Expand Up @@ -37,14 +37,14 @@ public struct State {
// cache of orig.Length
public int end;

public RxFrame(DynObject csr) {
Cursor c = (Cursor) Kernel.UnboxDO(csr);
orig = c.backing.ToCharArray();
public RxFrame(Cursor csr) {
orig = csr.backing_ca;
orig_s = csr.backing;
end = orig.Length;
bt = new PSN<State>(default(State), null);
bt.obj.klasses = new PSN<DynMetaObject>(csr.klass, null);
bt.obj.xact = new XAct("MATCH", null);
bt.obj.pos = c.pos;
bt.obj.xact = new XAct("MATCH", csr.xact);
bt.obj.pos = csr.pos;
}

public Frame Backtrack(Frame th) {
Expand Down Expand Up @@ -179,6 +179,9 @@ public class Cursor : IP6 {
public char[] backing_ca;
public int pos;

public Cursor(IP6 proto, string text)
: this(proto.GetMO(), null, text, text.ToCharArray(), 0) { }

public Cursor(DynMetaObject klass, XAct xact, string backing, char[] backing_ca, int pos) {
this.klass = klass;
this.xact = xact;
Expand Down
25 changes: 8 additions & 17 deletions lib/SAFE.setting
Expand Up @@ -870,25 +870,16 @@ sub take($p) { # should be \|$p
}
my class Cursor {
method new($str) { Q:CgOp { (box (@ (l self)) (rawnew Cursor (unbox String
(@ (l $str))))) } }
method new($str) { Q:CgOp { (ns (rawnew Cursor
(@ {self}) (unbox System.String (@ {$str})))) } }
method pos { Q:CgOp { (box Num (cast Double (getfield pos
(unbox Cursor (@ (l self)))))) } }
method cursor($np) { Q:CgOp { (box (@ (l self)) (rawcall
(unbox Cursor (@ (l self))) At
(cast Int32 (unbox Double (@ (l $np)))))) } }
(cast Cursor (@ {self}))))) } }
method cursor($np) { Q:CgOp { (ns (rawcall
(cast Cursor (@ {self})) At
(cast Int32 (unbox Double (@ {$np}))))) } }
method orig { Q:CgOp {
(box Str (getfield backing (unbox Cursor (@ (l self))))) } }
method ws() {
gather
Q:CgOp {
(letn rt (rawcall (unbox Cursor (@ (l self))) SimpleWS)
[ternary
(!= (l rt) (null Cursor))
(subcall (@ (l &take)) (box (@ (l self)) (l rt)))
(null Variable)])
};
}
(box Str (getfield backing (cast Cursor (@ {self})))) } }
method ws() { Q:CgOp { (rawcall (cast Cursor (@ {self})) SimpleWS) } }
}
PRE-INIT {
Expand Down
8 changes: 1 addition & 7 deletions src/CodeGen.pm
Expand Up @@ -63,15 +63,9 @@ use 5.010;
{ SearchForHandler => [c => 'Void'] },
'Cursor' =>
{ At => [m => 'Cursor'],
Exact => [m => 'Cursor'],
AnyChar => [m => 'Cursor'],
CClass => [m => 'Cursor'],
pos => [f => 'Int32'],
backing => [f => 'String'],
captures => [f => 'Matched'],
SetCaps => [m => 'Cursor'],
SimpleWS => [m => 'Cursor'],
Bind => [m => 'Cursor'] },
SimpleWS => [m => 'Variable'] },
'Lexer' =>
{ Run => [m => 'Int32[]'] },
Expand Down

0 comments on commit 568bfa6

Please sign in to comment.