using System.Runtime.CompilerServices;
using Acornima;
using Acornima.Ast;
using Jint;
using Jint.Native;
namespace XFESystem.Browser;
///
/// Fully validates syntax, while leaving Jint's function/declaration analysis on
/// its normal first-use path. Large packages contain many unused function bodies.
/// The AST and analysis contain no realm; interpreter handlers remain engine owned.
///
internal static class PackagedScriptParser
{
// Obtain the pinned engine's own grammar and regexp adapter. Prepared scripts
// otherwise default to compiled regex and a ten-second regexp timeout.
private static readonly ParserOptions options = Engine.PrepareScript(string.Empty,
options: new ScriptPreparationOptions
{
FoldConstants = false,
ParsingOptions = new() { CompileRegex = false, RegexTimeout = TimeSpan.FromMilliseconds(100) }
}).ParserOptions! with { OnNode = null };
internal static Prepared