// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Linq; namespace Microsoft.AspNetCore.Razor.Language { public abstract class RazorParserOptions { public static RazorParserOptions Create(IEnumerable directives, bool designTime) { if (directives == null) { throw new ArgumentNullException(nameof(directives)); } return new DefaultRazorParserOptions(directives.ToArray(), designTime, parseOnlyLeadingDirectives: false); } public static RazorParserOptions Create(IEnumerable directives, bool designTime, bool parseOnlyLeadingDirectives) { if (directives == null) { throw new ArgumentNullException(nameof(directives)); } return new DefaultRazorParserOptions(directives.ToArray(), designTime, parseOnlyLeadingDirectives); } public static RazorParserOptions CreateDefault() { return new DefaultRazorParserOptions(Array.Empty(), designTime: false, parseOnlyLeadingDirectives: false); } public abstract bool DesignTime { get; } public abstract IReadOnlyCollection Directives { get; } /// /// Gets a value which indicates whether the parser will parse only the leading directives. If true /// the parser will halt at the first HTML content or C# code block. If false the whole document is parsed. /// /// /// Currently setting this option to true will result in only the first line of directives being parsed. /// In a future release this may be updated to include all leading directive content. /// public abstract bool ParseOnlyLeadingDirectives { get; } } }