Ejemplo n.º 1
0
        internal void GenerateVariableList(PlanningParser.ListVariableContext context)
        {
            do
            {
                if (context.VAR().Count != 0)
                {
                    string type = context.type() == null ? DefaultType : context.type().GetText();

                    foreach (var varNode in context.VAR())
                    {
                        var tuple = new Tuple <string, string>(varNode.GetText(), type);
                        _variableList.Add(tuple);
                    }
                }
                context = context.listVariable();
            } while (context != null);
        }
Ejemplo n.º 2
0
        public static IReadOnlyList <string> GetVariableNameList(this PlanningParser.ListVariableContext context)
        {
            List <string> result = new List <string>();

            do
            {
                int count = context.VAR().Count;
                if (count != 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        result.Add(context.VAR(i).GetText());
                    }
                }
                context = context.listVariable();
            } while (context != null);

            return(result);
        }
Ejemplo n.º 3
0
        public static string GetFullName(PlanningParser.ActionDefineContext context)
        {
            string        name     = context.actionSymbol().GetText();
            List <string> termList = new List <string>();

            PlanningParser.ListVariableContext listVariableContext = context.listVariable();
            do
            {
                if (listVariableContext.VAR().Count != 0)
                {
                    foreach (var varNode in listVariableContext.VAR())
                    {
                        termList.Add(varNode.GetText());
                    }
                }
                listVariableContext = listVariableContext.listVariable();
            } while (listVariableContext != null);
            return(GetFullName(name, termList));
        }
Ejemplo n.º 4
0
        public static IReadOnlyList <IList <string> > GetCollection(this PlanningParser.ListVariableContext context)
        {
            List <IList <string> > result = new List <IList <string> >();

            do
            {
                int count = context.VAR().Count;
                if (count != 0)
                {
                    string type = context.type() == null ? PlanningType.ObjectType.Name : context.type().GetText();

                    for (int i = 0; i < count; i++)
                    {
                        var constList = Globals.TermInterpreter.GetConstList(type);
                        result.Add(constList);
                    }
                }
                context = context.listVariable();
            } while (context != null);

            return(result);
        }