Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/pkgsrc/pkgtools/pkglint/files/Attic/pkglint.go,v rcsdiff: /ftp/cvs/cvsroot/pkgsrc/pkgtools/pkglint/files/Attic/pkglint.go,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.13 retrieving revision 1.14 diff -u -p -r1.13 -r1.14 --- pkgsrc/pkgtools/pkglint/files/Attic/pkglint.go 2016/11/01 21:40:25 1.13 +++ pkgsrc/pkgtools/pkglint/files/Attic/pkglint.go 2016/11/14 01:08:23 1.14 @@ -7,8 +7,7 @@ import ( ) const ( - reMkInclude = `^\.(\s*)(s?include)\s+\"([^\"]+)\"\s*(?:#.*)?$` - rePkgname = `^([\w\-.+]+)-(\d(?:\w|\.\d)*)$` + rePkgname = `^([\w\-.+]+)-(\d(?:\w|\.\d)*)$` ) // Returns the pkgsrc top-level directory, relative to the given file or directory. @@ -386,6 +385,66 @@ func MatchVarassign(text string) (m bool return } +func MatchMkInclude(text string) (bool, string, string, string) { + goto start +fail: + return false, "", "", "" + +start: + len := len(text) + if len == 0 || text[0] != '.' { + goto fail + } + + i := 1 + + spaceStart := i + for i < len && (text[i] == ' ' || text[i] == '\t') { + i++ + } + spaceEnd := i + + directiveStart := i + if i < len && text[i] == 's' { + i++ + } + if !(i+7 < len && text[i] == 'i' && text[i+1] == 'n' && text[i+2] == 'c' && text[i+3] == 'l' && text[i+4] == 'u' && text[i+5] == 'd' && text[i+6] == 'e') { + goto fail + } + i += 7 + directiveEnd := i + + for i < len && (text[i] == ' ' || text[i] == '\t') { + i++ + } + if !(i < len && text[i] == '"') { + goto fail + } + i++ + + pathStart := i + for i < len && text[i] != '"' { + i++ + } + pathEnd := i + if !(pathStart < pathEnd) { + goto fail + } + + if !(i < len && text[i] == '"') { + goto fail + } + i++ + + for i < len && (text[i] == ' ' || text[i] == '\t') { + i++ + } + if !(i == len || i < len && text[i] == '#') { + goto fail + } + return true, text[spaceStart:spaceEnd], text[directiveStart:directiveEnd], text[pathStart:pathEnd] +} + type DependencyPattern struct { pkgbase string // "freeciv-client", "{gcc48,gcc48-libs}", "${EMACS_REQD}" lowerOp string // ">=", ">"