aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/java/coffee/liz/lambda/ast/SourceCode.java
blob: c2112ad811596d876ff0185d6e1fb901c78bccbe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package coffee.liz.lambda.ast;

/**
 * Represents source code in one of the supported lambda calculus syntaxes.
 */
public sealed interface SourceCode {
    static SourceCode ofLambda(final String source) {
        return new Lambda(source);
    }

    static SourceCode ofArrow(final String source) {
        return new Arrow(source);
    }

    record Lambda(String source) implements SourceCode {
    }

    record Arrow(String source) implements SourceCode {
    }

    /**
     * Supported syntax types for {@link SourceCode}.
     */
    enum Syntax {
        LAMBDA, ARROW
    }
}