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:
parent
d1f2f389ff
commit
f4c6f14d0a
4 changed files with 112 additions and 97 deletions
22
dockerscript/scanner/extra.go
Normal file
22
dockerscript/scanner/extra.go
Normal 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
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue