diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-07-20 17:21:15 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-07-20 17:21:15 +0100 |
| commit | ea911841f3b5d8601f7ff9234e5bca442d58925b (patch) | |
| tree | 29c6a83fddcf602f54187a9dd11ecad918f8f93a /src/main/java | |
| parent | b566789e4dd17ab81fc73917d24cb9bf2a678707 (diff) | |
Add Patio bool type
Diffstat (limited to 'src/main/java')
4 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java b/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java index 3b7e6a7b..850c2fcc 100644 --- a/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java +++ b/src/main/java/org/shedlang/compiler/patio/ast/PatioSerializer.java @@ -206,6 +206,9 @@ public class PatioSerializer { private static Tree typeToTree(PatioType type) { return switch (type) { + case PatioBoolType boolType -> + treeIdentifier("bool"); + case PatioDataPointerType dataPointerType -> treeIdentifier("data-ptr"); diff --git a/src/main/java/org/shedlang/compiler/patio/ast/types/PatioBoolType.java b/src/main/java/org/shedlang/compiler/patio/ast/types/PatioBoolType.java new file mode 100644 index 00000000..3415335d --- /dev/null +++ b/src/main/java/org/shedlang/compiler/patio/ast/types/PatioBoolType.java @@ -0,0 +1,5 @@ +package org.shedlang.compiler.patio.ast.types; + +public record PatioBoolType() implements PatioType { + static final PatioBoolType INSTANCE = new PatioBoolType(); +} diff --git a/src/main/java/org/shedlang/compiler/patio/ast/types/PatioType.java b/src/main/java/org/shedlang/compiler/patio/ast/types/PatioType.java index 69b07faf..fe90466f 100644 --- a/src/main/java/org/shedlang/compiler/patio/ast/types/PatioType.java +++ b/src/main/java/org/shedlang/compiler/patio/ast/types/PatioType.java @@ -1,4 +1,4 @@ package org.shedlang.compiler.patio.ast.types; -public sealed interface PatioType permits PatioDataPointerType, PatioFunctionPointerType, PatioIntType, PatioVoidType { +public sealed interface PatioType permits PatioBoolType, PatioDataPointerType, PatioFunctionPointerType, PatioIntType, PatioVoidType { } diff --git a/src/main/java/org/shedlang/compiler/patio/ast/types/PatioTypes.java b/src/main/java/org/shedlang/compiler/patio/ast/types/PatioTypes.java index 95e07fbf..8e53c095 100644 --- a/src/main/java/org/shedlang/compiler/patio/ast/types/PatioTypes.java +++ b/src/main/java/org/shedlang/compiler/patio/ast/types/PatioTypes.java @@ -6,6 +6,7 @@ public class PatioTypes { private PatioTypes() { } + public static final PatioBoolType BOOL = PatioBoolType.INSTANCE; public static final PatioDataPointerType DATA_POINTER = PatioDataPointerType.INSTANCE; public static final PatioFunctionPointerType FUNCTION_POINTER = PatioFunctionPointerType.INSTANCE; public static final PatioIntType INT = PatioIntType.INSTANCE; |
