Beispiel #1
0
        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));
        }
Beispiel #2
0
 /// <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;
 }
Beispiel #3
0
 public ParserListType(char o, char c, ListBracketsType t)
 {
     OpenBrace   = o;
     ClosedBrace = c;
     Type        = t;
 }
Beispiel #4
0
 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);
 }