public override void EnterTypeDefine(PlanningParser.TypeDefineContext context) { foreach (var type in context.listName().NAME()) { Domain.AddToTypeList(type.GetText()); } }
private void BuildTypeDict(PlanningParser.TypeDefineContext context) { _typeDict = new Dictionary <string, PlanningType>(); if (context != null) { _typeDict.Add(PlanningType.ObjectType.Name, PlanningType.ObjectType); _typeDict.Add(PlanningType.AgentType.Name, PlanningType.AgentType); foreach (var typeContext in context.typeDeclaration()) { PlanningType type; string name = typeContext.NAME().GetText(); if (typeContext.LB() == null) { type = new PlanningType { Name = name }; } else { int min = GetValue(typeContext.constTerm(0)); int max = GetValue(typeContext.constTerm(1)); type = new PlanningNumericType { Name = name, Min = min, Max = max }; } _typeDict.Add(name, type); } } }
private void HandleTypeDefine(PlanningParser.TypeDefineContext context) { //foreach (var typeContext in context.typeDeclaration()) //{ // PlanningType type; // if (typeContext.LB() == null) // { // type = new PlanningType {Name = typeContext.GetText()}; // } // else // { // string name = typeContext.GetText(); // int min = int.Parse(typeContext.constTerm(0).GetText()); // int max = int.Parse(typeContext.constTerm(1).GetText()); // type = new PlanningNumericType {Name = name, Min = min, Max = max}; // } // _typeList.Add(type); //} }
public TermInterpreter(PlanningParser.NumericSettingContext numericSettingContext, PlanningParser.TypeDefineContext typeDefineContext, PlanningParser.ObjectDeclarationContext objDecContext) { BuildNumericConst(numericSettingContext); BuildTypeDict(typeDefineContext); BuildConstTypeMap(objDecContext); }
/// <summary> /// Exit a parse tree produced by <see cref="PlanningParser.typeDefine"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitTypeDefine([NotNull] PlanningParser.TypeDefineContext context) { }