pre

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2020 License: MIT Imports: 1 Imported by: 1

README

goulash/pre

GoDoc

Package pre provides a C-like preprocessor.

Commands currently available are:

include
require

More will be added in the future.

For more information, see the documentation! :-) This package is licensed under the MIT license.

Documentation

Overview

Package pre offers preprocessing of files.

Commands available are:

printf
include
require
define
ifdef
ifndef

Index

Constants

This section is empty.

Variables

View Source
var (
	LispComment = PrefixCommenter(";")
	CppComment  = PrefixCommenter("//")
	CComment    = &ast.Commenter{"/*", "*/", false}
)

Functions

func PrefixCommenter

func PrefixCommenter(prefix string) *ast.Commenter

Types

type Processor

type Processor struct {
	// Trigger is the string which begins an action (command).
	// The default trigger is "#", which is the same as the C/C++ pre-processor.
	Trigger string

	// MaxIncludeDepth is the maximum number of nested includes that can occur
	// before an error is thrown. This is to prevent infinite include loops.
	MaxIncludeDepth int

	// Commenters define what kind of comments are accepted in the parsed text.
	// Triggers are ignored when they are inside a comment. Comments can also
	// be stripped out of the text, or just left there.
	Commenters ast.Commenters
}

func New

func New() *Processor

func (*Processor) AddCommenter

func (p *Processor) AddCommenter(c *ast.Commenter, strip bool)

func (*Processor) Parse

func (p *Processor) Parse(path string) (ast.Node, error)

func (*Processor) ParseString

func (p *Processor) ParseString(name, code string) (ast.Node, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL