Esempio n. 1
0
        /// <summary>
        /// From
        /// </summary>
        /// <param name="xDerivation"></param>
        /// <returns></returns>
        public static Derivation From(XElement xDerivation)
        {
            if (xDerivation == null)
            {
                return(null);
            }
            if (xDerivation.Name != strDerivation)
            {
                return(null);
            }
            var result = new Derivation();

            result.Left  = ProductionNode.From(xDerivation.Element(strLeft));
            result.Right = ProductionNodeList.From(xDerivation.Element(strRight));
            return(result);
        }
        /// <summary>
        /// From
        /// </summary>
        /// <param name="xContextfreeProduction"></param>
        /// <returns></returns>
        public static ContextfreeProduction From(XElement xContextfreeProduction)
        {
            if (xContextfreeProduction == null)
            {
                return(null);
            }
            if (xContextfreeProduction.Name != strContextfreeProduction)
            {
                return(null);
            }
            var result = new ContextfreeProduction();

            result.Left            = ProductionNode.From(xContextfreeProduction.Element(ProductionNode.strProductionNode));
            result.RightCollection = RightSection.From(xContextfreeProduction.Element(RightSection.strRightSection));
            return(result);
        }