1
16
17 import org.as2lib.regexp.Pattern;
18 import org.as2lib.regexp.node.TreeInfo;
19 import org.as2lib.regexp.node.Not;
20 import org.as2lib.core.BasicClass;
21 import org.as2lib.env.except.Exception;
22
23
30
31 class org.as2lib.regexp.node.Node extends BasicClass {
32
33 private var next:Node;
34
35 public function Node() {
36 next = Pattern.ACCEPT;
37 }
38
39 public function dup(flag:Boolean):Node {
40 if (flag) {
41 return new Not(this);
42 } else {
43 throw new Exception("Internal error in Node dup()", this, arguments);
44 }
45 }
46
47
50 public function match(matcher:Object, i:Number, seq:String):Boolean {
51 matcher.last = i;
52 matcher.groups[0] = matcher.first;
53 matcher.groups[1] = matcher.last;
54 return true;
55 }
56
57
60 public function study(info:TreeInfo):Boolean {
61 if (next != null) {
62 return next.study(info);
63 } else {
64 return info.deterministic;
65 }
66 }
67
68 public function getNext(Void):Node {
69 return next;
70 }
71
72 public function setNext(next:Node):Void {
73 this.next = next;
74 }
75 }
76