コード例 #1
0
        public static string getParsedBehavior(string behavior)
        {
            BehaviorParser       parser    = new BehaviorParser();
            List <BehaviorChunk> chunkList = parser.parseBehavior(behavior);

            StringWriter outsw = new StringWriter();

            foreach (var bc in chunkList)
            {
                if (bc.behaviorToken != null)
                {
                    outsw.WriteLine(generateIndentStr(bc.indLv) + bc.getTokenRepresented());
                }
                else
                {
                    outsw.WriteLine(generateIndentStr(bc.indLv) + bc.behavior);
                }
            }

            return(outsw.ToString());
        }
コード例 #2
0
        public static string translateBehavior(string behavior)
        {
            BehaviorParser       parser    = new BehaviorParser();
            List <BehaviorChunk> chunkList = parser.parseBehavior(behavior);

            StringWriter outsw = new StringWriter();

            foreach (var bc in chunkList)
            {
                //
                if (bc.dottedNum != null && bc.dottedNum != "")
                {
                    outsw.WriteLine(generateIndentStr(bc.indLv) + "// " + bc.dottedNum + " " + bc.behavior);
                }
                else
                {
                    outsw.WriteLine(generateIndentStr(bc.indLv) + "// " + bc.behavior);
                }

                outsw.WriteLine(generateIndentStr(bc.indLv) + bc.getTokenRepresented());
            }

            return(outsw.ToString());
        }