コード例 #1
0
		public List<SpokeLine> getLines(TokenEnumerator enumerator, int tabIndex, evalInformation inf)
		{
			int lineIndex = 0;
			List<SpokeLine> lines = new List<SpokeLine>();


		top:
#if DEBUGs
			sb.AppendLine("Line " + lineIndex);
			sb.AppendLine("");
			lineIndex++;
#endif

			if (inf.CheckMacs == 0)
			{
				Console.Write(lines.LastOrDefault() == null ? "Parsing..." : PrintExpressions.getLine(lines.Last(), 0));
			}
			IToken token = enumerator.Current;

			if (token == null || token.Type == Token.EndOfCodez)
			{
				return lines;
			}

			if (token.Type == Token.NewLine)
			{
				enumerator.MoveNext();
				goto top;
			}

			if (token.Type == Token.Tab && enumerator.PeakNext().Type == Token.NewLine)
			{
				enumerator.MoveNext();
				enumerator.MoveNext();
				goto top;
			}

			if (((TokenTab)token).TabIndex < tabIndex)
			{
				enumerator.PutBack();
				return lines;
			}

			StaticMethods.Assert(((TokenTab)token).TabIndex == tabIndex, "Bad Tab");
			enumerator.MoveNext();

			if (enumerator.Current.Type == Token.NewLine)
			{
				enumerator.MoveNext();
				goto top;
			}


			CurrentItem = null;



			var s = eval(enumerator, tabIndex, new evalInformation(inf) { EatTab = false, ResetCurrentVal = true });

			if (s is SpokeLine)
			{
				lines.Add((SpokeLine)s);
			}
			else
			{
				throw new AbandonedMutexException("wat");
			}


			goto top;
		}