Documentation
¶
Overview ¶
Package parser implements all the parser functionality for Makefiles. This is supposed to be a parser with a very small feature set that just supports what is needed to do linting and checking and not actual full Makefile parsing. And it's handrolled because apparently GNU Make doesn't have a grammar (see http://www.mail-archive.com/help-make@gnu.org/msg02778.html)
Package parser implements all the parser functionality for Makefiles this specific file holds the functionality for the scanner. The implementation is a thin wrapper around bufio.Scanner with some extra niceties to make parsing Makefiles easier.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Makefile ¶
type Makefile struct {
FileName string
Rules RuleList
Variables VariableList
}
Makefile provides a data structure to describe a parsed Makefile
type MakefileScanner ¶
type MakefileScanner struct {
Scanner *bufio.Scanner
LineNumber int
FileHandle *os.File
Finished bool
}
MakefileScanner is a wrapping struct around bufio.Scanner which provides extra functionality like the current line number
func NewMakefileScanner ¶
func NewMakefileScanner(filepath string) (*MakefileScanner, error)
NewMakefileScanner returns a MakefileScanner struct for parsing a Makefile
func (*MakefileScanner) Close ¶
func (s *MakefileScanner) Close()
Close closes all open handles the scanner has
func (*MakefileScanner) Scan ¶
func (s *MakefileScanner) Scan() bool
Scan is a thin wrapper around the bufio.Scanner Scan() function
func (*MakefileScanner) Text ¶
func (s *MakefileScanner) Text() string
Text is a thin wrapper around bufio.Scanner Text()
type Rule ¶
type Rule struct {
Target string
Dependencies []string
Body []string
FileName string
LineNumber int
}
Rule represents a Make rule