Exemplo n.º 1
0
        public void CreateDataset()
        {
            SubrDotNew snew = new SubrDotNew("System.Data.DataSet");

            var result = snew.Execute(null, null);

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(System.Data.DataSet));
        }
Exemplo n.º 2
0
        public void CreateFileInfo()
        {
            SubrDotNew snew = new SubrDotNew("System.IO.FileInfo");
            var        list = List.Create(new string[] { "foo.txt" });

            var result = snew.Execute(list, null);

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(System.IO.FileInfo));
        }
Exemplo n.º 3
0
        private List CompileList()
        {
            if (this.NextTokenIs(TokenType.Separator, ')'))
            {
                return(null);
            }

            object first = this.CompileTerm();

            if (first is Identifier)
            {
                var id = (Identifier)first;

                if (id.Name.Length > 1)
                {
                    if (id.Name.EndsWith("."))
                    {
                        first = new SubrDotNew(id.Name.Substring(0, id.Name.Length - 1));
                    }
                    else if (id.Name.StartsWith("."))
                    {
                        first = new SubrDotInvoke(id.Name.Substring(1));
                    }
                }
            }

            object rest;

            if (this.NextTokenIs(TokenType.Name, "."))
            {
                rest = this.CompileTerm();
                this.ParseNextToken(TokenType.Separator, ')');
            }
            else
            {
                rest = this.CompileList();
            }

            List list = new List(first, rest);

            return(list);
        }