Package net.hydromatic.morel.ast
Class AstWriter
java.lang.Object
net.hydromatic.morel.ast.AstWriter
Context for writing an AST out as a string.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppends a string to the output.Appends a parse tree node.Appends a list of parse tree nodes.Appends a list of parse tree nodes separated bysep.Appends a list of parse tree nodes separated bysep, and also with prefix and suffix:start node0 sep node1 ... sep nodeN end.Appends a list of parse tree nodes separated bysep, and also with prefix and suffix:start node0 sep node1 ... sep nodeN end.appendLiteral(Comparable value) Appends a call to a binary operator (e.g.Appends a call to a binary operator (e.g.Appends an identifier to the output.Appends a ordinal-qualified-identifier to the output.Appends a call to an infix operator.Appends a call to an prefix operator.toString()withParenthesize(boolean parenthesize) Returns a writer that wraps everything in parentheses.
-
Field Details
-
b
-
parenthesize
private final boolean parenthesize
-
-
Constructor Details
-
AstWriter
-
AstWriter
public AstWriter()
-
-
Method Details
-
toString
Returns the ML source code generated by this writer.
-
withParenthesize
Returns a writer that wraps everything in parentheses. -
append
Appends a string to the output. -
id
Appends an identifier to the output. -
id
Appends a ordinal-qualified-identifier to the output.Prints "v" for
id("v", 0), "v#1" forid("v", 1), and so forth. -
infix
Appends a call to an infix operator. -
prefix
Appends a call to an prefix operator. -
binary
Appends a call to a binary operator (e.g. "val ... = ..."). -
binary
Appends a call to a binary operator (e.g. "let ... in ... end"). -
append
Appends a parse tree node. -
appendAll
Appends a list of parse tree nodes. -
appendAll
Appends a list of parse tree nodes separated bysep. -
appendAll
Appends a list of parse tree nodes separated bysep, and also with prefix and suffix:start node0 sep node1 ... sep nodeN end. -
appendAll
public AstWriter appendAll(Iterable<? extends AstNode> list, String start, String sep, String end, String empty) Appends a list of parse tree nodes separated bysep, and also with prefix and suffix:start node0 sep node1 ... sep nodeN end. -
appendLiteral
-