public override Page VisitPage(QLSParser.PageContext context)
        {
            var id            = new Identifier(context.ID().GetText(), context.GetTextPosition());
            var sections      = new List <Section>();
            var defaultStyles = new List <DefaultStyle>();

            foreach (var sectionContext in context.section())
            {
                sections.Add(sectionContext.Accept(new SectionBuilder()));
            }
            foreach (var defaultStyleContext in context.default_style())
            {
                defaultStyles.Add(defaultStyleContext.Accept(new DefaultStyleBuilder()));
            }

            return(new Page(id, sections, defaultStyles, context.GetTextPosition()));
        }
Пример #2
0
        public override INode VisitPage([NotNull] QLSParser.PageContext context)
        {
            var name          = context.Identifier().GetText();
            var sections      = context.section();
            var defaultStyles = context.defaultStyle();
            var page          = new Page(name);

            foreach (var section in sections)
            {
                page.AddSection((dynamic)section.Accept(this));
            }

            foreach (var style in defaultStyles)
            {
                page.AddDefaultStyle((dynamic)style.Accept(this));
            }

            return(page);
        }