private bool Record() { if (recordStack.Count > 0) { switch (word) { case "[": stack.Push(FTType.StartList, recordStack.Count); recordStack.Push(RecordMode.List); break; case "]": FTList list = new FTList(); while (true) { Pop1(); if (a1.Type == FTType.StartSet) throw new FTUnexpectedSymbolException("Encountered '{' (start of WordSet) when parsing List."); if (a1.Type == FTType.StartList) break; list.Add(a1); } if ((int)a1.Value != recordStack.Count || a1.Type != FTType.StartList) throw new FTWoopsException(word); recordStack.Pop(); list.Reverse(); stack.Push(FTType.List, list); break; case "{": recordStack.Push(RecordMode.Wordset); stack.Push(FTType.StartSet, recordStack.Count); break; case "}": FTWordSet cmds = new FTWordSet(); while (true) { Pop1(); if (a1.Type == FTType.StartList) throw new FTUnexpectedSymbolException("Encountered '[' (start of List) when parsing WordSet."); if (a1.Type == FTType.StartSet) break; cmds.Add(a1); } if ((int)a1.Value != recordStack.Count || a1.Type != FTType.StartSet) throw new FTWoopsException(word); recordStack.Pop(); cmds.Reverse(); stack.Push(FTType.WordSet, cmds); break; default: if (recordStack.Peek() == RecordMode.List) { if (TryPushInt()) return true; else if (TryPushString()) return true; else if (TryPushNameDef()) return true; } stack.Push(FTType.Word, word); break; } return true; } return false; }
private void ExecuteWordSet(FTWordSet set) { foreach (FTObject o in set) Execute(o); }