Beispiel #1
0
        public void DictionaryNested()
        {
            Tokenizer t = new Tokenizer(StringToStream("<<<<>><<>>>>"));

            TokenDictionaryOpen n1 = t.GetToken() as TokenDictionaryOpen;

            Assert.NotNull(n1);
            Assert.True(n1 is TokenDictionaryOpen);

            n1 = t.GetToken() as TokenDictionaryOpen;
            Assert.NotNull(n1);
            Assert.True(n1 is TokenDictionaryOpen);

            TokenDictionaryClose n2 = t.GetToken() as TokenDictionaryClose;

            Assert.NotNull(n2);
            Assert.True(n2 is TokenDictionaryClose);

            n1 = t.GetToken() as TokenDictionaryOpen;
            Assert.NotNull(n1);
            Assert.True(n1 is TokenDictionaryOpen);

            n2 = t.GetToken() as TokenDictionaryClose;
            Assert.NotNull(n2);
            Assert.True(n2 is TokenDictionaryClose);

            n2 = t.GetToken() as TokenDictionaryClose;
            Assert.NotNull(n2);
            Assert.True(n2 is TokenDictionaryClose);
            Assert.True(t.GetToken() is TokenEmpty);
        }
Beispiel #2
0
        public void DictionaryOpen()
        {
            Tokenizer           t = new Tokenizer(StringToStream("<<"));
            TokenDictionaryOpen n = t.GetToken() as TokenDictionaryOpen;

            Assert.NotNull(n);
            Assert.True(n is TokenDictionaryOpen);
            Assert.True(t.GetToken() is TokenEmpty);
        }
Beispiel #3
0
        public void OneOfEachSpaced()
        {
            Tokenizer t = new Tokenizer(StringToStream(" [  <64 65> << true  /Name  1  3.14 >> ] %comment"));

            t.IgnoreComments = false;

            TokenArrayOpen a1 = t.GetToken() as TokenArrayOpen;

            Assert.NotNull(a1);

            TokenStringHex a2 = t.GetToken() as TokenStringHex;

            Assert.NotNull(a2);
            Assert.True(a2.Raw == "64 65");

            TokenDictionaryOpen a3 = t.GetToken() as TokenDictionaryOpen;

            Assert.NotNull(a3);

            TokenKeyword a4 = t.GetToken() as TokenKeyword;

            Assert.NotNull(a4);
            Assert.True(a4.Value == ParseKeyword.True);

            TokenName a5 = t.GetToken() as TokenName;

            Assert.NotNull(a5);
            Assert.True(a5.Value == "Name");

            TokenInteger a6 = t.GetToken() as TokenInteger;

            Assert.NotNull(a6);
            Assert.True(a6.Value == 1);

            TokenReal a7 = t.GetToken() as TokenReal;

            Assert.NotNull(a7);
            Assert.True(a7.Value == 3.14f);

            TokenDictionaryClose a8 = t.GetToken() as TokenDictionaryClose;

            Assert.NotNull(a8);

            TokenArrayClose a9 = t.GetToken() as TokenArrayClose;

            Assert.NotNull(a9);

            TokenComment a10 = t.GetToken() as TokenComment;

            Assert.NotNull(a10);
            Assert.True(a10.Value == "%comment");
            Assert.True(t.GetToken() is TokenEmpty);
        }