Ejemplo n.º 1
0
        public override void ExitGenericModel([NotNull] GenericModelContext context)
        {
            var list = new List <Models.IModelObject>();

            foreach (var item in context._smodels)
            {
                var sm = SingleModels.Get(item);
                list.Add(sm);
            }

            var TopLevelModel = new Models.SingleModel("@" + context.ID().GetText(), list)
            {
                Path = path.GetPath()
            };

            // check for doubles
            var existing = Collector.SingleModels.FirstOrDefault(p => p.Name == TopLevelModel.Name);

            if (existing != null)
            {
                existing.Value.AddRange(TopLevelModel.Value);
            }
            else
            {
                Collector.SingleModels.Add(TopLevelModel);
            }
            GraphElements.Add(TopLevelModel.Path, new GraphElement(TopLevelModel.Path, TopLevelModel));
            path.Pop();

            base.ExitGenericModel(context);
        }
Ejemplo n.º 2
0
        public override void EnterGenericModel([NotNull] GenericModelContext context)
        {
            var CurrentSection = "@" + context.ID().GetText();

            logger.Trace("Enter Section = {0}", CurrentSection);
            path.Push(CurrentSection);
        }