ExprHelper
ExprHelper assists macro implementations with parser-consistent id allocation and AST creation.
Methods
Section titled “Methods”accuIdent()
Section titled “accuIdent()”accuIdent():
Expr
Builds the accumulator identifier expression.
Returns
Section titled “Returns”Expr
accuIdentName()
Section titled “accuIdentName()”accuIdentName():
string
Returns the accumulator identifier name.
Returns
Section titled “Returns”string
call()
Section titled “call()”call(
fn, …args):Expr
Builds a global call expression.
Parameters
Section titled “Parameters”string
…Expr[]
Returns
Section titled “Returns”Expr
comprehension()
Section titled “comprehension()”comprehension(
iterRange,iterVar,accuVar,accuInit,condition,step,result):Expr
Builds a comprehension expression.
Parameters
Section titled “Parameters”iterRange
Section titled “iterRange”Expr
iterVar
Section titled “iterVar”string
accuVar
Section titled “accuVar”string
accuInit
Section titled “accuInit”Expr
condition
Section titled “condition”Expr
Expr
result
Section titled “result”Expr
Returns
Section titled “Returns”Expr
comprehensionTwoVar()
Section titled “comprehensionTwoVar()”comprehensionTwoVar(
iterRange,iterVar,iterVar2,accuVar,accuInit,condition,step,result):Expr
Builds a two-variable comprehension expression.
Parameters
Section titled “Parameters”iterRange
Section titled “iterRange”Expr
iterVar
Section titled “iterVar”string
iterVar2
Section titled “iterVar2”string
accuVar
Section titled “accuVar”string
accuInit
Section titled “accuInit”Expr
condition
Section titled “condition”Expr
Expr
result
Section titled “result”Expr
Returns
Section titled “Returns”Expr
copy()
Section titled “copy()”copy(
expr):Expr
Copies an expression and assigns fresh ids to the clone tree.
Parameters
Section titled “Parameters”Expr
Returns
Section titled “Returns”Expr
error()
Section titled “error()”error(
id,message,anchor?):Error
Builds a parser error value tied to a specific expression id.
Parameters
Section titled “Parameters”number
message
Section titled “message”string
anchor?
Section titled “anchor?”"start" | "stop"
Returns
Section titled “Returns”Error
ident()
Section titled “ident()”ident(
name):Expr
Builds an identifier expression.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Expr
list()
Section titled “list()”list(…
elems):Expr
Builds a list literal expression.
Parameters
Section titled “Parameters”…Expr[]
Returns
Section titled “Returns”Expr
literal()
Section titled “literal()”literal(
value):Expr
Builds a literal expression.
Parameters
Section titled “Parameters”ConstantValue
Returns
Section titled “Returns”Expr
map(…
entries):Expr
Builds a map literal expression.
Parameters
Section titled “Parameters”entries
Section titled “entries”…EntryExpr[]
Returns
Section titled “Returns”Expr
mapEntry()
Section titled “mapEntry()”mapEntry(
key,value,optional):EntryExpr
Builds a map entry expression.
Parameters
Section titled “Parameters”Expr
Expr
optional
Section titled “optional”boolean
Returns
Section titled “Returns”EntryExpr
memberCall()
Section titled “memberCall()”memberCall(
fn,target, …args):Expr
Builds a receiver-style call expression.
Parameters
Section titled “Parameters”string
target
Section titled “target”Expr
…Expr[]
Returns
Section titled “Returns”Expr
presenceTest()
Section titled “presenceTest()”presenceTest(
operand,field):Expr
Builds a field presence test expression.
Parameters
Section titled “Parameters”operand
Section titled “operand”Expr
string
Returns
Section titled “Returns”Expr
select()
Section titled “select()”select(
operand,field):Expr
Builds an ordinary field selection expression.
Parameters
Section titled “Parameters”operand
Section titled “operand”Expr
string
Returns
Section titled “Returns”Expr
struct()
Section titled “struct()”struct(
typeName, …fields):Expr
Builds a message construction expression.
Parameters
Section titled “Parameters”typeName
Section titled “typeName”string
fields
Section titled “fields”…EntryExpr[]
Returns
Section titled “Returns”Expr
structField()
Section titled “structField()”structField(
name,value,optional):EntryExpr
Builds a message field initializer expression.
Parameters
Section titled “Parameters”string
Expr
optional
Section titled “optional”boolean
Returns
Section titled “Returns”EntryExpr