예제 #1
0
        /// <summary>
        /// "Base Layer.Alpaca" や、"Base Layer.Alpaca.Bear" などがOK。
        ///
        /// ステートマシン名は無いこともある。
        /// </summary>
        /// <param name="query"></param>
        /// <param name="ref_caret"></param>
        /// <param name="maxFt"></param>
        /// <returns></returns>
        public static bool Fixed_LayerName_And_StatemachineNames_And_StateName(string query, ref int ref_caret, ref FullpathTokens maxFt)
        {
            FullpathTokens ft    = new FullpathTokens("LayerName_And_StatemachineNames_And_StateName");
            int            caret = ref_caret;
            string         layerNameEndsWithoutDot;
            List <string>  statemachineNamesEndsWithoutDot;
            string         stateName;

            if (!FullpathLexcalP.VarLayerName(query, ref caret, out layerNameEndsWithoutDot))
            {
                return(NotMatched(maxFt, caret, ref maxFt));
            }
            ft.LayerNameEndsWithoutDot = layerNameEndsWithoutDot;

            // ステートマシン名はオプション。
            if (FullpathLexcalP.VarStatemachineNames(query, ref caret, out statemachineNamesEndsWithoutDot))
            {
                ft.StatemachineNamesEndsWithoutDot = statemachineNamesEndsWithoutDot;
            }

            if (!FullpathLexcalP.VarStateName(query, ref caret, out stateName))
            {
                return(NotMatched(maxFt, caret, ref maxFt));
            }
            ft.StateName = stateName;

            maxFt = ft; ref_caret = caret; return(true);
        }
        public void N80_Lexical_VarLayerName()
        {
            string query = "Base Layer.Alpaca.Bear.Cat";
            int    caret = 0;
            string layerNameEndsWithoutDot;

            bool successful = FullpathLexcalP.VarLayerName(query, ref caret, out layerNameEndsWithoutDot);

            Assert.IsTrue(successful);
            Assert.AreEqual(11, caret);
            Assert.AreEqual("Base Layer", layerNameEndsWithoutDot);
        }
        public void N80_Lexical_VarStateName()
        {
            string query = "Base Layer.Alpaca.Bear.Cat";
            // "Base Layer.Alpaca.Bear." まで走査した続きから。
            int    caret = "Base Layer.Alpaca.Bear.".Length;
            string stateName;

            bool successful = FullpathLexcalP.VarStateName(query, ref caret, out stateName);

            Assert.IsTrue(successful);
            // "Cat" の次。
            Assert.AreEqual(26, caret);
            Assert.AreEqual("Cat", stateName);
        }
예제 #4
0
        /// <summary>
        /// ドット(.) または文末までがレイヤー名。
        ///
        /// (FIXME: 実際はレイヤー名にはドットを含むことができるが、運用で避けるものとする)
        /// </summary>
        /// <param name="query"></param>
        /// <param name="caret"></param>
        /// <returns></returns>
        public static bool Fixed_LayerName(string query, ref int ref_caret, ref FullpathTokens maxFt)
        {
            FullpathTokens ft    = new FullpathTokens("LayerName");
            int            caret = ref_caret;
            string         layerNameEndsWithoutDot;

            if (!FullpathLexcalP.VarLayerName(query, ref caret, out layerNameEndsWithoutDot))
            {
                return(NotMatched(maxFt, caret, ref maxFt));
            }
            ft.LayerNameEndsWithoutDot = layerNameEndsWithoutDot;

            maxFt = ft; ref_caret = caret; return(true);
        }
예제 #5
0
        /// <summary>
        /// "Base Layer.Alpaca" や、"Base Layer.Alpaca.Bear" などがOK。
        ///
        /// ステートマシン名は無いこともある。
        /// </summary>
        /// <param name="query"></param>
        /// <param name="ref_caret"></param>
        /// <param name="maxFt"></param>
        /// <returns></returns>
        public static bool Continued_Fixed_StateName(string query, ref int ref_caret, FullpathTokens baseFt, ref FullpathTokens maxFt)
        {
            // クローンし、追加していく。
            FullpathTokens ft    = new FullpathTokens(baseFt);
            int            caret = ref_caret;
            string         stateName;

            if (!FullpathLexcalP.VarStateName(query, ref caret, out stateName))
            {
                return(NotMatched(maxFt, caret, ref maxFt));
            }
            ft.StateName = stateName;

            maxFt = ft; ref_caret = caret; return(true);
        }
        public void N80_Lexical_VarStatemachineNames()
        {
            string query = "Base Layer.Alpaca.Bear.Cat";
            // "Base Layer." まで走査した続きから。
            int           caret = "Base Layer.".Length;
            List <string> statemachinesNameEndsWithoutDot;

            bool successful = FullpathLexcalP.VarStatemachineNames(query, ref caret, out statemachinesNameEndsWithoutDot);

            Assert.IsTrue(successful);
            // "~Bear." の次。
            Assert.AreEqual(23, caret);
            Assert.AreEqual(2, statemachinesNameEndsWithoutDot.Count);
            Assert.AreEqual("Alpaca", statemachinesNameEndsWithoutDot[0]);
            Assert.AreEqual("Bear", statemachinesNameEndsWithoutDot[1]);
        }