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