aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-11-19 12:47:29 +0000
committerMichael Williamson <mike@zwobble.org>2023-11-19 12:47:29 +0000
commit9a89c6c410dcdced542438a955becea587a07862 (patch)
tree41d7faa06d016c73b12b6a161ee95d36a3e38377 /src/main/java
parent872ff555dc401d4b5cf3777473d955a814d43949 (diff)
Add runtime source
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/shedlang/compiler/sources/RuntimeSource.java39
-rw-r--r--src/main/java/org/shedlang/compiler/sources/Sources.java1
2 files changed, 40 insertions, 0 deletions
diff --git a/src/main/java/org/shedlang/compiler/sources/RuntimeSource.java b/src/main/java/org/shedlang/compiler/sources/RuntimeSource.java
new file mode 100644
index 00000000..83937493
--- /dev/null
+++ b/src/main/java/org/shedlang/compiler/sources/RuntimeSource.java
@@ -0,0 +1,39 @@
+package org.shedlang.compiler.sources;
+
+class RuntimeSource implements Source {
+ private RuntimeSource() {
+
+ }
+
+ static final RuntimeSource INSTANCE = new RuntimeSource();
+
+ @Override
+ public String contents() {
+ return "";
+ }
+
+ @Override
+ public String describe() {
+ return "(runtime)";
+ }
+
+ @Override
+ public Source start() {
+ return this;
+ }
+
+ @Override
+ public Source end() {
+ return this;
+ }
+
+ @Override
+ public Source at(int characterIndexStart, int characterIndexEnd) {
+ return this;
+ }
+
+ @Override
+ public Source to(Source end) {
+ return null;
+ }
+}
diff --git a/src/main/java/org/shedlang/compiler/sources/Sources.java b/src/main/java/org/shedlang/compiler/sources/Sources.java
index c815d1e0..5fb6a3b0 100644
--- a/src/main/java/org/shedlang/compiler/sources/Sources.java
+++ b/src/main/java/org/shedlang/compiler/sources/Sources.java
@@ -2,6 +2,7 @@ package org.shedlang.compiler.sources;
public class Sources {
public static Source NULL = NullSource.INSTANCE;
+ public static Source RUNTIME = RuntimeSource.INSTANCE;
public static Source file(String filename, String contents) {
return FileFragmentSource.file(filename, contents);