aboutsummaryrefslogtreecommitdiffstats
path: root/rule_parser.go
blob: ce74878919491f18008e9cc1d60bf1caf427ac26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package main

import (
	"strings"
)

type Rule struct {
	outputs   []string
	inputs    []string
	cmds      []string
	filename  string
	lineno    int
	cmdLineno int
}

func (r *Rule) parse(line string) {
	colonIndex := strings.IndexByte(line, ':')
	if colonIndex < 0 {
		Error(r.filename, r.lineno, "*** missing separator.")
	}

	r.outputs = splitSpaces(line[:colonIndex])
	r.inputs = splitSpaces(line[colonIndex+1:])
}