12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- // $Id$
- namespace Lisp
- {
- public sealed class LispIterator {
- private List IterList;
- private int Pos;
- private string ChildKey;
- private List ChildList;
- public string Key {
- get {
- return ChildKey;
- }
- }
- public List List {
- get {
- return ChildList;
- }
- }
- public LispIterator(List List) {
- IterList = List;
- }
- public bool MoveNext() {
- List list;
- do {
- if(Pos >= IterList.Length)
- return false;
- object o = IterList[Pos++];
- if(! (o is List))
- continue;
- list = (List) o;
- if(list.Length == 0 || ! (list[0] is Symbol))
- continue;
- break;
- } while(true);
- ChildKey = ((Symbol) list[0]).Name;
- ChildList = list;
- return true;
- }
- }
- }
|