pkg/dockerscript: expose a simple, clean API with a single Parse method

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
This commit is contained in:
Solomon Hykes 2014-03-21 18:18:42 -07:00
parent d1f2f389ff
commit f4c6f14d0a
4 changed files with 112 additions and 97 deletions

View file

@ -0,0 +1,22 @@
package scanner
import (
"unicode"
"strings"
)
// extra functions used to hijack the upstream text/scanner
func detectIdent(ch rune) bool {
if unicode.IsLetter(ch) {
return true
}
if unicode.IsDigit(ch) {
return true
}
if strings.ContainsRune("_:/+-@%^", ch) {
return true
}
return false
}