Package net.hydromatic.morel.ast
Enum AstBuilder
- java.lang.Object
-
- java.lang.Enum<AstBuilder>
-
- net.hydromatic.morel.ast.AstBuilder
-
- All Implemented Interfaces:
Serializable,Comparable<AstBuilder>
public enum AstBuilder extends Enum<AstBuilder>
Builds parse tree nodes.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description astThe singleton instance of the AST builder.
-
Constructor Summary
Constructors Modifier Constructor Description privateAstBuilder()
-
Method Summary
-
-
-
Enum Constant Detail
-
ast
public static final AstBuilder ast
The singleton instance of the AST builder. The short name is convenient for use via 'import static', but checkstyle does not approve.
-
-
Method Detail
-
values
public static AstBuilder[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (AstBuilder c : AstBuilder.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static AstBuilder valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
infix
private Ast.InfixCall infix(Op op, Ast.Exp a0, Ast.Exp a1)
Creates a call to an infix operator.
-
prefixCall
public Ast.PrefixCall prefixCall(Pos p, Op op, Ast.Exp a)
Creates a call to a prefix operator.
-
boolLiteral
public Ast.Literal boolLiteral(Pos p, boolean b)
Creates abooleanliteral.
-
charLiteral
public Ast.Literal charLiteral(Pos p, char c)
Creates acharliteral.
-
intLiteral
public Ast.Literal intLiteral(Pos pos, BigDecimal value)
Creates anintliteral.
-
realLiteral
public Ast.Literal realLiteral(Pos pos, BigDecimal value)
Creates afloatliteral.
-
realLiteral
public Ast.Literal realLiteral(Pos pos, Float value)
Creates afloatliteral for a special IEEE floating point value: NaN, negative zero, positive and negative infinity.
-
stringLiteral
public Ast.Literal stringLiteral(Pos pos, String value)
Creates a string literal.
-
unitLiteral
public Ast.Literal unitLiteral(Pos p)
Creates a unit literal.
-
recordType
public Ast.RecordType recordType(Pos pos, Map<String,Ast.Type> fieldTypes)
-
recordSelector
public Ast.RecordSelector recordSelector(Pos pos, String name)
-
literalPat
public Ast.LiteralPat literalPat(Pos pos, Op op, Comparable value)
-
wildcardPat
public Ast.WildcardPat wildcardPat(Pos pos)
-
conPat
public Ast.ConPat conPat(Pos pos, Ast.Id tyCon, Ast.Pat pat)
-
con0Pat
public Ast.Con0Pat con0Pat(Pos pos, Ast.Id tyCon)
-
tuplePat
public Ast.TuplePat tuplePat(Pos pos, Iterable<? extends Ast.Pat> args)
-
tuplePat
public Ast.TuplePat tuplePat(Pos pos, Ast.Pat... args)
-
listPat
public Ast.ListPat listPat(Pos pos, Iterable<? extends Ast.Pat> args)
-
listPat
public Ast.ListPat listPat(Pos pos, Ast.Pat... args)
-
recordPat
public Ast.RecordPat recordPat(Pos pos, boolean ellipsis, Map<String,? extends Ast.Pat> args)
-
annotatedPat
public Ast.AnnotatedPat annotatedPat(Pos pos, Ast.Pat pat, Ast.Type type)
-
consPat
public Ast.InfixPat consPat(Ast.Pat p0, Ast.Pat p1)
-
list
public Ast.ListExp list(Pos pos, Iterable<? extends Ast.Exp> list)
-
record
public Ast.Record record(Pos pos, Map<String,Ast.Exp> map)
-
valDecl
public Ast.ValDecl valDecl(Pos pos, boolean rec, Iterable<? extends Ast.ValBind> valBinds)
-
valDecl
public Ast.ValDecl valDecl(Pos pos, boolean rec, Ast.ValBind... valBinds)
-
valBind
public Ast.ValBind valBind(Pos pos, Ast.Pat pat, Ast.Exp exp)
-
from
public Ast.From from(Pos pos, List<Ast.FromStep> steps)
-
fromEq
public Ast.Exp fromEq(Ast.Exp exp)
Wraps an expression to distinguish "from x = e" from "from x in e".
-
funDecl
public Ast.FunDecl funDecl(Pos pos, Iterable<? extends Ast.FunBind> valBinds)
-
funBind
public Ast.FunBind funBind(Pos pos, Iterable<? extends Ast.FunMatch> matchList)
-
funMatch
public Ast.FunMatch funMatch(Pos pos, String name, Iterable<? extends Ast.Pat> patList, @Nullable Ast.Type returnType, Ast.Exp exp)
-
infixPat
public Ast.InfixPat infixPat(Pos pos, Op op, Ast.Pat p0, Ast.Pat p1)
-
datatypeDecl
public Ast.DatatypeDecl datatypeDecl(Pos pos, Iterable<Ast.DatatypeBind> binds)
-
datatypeBind
public Ast.DatatypeBind datatypeBind(Pos pos, Ast.Id name, Iterable<Ast.TyVar> tyVars, Iterable<Ast.TyCon> tyCons)
-
functionType
public Ast.FunctionType functionType(Pos pos, Ast.Type fromType, Ast.Type toType)
-
foldRight
private <E> E foldRight(List<E> list, BiFunction<E,E,E> fold)
-
aggregate
public Ast.Aggregate aggregate(Pos pos, Ast.Exp aggregate, Ast.Exp argument, Ast.Id id)
-
ref
private Ast.Exp ref(Pos pos, BuiltIn builtIn)
Returns a reference to a built-in: either a name (e.g. "true") or a field reference (e.g. "#hd List").
-
order
public Ast.Order order(Pos pos, Iterable<Ast.OrderItem> orderItems)
-
orderItem
public Ast.OrderItem orderItem(Pos pos, Ast.Exp exp, Ast.Direction direction)
-
compute
public Ast.Compute compute(Pos pos, List<Ast.Aggregate> aggregates)
-
group
public Ast.Group group(Pos pos, List<Pair<Ast.Id,Ast.Exp>> groupExps, List<Ast.Aggregate> aggregates)
-
where
public Ast.FromStep where(Pos pos, Ast.Exp exp)
-
yield
public Ast.FromStep yield(Pos pos, Ast.Exp exp)
-
-