Package net.hydromatic.morel.ast
Enum AstBuilder
- All Implemented Interfaces:
Serializable,Comparable<AstBuilder>,java.lang.constant.Constable
Builds parse tree nodes.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionannotatedExp(Pos pos, Ast.Exp expression, Ast.Type type) annotatedPat(Pos pos, Ast.Pat pat, Ast.Type type) boolLiteral(Pos p, boolean b) Creates abooleanliteral.charLiteral(Pos p, char c) Creates acharliteral.compositeType(Pos pos, Iterable<Ast.Type> types) compute(Pos pos, List<Ast.Aggregate> aggregates) datatypeDecl(Pos pos, Iterable<Ast.DatatypeBind> binds) exists(Pos pos, List<Ast.FromStep> steps) foldFunctionType(List<Ast.Type> types) private <E> EfoldRight(List<E> list, BiFunction<E, E, E> fold) forall(Pos pos, List<Ast.FromStep> steps) from(Pos pos, List<Ast.FromStep> steps) Wraps an expression to distinguish "from x = e" from "from x in e".funBind(Pos pos, Iterable<? extends Ast.FunMatch> matchList) functionType(Pos pos, Ast.Type fromType, Ast.Type toType) funDecl(Pos pos, Iterable<? extends Ast.FunBind> valBinds) funMatch(Pos pos, String name, Iterable<? extends Ast.Pat> patList, @Nullable Ast.Type returnType, Ast.Exp exp) greaterThan(Ast.Exp a0, Ast.Exp a1) greaterThanOrEqual(Ast.Exp a0, Ast.Exp a1) ifThenElse(Pos pos, Ast.Exp condition, Ast.Exp ifTrue, Ast.Exp ifFalse) implicitLabel(Ast.Exp exp) Returns an expression's implicit label, or throws.@Nullable StringimplicitLabelOpt(Ast.Exp exp) Returns the implicit label for when an expression occurs within a record, or null if no label can be deduced.private Ast.InfixCallCreates a call to an infix operator.intLiteral(Pos pos, BigDecimal value) Creates anintliteral.lessThanOrEqual(Ast.Exp a0, Ast.Exp a1) literalPat(Pos pos, Op op, Comparable value) prefixCall(Pos p, Op op, Ast.Exp a) Creates a call to a prefix operator.realLiteral(Pos pos, Float value) Creates afloatliteral for a special IEEE floating point value: NaN, negative zero, positive and negative infinity.realLiteral(Pos pos, BigDecimal value) Creates afloatliteral.recordSelector(Pos pos, String name) recordType(Pos pos, Map<String, Ast.Type> fieldTypes) private Ast.ExpReturns a reference to a built-in: either a name (e.g.stringLiteral(Pos pos, String value) Creates a string literal.typeConstructor(Pos pos, Ast.Id id, Ast.Type type) unitLiteral(Pos p) Creates a unit literal.valDecl(Pos pos, boolean rec, boolean inst, Iterable<? extends Ast.ValBind> valBinds) valDecl(Pos pos, boolean rec, boolean inst, Ast.ValBind... valBinds) static AstBuilderReturns the enum constant of this type with the specified name.static AstBuilder[]values()Returns an array containing the constants of this enum type, in the order they are declared.wildcardPat(Pos pos)
-
Enum Constant Details
-
ast
The singleton instance of the AST builder. The short name is convenient for use via 'import static', but checkstyle does not approve.
-
-
Constructor Details
-
AstBuilder
private AstBuilder()
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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
-
implicitLabelOpt
Returns the implicit label for when an expression occurs within a record, or null if no label can be deduced.For example,
{x.a, y, z = x.b + 2}is equivalent to
{a = x.a, y = y, z = x.b + 2}because a field reference
x.ahas implicit labela, and a variable referenceyhas implicit labely. The expressionx.b + 2has no implicit label. -
implicitLabel
Returns an expression's implicit label, or throws. -
infix
Creates a call to an infix operator. -
prefixCall
Creates a call to a prefix operator. -
boolLiteral
Creates abooleanliteral. -
charLiteral
Creates acharliteral. -
intLiteral
Creates anintliteral. -
realLiteral
Creates afloatliteral. -
realLiteral
Creates afloatliteral for a special IEEE floating point value: NaN, negative zero, positive and negative infinity. -
stringLiteral
Creates a string literal. -
unitLiteral
Creates a unit literal. -
current
-
ordinal
-
id
-
tyVar
-
recordType
-
recordSelector
-
namedType
-
idPat
-
literalPat
-
wildcardPat
-
asPat
-
conPat
-
con0Pat
-
tuplePat
-
tuplePat
-
listPat
-
listPat
-
recordPat
-
annotatedPat
-
consPat
-
tuple
-
list
-
record
-
record
public Ast.Record record(Pos pos, @Nullable Ast.Exp with, Collection<Map.Entry<String, Ast.Exp>> map) -
equal
-
notEqual
-
lessThan
-
greaterThan
-
lessThanOrEqual
-
greaterThanOrEqual
-
elem
-
notElem
-
andAlso
-
orElse
-
implies
-
plus
-
minus
-
times
-
divide
-
div
-
mod
-
caret
-
o
-
negate
-
cons
-
foldCons
-
let
-
valDecl
public Ast.ValDecl valDecl(Pos pos, boolean rec, boolean inst, Iterable<? extends Ast.ValBind> valBinds) -
valDecl
-
valBind
-
match
-
caseOf
-
exists
-
forall
-
from
-
fromEq
Wraps an expression to distinguish "from x = e" from "from x in e". -
fn
-
fn
-
overDecl
-
funDecl
-
funBind
-
funMatch
-
apply
-
ifThenElse
-
infixPat
-
annotatedExp
-
infixCall
-
datatypeDecl
-
datatypeBind
-
typeConstructor
-
tupleType
-
compositeType
-
functionType
-
foldFunctionType
-
foldRight
-
aggregate
-
ref
Returns a reference to a built-in: either a name (e.g. "true") or a field reference (e.g. "#hd List"). -
map
-
scan
-
order
-
compute
-
group
-
where
-
distinct
-
require
-
skip
-
take
-
except
-
intersect
-
union
-
unorder
-
yield
-
into
-
through
-