feat: initial port of muscript ast to ADT-based module
This commit is contained in:
parent
003c317b11
commit
c9347fcec0
|
@ -0,0 +1,27 @@
|
|||
import io.gitlab.jfronny.scripts.*
|
||||
|
||||
plugins {
|
||||
commons.library
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.commons)
|
||||
|
||||
testImplementation(libs.junit.jupiter.api)
|
||||
testRuntimeOnly(libs.junit.jupiter.engine)
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("maven") {
|
||||
groupId = "io.gitlab.jfronny"
|
||||
artifactId = "muscript-ast"
|
||||
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.javadoc {
|
||||
linksOffline("https://maven.frohnmeyer-wds.de/javadoc/artifacts/io/gitlab/jfronny/commons/$version/raw", projects.commons)
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package io.gitlab.jfronny.muscript.ast;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.bool.*;
|
||||
import io.gitlab.jfronny.muscript.ast.dynamic.Equals;
|
||||
import io.gitlab.jfronny.muscript.ast.extensible.ExtensibleBoolExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.number.GreaterThan;
|
||||
|
||||
public sealed interface BoolExpr extends Expr permits And, BoolAssign, BoolConditional, BoolLiteral, BoolUnpack, Not, Or, Equals, ExtensibleBoolExpr, GreaterThan {
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package io.gitlab.jfronny.muscript.ast;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.dynamic.*;
|
||||
import io.gitlab.jfronny.muscript.ast.extensible.ExtensibleDynamicExpr;
|
||||
|
||||
public sealed interface DynamicExpr extends Expr permits Bind, Closure, DynamicAssign, DynamicCoerce, DynamicConditional, DynamicLiteral, ExprGroup, Get, ListLiteral, ObjectLiteral, This, UnresolvedConditional, Variable, ExtensibleDynamicExpr {
|
||||
@Override
|
||||
default DynamicExpr asDynamic() {
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package io.gitlab.jfronny.muscript.ast;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
import io.gitlab.jfronny.muscript.ast.dynamic.DynamicCoerce;
|
||||
|
||||
public sealed interface Expr permits BoolExpr, DynamicExpr, NullLiteral, NumberExpr, StringExpr {
|
||||
ICodeLocation location();
|
||||
|
||||
default DynamicExpr asDynamic() {
|
||||
return new DynamicCoerce(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package io.gitlab.jfronny.muscript.ast;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record NullLiteral(ICodeLocation location) implements Expr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.extensible.ExtensibleNumberExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.number.*;
|
||||
|
||||
public sealed interface NumberExpr extends Expr permits ExtensibleNumberExpr, Add, Divide, Modulo, Multiply, Negate, NumberAssign, NumberConditional, NumberLiteral, NumberUnpack, Power, Subtract {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.extensible.ExtensibleStringExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.string.*;
|
||||
|
||||
public sealed interface StringExpr extends Expr permits ExtensibleStringExpr, Concatenate, StringAssign, StringCoerce, StringConditional, StringLiteral, StringUnpack {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.bool;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.BoolExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record And(ICodeLocation location, BoolExpr left, BoolExpr right) implements BoolExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.bool;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.BoolExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record BoolAssign(ICodeLocation location, String variable, BoolExpr value) implements BoolExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.bool;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.BoolExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record BoolConditional(ICodeLocation location, BoolExpr condition, BoolExpr trueCase, BoolExpr falseCase) implements BoolExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.bool;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.BoolExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record BoolLiteral(ICodeLocation location, boolean value) implements BoolExpr {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package io.gitlab.jfronny.muscript.ast.bool;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.BoolExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record BoolUnpack(DynamicExpr inner) implements BoolExpr {
|
||||
@Override
|
||||
public ICodeLocation location() {
|
||||
return inner.location();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.bool;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.BoolExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record Not(ICodeLocation location, BoolExpr inner) implements BoolExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.bool;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.BoolExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record Or(ICodeLocation location, BoolExpr left, BoolExpr right) implements BoolExpr {
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package io.gitlab.jfronny.muscript.ast.context;
|
||||
|
||||
/**
|
||||
* Represents a location in the source code.
|
||||
* To be implemented by the parser.
|
||||
*/
|
||||
public interface ICodeLocation {
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package io.gitlab.jfronny.muscript.ast.context;
|
||||
|
||||
/**
|
||||
* Represents a Dynamic in the source code.
|
||||
* To be implemented by the parser.
|
||||
*/
|
||||
public interface IDynamic {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record Bind(ICodeLocation location, DynamicExpr callable, DynamicExpr parameter) implements DynamicExpr {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record Call(DynamicExpr left, List<Arg> args) {
|
||||
record Arg(DynamicExpr value, boolean variadic) {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.Expr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public record Closure(ICodeLocation location, List<String> boundArgs, boolean variadic, List<Expr> steps, DynamicExpr finish) implements DynamicExpr {
|
||||
public Closure(ICodeLocation location, List<String> boundArgs, boolean variadic, List<Expr> expressions) {
|
||||
//TODO use static methods before constructor once available
|
||||
this(location, boundArgs, variadic, expressions.subList(0, expressions.size() - 1), expressions.getLast().asDynamic());
|
||||
}
|
||||
|
||||
public Stream<Expr> stream() {
|
||||
return Stream.concat(steps.stream(), Stream.of(finish));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record DynamicAssign(ICodeLocation location, String variable, DynamicExpr value) implements DynamicExpr {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.Expr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record DynamicCoerce(Expr inner) implements DynamicExpr {
|
||||
@Override
|
||||
public ICodeLocation location() {
|
||||
return inner.location();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.BoolExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.Expr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record DynamicConditional(ICodeLocation location, BoolExpr condition, DynamicExpr trueCase, DynamicExpr falseCase) implements DynamicExpr {
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
import io.gitlab.jfronny.muscript.ast.context.IDynamic;
|
||||
|
||||
public record DynamicLiteral(ICodeLocation location, IDynamic content) implements DynamicExpr {
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.BoolExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.Expr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record Equals(ICodeLocation location, Expr left, Expr right) implements BoolExpr {
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.Expr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record ExprGroup(ICodeLocation location, List<Expr> steps, DynamicExpr finish, @Nullable PackedArgs packedArgs, boolean fork) implements DynamicExpr {
|
||||
public ExprGroup(ICodeLocation location, List<Expr> expressions, @Nullable PackedArgs packedArgs, boolean fork) {
|
||||
this(location, expressions.subList(0, expressions.size() - 1), expressions.getLast().asDynamic(), packedArgs, fork);
|
||||
}
|
||||
|
||||
public record PackedArgs(List<Call.Arg> from, List<String> to, boolean variadic) {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.Expr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record Get(ICodeLocation location, DynamicExpr left, Expr name) implements DynamicExpr {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record ListLiteral(ICodeLocation location, List<DynamicExpr> elements) implements DynamicExpr {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public record ObjectLiteral(ICodeLocation location, Map<String, DynamicExpr> content) implements DynamicExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record This(ICodeLocation location) implements DynamicExpr {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.BoolExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.Expr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record UnresolvedConditional(ICodeLocation location, BoolExpr condition, Expr trueCase, Expr falseCase) implements DynamicExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record Variable(ICodeLocation location, String name) implements DynamicExpr {
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package io.gitlab.jfronny.muscript.ast.extensible;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.BoolExpr;
|
||||
|
||||
public non-sealed interface ExtensibleBoolExpr extends BoolExpr {
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package io.gitlab.jfronny.muscript.ast.extensible;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
|
||||
public non-sealed interface ExtensibleDynamicExpr extends DynamicExpr {
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package io.gitlab.jfronny.muscript.ast.extensible;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.NumberExpr;
|
||||
|
||||
public non-sealed interface ExtensibleNumberExpr extends NumberExpr {
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package io.gitlab.jfronny.muscript.ast.extensible;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.StringExpr;
|
||||
|
||||
public non-sealed interface ExtensibleStringExpr extends StringExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.number;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
import io.gitlab.jfronny.muscript.ast.NumberExpr;
|
||||
|
||||
public record Add(ICodeLocation location, NumberExpr augend, NumberExpr addend) implements NumberExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.number;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
import io.gitlab.jfronny.muscript.ast.NumberExpr;
|
||||
|
||||
public record Divide(ICodeLocation location, NumberExpr dividend, NumberExpr divisor) implements NumberExpr {
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package io.gitlab.jfronny.muscript.ast.number;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.BoolExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.NumberExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record GreaterThan(ICodeLocation location, NumberExpr left, NumberExpr right) implements BoolExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.number;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
import io.gitlab.jfronny.muscript.ast.NumberExpr;
|
||||
|
||||
public record Modulo(ICodeLocation location, NumberExpr dividend, NumberExpr divisor) implements NumberExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.number;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
import io.gitlab.jfronny.muscript.ast.NumberExpr;
|
||||
|
||||
public record Multiply(ICodeLocation location, NumberExpr multiplier, NumberExpr multiplicand) implements NumberExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.number;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
import io.gitlab.jfronny.muscript.ast.NumberExpr;
|
||||
|
||||
public record Negate(ICodeLocation location, NumberExpr inner) implements NumberExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.number;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.NumberExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record NumberAssign(ICodeLocation location, String variable, NumberExpr value) implements NumberExpr {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package io.gitlab.jfronny.muscript.ast.number;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.BoolExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.Expr;
|
||||
import io.gitlab.jfronny.muscript.ast.NumberExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record NumberConditional(ICodeLocation location, BoolExpr condition, NumberExpr trueCase, NumberExpr falseCase) implements NumberExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.number;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
import io.gitlab.jfronny.muscript.ast.NumberExpr;
|
||||
|
||||
public record NumberLiteral(ICodeLocation location, double value) implements NumberExpr {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package io.gitlab.jfronny.muscript.ast.number;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.NumberExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record NumberUnpack(DynamicExpr inner) implements NumberExpr {
|
||||
@Override
|
||||
public ICodeLocation location() {
|
||||
return inner.location();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.number;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
import io.gitlab.jfronny.muscript.ast.NumberExpr;
|
||||
|
||||
public record Power(ICodeLocation location, NumberExpr base, NumberExpr exponent) implements NumberExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.number;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
import io.gitlab.jfronny.muscript.ast.NumberExpr;
|
||||
|
||||
public record Subtract(ICodeLocation location, NumberExpr minuend, NumberExpr subtrahend) implements NumberExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.string;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
import io.gitlab.jfronny.muscript.ast.StringExpr;
|
||||
|
||||
public record Concatenate(ICodeLocation location, StringExpr left, StringExpr right) implements StringExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.string;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.StringExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record StringAssign(ICodeLocation location, String variable, StringExpr value) implements StringExpr {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package io.gitlab.jfronny.muscript.ast.string;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
import io.gitlab.jfronny.muscript.ast.Expr;
|
||||
import io.gitlab.jfronny.muscript.ast.StringExpr;
|
||||
|
||||
public record StringCoerce(Expr inner) implements StringExpr {
|
||||
@Override
|
||||
public ICodeLocation location() {
|
||||
return inner.location();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package io.gitlab.jfronny.muscript.ast.string;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.BoolExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.Expr;
|
||||
import io.gitlab.jfronny.muscript.ast.NumberExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.StringExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record StringConditional(ICodeLocation location, BoolExpr condition, StringExpr trueCase, StringExpr falseCase) implements StringExpr {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package io.gitlab.jfronny.muscript.ast.string;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
import io.gitlab.jfronny.muscript.ast.StringExpr;
|
||||
|
||||
public record StringLiteral(ICodeLocation location, String value) implements StringExpr {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package io.gitlab.jfronny.muscript.ast.string;
|
||||
|
||||
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.StringExpr;
|
||||
import io.gitlab.jfronny.muscript.ast.context.ICodeLocation;
|
||||
|
||||
public record StringUnpack(DynamicExpr inner) implements StringExpr {
|
||||
@Override
|
||||
public ICodeLocation location() {
|
||||
return inner.location();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
module io.gitlab.jfronny.commons.muscript.ast {
|
||||
requires io.gitlab.jfronny.commons;
|
||||
requires static org.jetbrains.annotations;
|
||||
exports io.gitlab.jfronny.muscript.ast;
|
||||
exports io.gitlab.jfronny.muscript.ast.extensible;
|
||||
exports io.gitlab.jfronny.muscript.ast.context;
|
||||
exports io.gitlab.jfronny.muscript.ast.bool;
|
||||
exports io.gitlab.jfronny.muscript.ast.number;
|
||||
exports io.gitlab.jfronny.muscript.ast.string;
|
||||
exports io.gitlab.jfronny.muscript.ast.dynamic;
|
||||
}
|
|
@ -10,6 +10,9 @@ include("commons-http-client")
|
|||
include("commons-http-server")
|
||||
include("commons-manifold")
|
||||
include("commons-unsafe")
|
||||
// new muscript
|
||||
include("muscript-ast")
|
||||
// legacy muscript
|
||||
include("muscript")
|
||||
include("muscript-gson")
|
||||
|
||||
|
|
Loading…
Reference in New Issue