Macros adds the given macros to the parser.
(macros ...Macro)
| 112 | |
| 113 | // Macros adds the given macros to the parser. |
| 114 | func Macros(macros ...Macro) Option { |
| 115 | return func(opts *options) error { |
| 116 | for _, m := range macros { |
| 117 | if m != nil { |
| 118 | if opts.macros == nil { |
| 119 | opts.macros = make(map[string]Macro) |
| 120 | } |
| 121 | opts.macros[m.MacroKey()] = m |
| 122 | } |
| 123 | } |
| 124 | return nil |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | // PopulateMacroCalls ensures that the original call signatures replaced by expanded macros |
| 129 | // are preserved in the `SourceInfo` of parse result. |