// NewGlobalMacro creates a Macro for a global function with the specified arg count. func NewGlobalMacro(function string, argCount int, expander MacroExpander) Macro { … } // NewReceiverMacro creates a Macro for a receiver function matching the specified arg count. func NewReceiverMacro(function string, argCount int, expander MacroExpander) Macro { … } // NewGlobalVarArgMacro creates a Macro for a global function with a variable arg count. func NewGlobalVarArgMacro(function string, expander MacroExpander) Macro { … } // NewReceiverVarArgMacro creates a Macro for a receiver function matching a variable arg count. func NewReceiverVarArgMacro(function string, expander MacroExpander) Macro { … } type Macro … type macro … // Function returns the macro's function name (i.e. the function whose syntax it mimics). func (m *macro) Function() string { … } // ArgCount returns the number of arguments the macro expects. func (m *macro) ArgCount() int { … } // IsReceiverStyle returns whether the macro is receiver style. func (m *macro) IsReceiverStyle() bool { … } // Expander implements the Macro interface method. func (m *macro) Expander() MacroExpander { … } // MacroKey implements the Macro interface method. func (m *macro) MacroKey() string { … } func makeMacroKey(name string, args int, receiverStyle bool) string { … } func makeVarArgMacroKey(name string, receiverStyle bool) string { … } type MacroExpander … type ExprHelper … var HasMacro … var AllMacro … var ExistsMacro … var ExistsOneMacro … var MapMacro … var MapFilterMacro … var FilterMacro … var AllMacros … var NoMacros … const AccumulatorName … type quantifierKind … const quantifierAll … const quantifierExists … const quantifierExistsOne … // MakeAll expands the input call arguments into a comprehension that returns true if all of the // elements in the range match the predicate expressions: // <iterRange>.all(<iterVar>, <predicate>) func MakeAll(eh ExprHelper, target ast.Expr, args []ast.Expr) (ast.Expr, *common.Error) { … } // MakeExists expands the input call arguments into a comprehension that returns true if any of the // elements in the range match the predicate expressions: // <iterRange>.exists(<iterVar>, <predicate>) func MakeExists(eh ExprHelper, target ast.Expr, args []ast.Expr) (ast.Expr, *common.Error) { … } // MakeExistsOne expands the input call arguments into a comprehension that returns true if exactly // one of the elements in the range match the predicate expressions: // <iterRange>.exists_one(<iterVar>, <predicate>) func MakeExistsOne(eh ExprHelper, target ast.Expr, args []ast.Expr) (ast.Expr, *common.Error) { … } // MakeMap expands the input call arguments into a comprehension that transforms each element in the // input to produce an output list. // // There are two call patterns supported by map: // // <iterRange>.map(<iterVar>, <transform>) // <iterRange>.map(<iterVar>, <predicate>, <transform>) // // In the second form only iterVar values which return true when provided to the predicate expression // are transformed. func MakeMap(eh ExprHelper, target ast.Expr, args []ast.Expr) (ast.Expr, *common.Error) { … } // MakeFilter expands the input call arguments into a comprehension which produces a list which contains // only elements which match the provided predicate expression: // <iterRange>.filter(<iterVar>, <predicate>) func MakeFilter(eh ExprHelper, target ast.Expr, args []ast.Expr) (ast.Expr, *common.Error) { … } // MakeHas expands the input call arguments into a presence test, e.g. has(<operand>.field) func MakeHas(eh ExprHelper, target ast.Expr, args []ast.Expr) (ast.Expr, *common.Error) { … } func makeQuantifier(kind quantifierKind, eh ExprHelper, target ast.Expr, args []ast.Expr) (ast.Expr, *common.Error) { … } func extractIdent(e ast.Expr) (string, bool) { … }