diff options
| author | Melodi <62381002+Melodi17@users.noreply.github.com> | 2025-08-29 07:33:48 +1000 |
|---|---|---|
| committer | Melodi <62381002+Melodi17@users.noreply.github.com> | 2025-08-29 07:33:48 +1000 |
| commit | 40473797a117e6791e94140b0f01d034bce8bbb1 (patch) | |
| tree | 553b84b0c2491343523bc7ebf91dda54080991aa /Compiler/PreprocessingCharStream.cs | |
| parent | 5d012f16b2a0200087afe9dffc906046d258b3b8 (diff) | |
some cleanup
Diffstat (limited to 'Compiler/PreprocessingCharStream.cs')
| -rw-r--r-- | Compiler/PreprocessingCharStream.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Compiler/PreprocessingCharStream.cs b/Compiler/PreprocessingCharStream.cs new file mode 100644 index 0000000..428cbff --- /dev/null +++ b/Compiler/PreprocessingCharStream.cs @@ -0,0 +1,25 @@ +namespace Q1.Compiler; + +using Antlr4.Runtime; +using Antlr4.Runtime.Misc; + +public class PreprocessingCharStream : ICharStream +{ + private readonly AntlrInputStream inner; + + public PreprocessingCharStream(string filePath) + { + string preprocessed = Preprocessor.Process(filePath); + this.inner = new AntlrInputStream(preprocessed); + } + + public int Index => this.inner.Index; + public int Size => this.inner.Size; + public string SourceName => this.inner.SourceName; + public void Consume() => this.inner.Consume(); + public int LA(int i) => this.inner.LA(i); + public int Mark() => this.inner.Mark(); + public void Release(int marker) => this.inner.Release(marker); + public void Seek(int index) => this.inner.Seek(index); + public string GetText(Interval interval) => this.inner.GetText(interval); +}
\ No newline at end of file |
