Documentation
¶
Overview ¶
gopp provides an easy to use (but somewhat illogical) preprocessor for Go. It allows similar functionality to cpp, such as ifdef, ifndef, define, undef and other odd combinations thereof.
Note: There is currently no support for nested ifdef/ifndefs.
Index ¶
Constants ¶
const Version = "0.4.2"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gopp ¶
type Gopp struct { Macros map[string]interface{} StripComments bool Prefix string // contains filtered or unexported fields }
func New ¶
New creates a new gopp instance with sane defaults. The macro `_GOPP` is automatically set to the gopp version.
func (*Gopp) Define ¶
Define takes a name, and sets it to the sane default of 1, which can then be used when preprocessing a Go file.
func (*Gopp) DefineValue ¶
DefineValue takes a name and a value, and defines them as a macro to use when preprocessing a Go file.
func (*Gopp) Parse ¶
Parse takes an io.Reader (usually from an os.Open call), and will process the resulting code read from it, preprocessing and substituting in macros as required.
func (*Gopp) Print ¶
Print takes the resulting new AST after a call to Parse, and will print it to the given io.Writer