From 573e708c37a5b84599f05b269e336225b1c3d0f3 Mon Sep 17 00:00:00 2001 From: Adam Simon Date: Tue, 2 Apr 2024 18:51:41 +0200 Subject: [PATCH] Expose input parameters as public properties in Tokenizer and Parser --- src/Acornima/Parser.cs | 2 ++ src/Acornima/Tokenizer.cs | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/Acornima/Parser.cs b/src/Acornima/Parser.cs index 0df4bf7..fdd8278 100644 --- a/src/Acornima/Parser.cs +++ b/src/Acornima/Parser.cs @@ -26,6 +26,8 @@ public Parser(ParserOptions options) _isReservedWord = _isReservedWordBind = null!; } + public ParserOptions Options => _options; + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Script ParseScript(string input, string? sourceFile = null, bool strict = false) { diff --git a/src/Acornima/Tokenizer.cs b/src/Acornima/Tokenizer.cs index 6e4a8e8..d30c490 100644 --- a/src/Acornima/Tokenizer.cs +++ b/src/Acornima/Tokenizer.cs @@ -42,6 +42,13 @@ public Tokenizer(string input, int start, int length, SourceType sourceType, str Reset(input, start, length, sourceType, sourceFile); } + public string Input => _input; + public Range Range => new Range(_startPosition, _endPosition); + public SourceType SourceType => _sourceType; + public string? SourceFile => _sourceFile; + + public TokenizerOptions Options => _options; + public Token Current { [MethodImpl(MethodImplOptions.AggressiveInlining)]