Ejemplo n.º 1
0
        public Grammar()
        {
            Options     = RuntimeOptions.Default;

            Productions = new ProductionCollection(this);
            Symbols     = new SymbolCollection(this);
            Conditions  = new ConditionCollection(this);
            Matchers    = new MatcherCollection(this);
            Mergers     = new MergerCollection(this);
            Contexts    = new ForeignContextCollection(this);
            Reports     = new ReportCollection();
            GlobalContextProvider = new ForeignContextProvider { Owner = this.Contexts };
            Joint       = new Joint();

            for (int i = PredefinedTokens.Count; i != 0; --i)
            {
                Symbols.Add(null); // stub
            }

            Symbols[PredefinedTokens.Propagated]      = new Symbol("#");
            Symbols[PredefinedTokens.Epsilon]         = new Symbol("$eps");
            Symbols[PredefinedTokens.AugmentedStart]  = new Symbol("$start");
            Symbols[PredefinedTokens.Eoi]             = new Symbol("$")
                                          {
                                              Categories = SymbolCategory.DoNotInsert
                                                         | SymbolCategory.DoNotDelete
                                          };
            Symbols[PredefinedTokens.Error]           = new Symbol("$error");

            AugmentedProduction = Productions.Define((Symbol)Symbols[PredefinedTokens.AugmentedStart], new Symbol[] { null });
        }
Ejemplo n.º 2
0
        public void Query_many_strongly_typed_custom_collection()
        {
            ProductionCollection products = Context.Sql("select * from Product").QueryMany <Product, ProductionCollection>();

            Assert.IsTrue(products.Count > 0);
        }