Ejemplo n.º 1
0
        public static CompilerResult Compile(Context context, IEnumerable <Element> elements)
        {
            var state = new CompilerState(context);

            state.Issues.CollectionChanged += (_, e) => IssuesChanged(context.Logger, e);

            foreach (var element in elements)
            {
                Execute(state, element);
            }

            state.Document.Elements.AddRange(state.Blocks.Current.Objects.Select(e => e.Value).OfType <DocumentElement>());

            ResolveCallbacks(state.Document.Elements);

            var result = new CompilerResult(state.Document, state.Issues);

            return(result);
        }
Ejemplo n.º 2
0
        public static CompilerResult Compile(Context context, IEnumerable <SyntaxNode> elements)
        {
            var state = new CompilerState(context);

            state.Issues.CollectionChanged += (_, e) => IssuesChanged(context.Logger, e);

            foreach (var element in elements)
            {
                if (state.Continue)
                {
                    state.Document.Elements.AddRange(Execute(state, element));
                }
            }

            ResolveCallbacks(state.Document.Elements);

            var result = new CompilerResult(state.Document, state.Issues);

            return(result);
        }