Package net.hydromatic.morel.ast
Enum CoreBuilder
- All Implemented Interfaces:
Serializable,Comparable<CoreBuilder>,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 -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Core.WildcardPatprivate final Core.Literalprivate final Core.Literalprivate final Core.LiteralPat -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionandAlso(TypeSystem typeSystem, Iterable<Core.Exp> exps) andAlso(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1) Creates aCore.Apply.apply(Pos pos, TypeSystem typeSystem, BuiltIn builtIn, Core.Exp arg0, Core.Exp arg1, Core.Exp... args) Creates aCore.Applywith two or more arguments, packing the arguments into a tuple.private Core.ExpasPat(Type type, String name, NameGenerator nameGenerator, Core.Pat pat) Creates an AsPat with a given name, generating an ordinal to distinguish it from other declarations with the same name elsewhere in the program.boolLiteral(boolean b) Creates abooleanliteral.private static Core.LiteralboolLiteral_(boolean b) Used only during initialization.private Core.Applycall(TypeSystem typeSystem, BuiltIn builtIn, Core.Exp... args) Calls a built-in function.private Core.ApplyCalls a built-in function with one type parameter.charLiteral(char c) Creates acharliteral.datatypeDecl(Iterable<DataType> dataTypes) elem(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1) equal(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1) extent(TypeSystem typeSystem, Type type, com.google.common.collect.RangeSet<Comparable> rangeSet) Creates an extent.field(TypeSystem typeSystem, Core.Exp exp, int slot) Creates a reference to theslotth field of an expression, "#slot exp".fn(Pos pos, FnType type, List<Core.Match> matchList, NameGenerator nameGenerator) fn(FnType type, Core.IdPat idPat, Core.Exp exp) private <E> EfoldRight(List<E> list, BiFunction<E, E, E> fold) from(ListType type, List<Core.FromStep> steps) from(TypeSystem typeSystem, List<Core.FromStep> steps) Derives the result type, then callsfrom(ListType, List).fromBuilder(TypeSystem typeSystem) Creates a builder that will create aCore.Frombut does not validate.fromBuilder(TypeSystem typeSystem, @Nullable Environment env) Creates a builder that will create aCore.From.private TypefromElementType(TypeSystem typeSystem, List<Core.FromStep> steps) Returns the element type of aCore.Fromwith the given steps.functionLiteral(TypeSystem typeSystem, BuiltIn builtIn) Creates a function literal.greaterThan(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1) greaterThanOrEqualTo(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1) group(SortedMap<Core.IdPat, Core.Exp> groupExps, SortedMap<Core.IdPat, Core.Aggregate> aggregates) id(Core.NamedPat idPat) Creates a reference to a value.Creates an IdPat with a given name and ordinal.idPat(Type type, String name, NameGenerator nameGenerator) Creates an IdPat with a given name, generating an ordinal to distinguish it from other declarations with the same name elsewhere in the program.idPat(Type type, NameGenerator nameGenerator) Creates an IdPat with a system-generated unique name.ifThenElse(Core.Exp condition, Core.Exp ifTrue, Core.Exp ifFalse) implicitYieldExp(TypeSystem typeSystem, List<Core.FromStep> steps) Returns what would be the yield expression if we created aCore.Fromfrom the given steps.internalLiteral(Object value) Creates an internal literal.intersect(TypeSystem typeSystem, Iterable<Core.Exp> exps) intersect(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1) intLiteral(BigDecimal value) Creates anintliteral.lastBindings(List<? extends Core.FromStep> steps) lessThan(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1) let(Core.ValDecl decl, Core.Exp exp) list(TypeSystem typeSystem, Core.Exp arg0, Core.Exp... args) Creates a list with one or more elements.list(TypeSystem typeSystem, Type elementType, List<Core.Exp> args) Creates a list.listPat(TypeSystem typeSystem, List<Core.Pat> args) literal(PrimitiveType type, Object value) Creates a literal.literalPat(Op op, Type type, Comparable value) mergeExtents(TypeSystem typeSystem, List<? extends Core.Exp> exps, boolean intersect) nonRecValDecl(Pos pos, Core.NamedPat pat, Core.Exp exp) notEqual(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1) only(TypeSystem typeSystem, Pos pos, Core.Exp a0) order(List<Binding> bindings, Iterable<Core.OrderItem> orderItems) orderItem(Core.Exp exp, Ast.Direction direction) orElse(TypeSystem typeSystem, Iterable<Core.Exp> exps) orElse(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1) realLiteral(Float value) Creates afloatliteral with a non-normal value.realLiteral(BigDecimal value) Creates afloatliteral.record(TypeSystem typeSystem, Map<String, ? extends Core.Exp> nameExps) Creates a record.recordPat(RecordType type, List<? extends Core.Pat> args) recordSelector(FnType fnType, int slot) recordSelector(TypeSystem typeSystem, RecordLikeType recordType, int slot) recordSelector(TypeSystem typeSystem, RecordLikeType recordType, String fieldName) recValDecl(Iterable<? extends Core.NonRecValDecl> list) (package private) Core.Expsimplify(TypeSystem typeSystem, Core.Exp exp) Simplifies an expression.stringLiteral(String value) Creates a string literal.tuple(RecordLikeType type, Iterable<? extends Core.Exp> args) tuple(RecordLikeType type, Core.Exp... args) tuple(TypeSystem typeSystem, Core.Exp... args) tuple(TypeSystem typeSystem, @Nullable RecordLikeType type, Iterable<? extends Core.Exp> args) Astuple(RecordLikeType, Iterable), but derives type.tuplePat(TypeSystem typeSystem, List<Core.Pat> args) union(TypeSystem typeSystem, Iterable<Core.Exp> exps) union(TypeSystem typeSystem, Core.Exp a0, Core.Exp a1) Creates a unit literal.valueLiteral(Core.Exp exp, Object value) Creates a value literal.static CoreBuilderReturns the enum constant of this type with the specified name.static CoreBuilder[]values()Returns an array containing the constants of this enum type, in the order they are declared.wildcardPat(Type type) yield_(TypeSystem typeSystem, Core.Exp exp) Derives bindings, then callsyield_(List, Core.Exp).
-
Enum Constant Details
-
core
The singleton instance of the CORE builder. The short name is convenient for use via 'import static', but checkstyle does not approve.
-
-
Field Details
-
truePat
-
boolWildcardPat
-
trueLiteral
-
falseLiteral
-
-
Constructor Details
-
CoreBuilder
private CoreBuilder()
-
-
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
-
literal
Creates a literal. -
boolLiteral_
Used only during initialization. -
boolLiteral
Creates abooleanliteral. -
charLiteral
Creates acharliteral. -
intLiteral
Creates anintliteral. -
realLiteral
Creates afloatliteral. -
realLiteral
Creates afloatliteral with a non-normal value. -
stringLiteral
Creates a string literal. -
unitLiteral
Creates a unit literal. -
functionLiteral
Creates a function literal. -
valueLiteral
Creates a value literal. -
internalLiteral
Creates an internal literal. -
id
Creates a reference to a value. -
recordSelector
public Core.RecordSelector recordSelector(TypeSystem typeSystem, RecordLikeType recordType, String fieldName) -
recordSelector
public Core.RecordSelector recordSelector(TypeSystem typeSystem, RecordLikeType recordType, int slot) -
recordSelector
-
idPat
Creates an IdPat with a given name and ordinal. You must ensure that the ordinal is unique for this name in this program. -
idPat
Creates an IdPat with a system-generated unique name. -
idPat
Creates an IdPat with a given name, generating an ordinal to distinguish it from other declarations with the same name elsewhere in the program. -
literalPat
-
wildcardPat
-
asPat
-
asPat
Creates an AsPat with a given name, generating an ordinal to distinguish it from other declarations with the same name elsewhere in the program. -
consPat
-
conPat
-
con0Pat
-
tuplePat
-
tuplePat
-
tuplePat
-
listPat
-
listPat
-
listPat
-
recordPat
-
recordPat
-
tuple
-
tuple
-
tuple
-
tuple
public Core.Tuple tuple(TypeSystem typeSystem, @Nullable RecordLikeType type, Iterable<? extends Core.Exp> args) Astuple(RecordLikeType, Iterable), but derives type.If present,
typeserves as a template, dictating whether to produce a record or a tuple type, and if a record type, the field names. If not present, the result is a tuple type. -
let
-
local
-
nonRecValDecl
-
recValDecl
-
match
-
caseOf
-
from
-
from
Derives the result type, then callsfrom(ListType, List). -
fromElementType
Returns the element type of aCore.Fromwith the given steps. -
implicitYieldExp
-
lastBindings
-
fromBuilder
Creates a builder that will create aCore.From. -
fromBuilder
Creates a builder that will create aCore.Frombut does not validate. -
fn
-
fn
-
apply
Creates aCore.Apply. -
apply
public Core.Apply apply(Pos pos, TypeSystem typeSystem, BuiltIn builtIn, Core.Exp arg0, Core.Exp arg1, Core.Exp... args) Creates aCore.Applywith two or more arguments, packing the arguments into a tuple. -
ifThenElse
-
datatypeDecl
-
scan
-
aggregate
-
order
-
orderItem
-
group
public Core.Group group(SortedMap<Core.IdPat, Core.Exp> groupExps, SortedMap<Core.IdPat, Core.Aggregate> aggregates) -
where
-
skip
-
take
-
yield_
-
yield_
Derives bindings, then callsyield_(List, Core.Exp). -
field
Creates a reference to theslotth field of an expression, "#slot exp". The expression's type must be record or tuple. -
list
Creates a list. -
list
Creates a list with one or more elements. -
extent
public Core.Exp extent(TypeSystem typeSystem, Type type, com.google.common.collect.RangeSet<Comparable> rangeSet) Creates an extent. It returns a list of all values of a given type that fall into a given range-set. The range-set might consist of justRange.all(), in which case, the list returns all values of the type. -
mergeExtents
-
simplify
Simplifies an expression.In particular, it merges extents. For example,
becomesextent "[10, 20]" orelse (extent "[-inf,5]" andalso "[1,int]")extent "[[1, 5], [10, 20]]" -
record
Creates a record. -
call
Calls a built-in function. -
call
private Core.Apply call(TypeSystem typeSystem, BuiltIn builtIn, Type type, Pos pos, Core.Exp... args) Calls a built-in function with one type parameter. -
args
-
equal
-
notEqual
-
lessThan
-
greaterThan
-
greaterThanOrEqualTo
-
elem
-
andAlso
-
andAlso
-
orElse
-
orElse
-
foldRight
-
only
-
union
-
union
-
intersect
-
intersect
-