summaryrefslogtreecommitdiff
path: root/Compiler.Testing/TestingHelpers.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Compiler.Testing/TestingHelpers.cs')
-rw-r--r--Compiler.Testing/TestingHelpers.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/Compiler.Testing/TestingHelpers.cs b/Compiler.Testing/TestingHelpers.cs
new file mode 100644
index 0000000..a3d85fe
--- /dev/null
+++ b/Compiler.Testing/TestingHelpers.cs
@@ -0,0 +1,14 @@
+namespace Compiler.Testing;
+
+using Antlr4.Runtime;
+using Q1.Compiler;
+
+public class TestingHelpers
+{
+ public static string CompileString(string input)
+ {
+ CompilerOptions options = new() { CommentCompilationMode = CommentCompilationMode.None };
+ IEnumerable<string> lines = Program.Compile(options, new AntlrInputStream(input));
+ return Program.Optimize(lines);
+ }
+} \ No newline at end of file