private ListExpression ParseListExpression(char listEndingCharacter, ListBracketsType listType) { var contents = new List <Expression>(); while (true) { SkipWhitespace(); if (EndOfFile) { throw new InvalidDataException("Unexpected EOF while parsing list expression."); } if (CurrentCharacter == listEndingCharacter) { MoveToNextCharacter(); break; } contents.Add(ParseExpression()); } return(new ListExpression(listType, contents)); }
/// <summary> /// Create new List S-Expression. /// </summary> /// <param name="t">List type (round, square or curly).</param> /// <param name="c">Expressions within list.</param> public ListExpression(ListBracketsType t, [NotNull] List <Expression> c) { Type = t; Contents = c; }
public ParserListType(char o, char c, ListBracketsType t) { OpenBrace = o; ClosedBrace = c; Type = t; }
private static void AssertList(ListExpression l, ListBracketsType type, int contentsCount) { Assert.AreNotEqual(l, null); Assert.AreEqual(l.Type, type); Assert.AreEqual(l.Contents.Count, contentsCount); }