Macros adds the given macros to the parser.
(macros ...Macro)
| 99 | |
| 100 | // Macros adds the given macros to the parser. |
| 101 | func Macros(macros ...Macro) Option { |
| 102 | return func(opts *options) error { |
| 103 | for _, m := range macros { |
| 104 | if m != nil { |
| 105 | if opts.macros == nil { |
| 106 | opts.macros = make(map[string]Macro) |
| 107 | } |
| 108 | opts.macros[m.MacroKey()] = m |
| 109 | } |
| 110 | } |
| 111 | return nil |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | // PopulateMacroCalls ensures that the original call signatures replaced by expanded macros |
| 116 | // are preserved in the `SourceInfo` of parse result. |