diff --git a/pkg/dockerscript/extra.go b/pkg/dockerscript/extra.go
new file mode 100644
index 0000000000..72291c89d2
--- /dev/null
+++ b/pkg/dockerscript/extra.go
@@ -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
+}
+
diff --git a/pkg/dockerscript/scanner.go b/pkg/dockerscript/scanner.go
index e0d86e343d..b208fc7810 100644
--- a/pkg/dockerscript/scanner.go
+++ b/pkg/dockerscript/scanner.go
@@ -30,7 +30,6 @@ import (
 	"fmt"
 	"io"
 	"os"
-	"unicode"
 	"unicode/utf8"
 )
 
@@ -336,7 +335,7 @@ func (s *Scanner) error(msg string) {
 
 func (s *Scanner) scanIdentifier() rune {
 	ch := s.next() // read character after first '_' or letter
-	for ch == '_' || unicode.IsLetter(ch) || unicode.IsDigit(ch) {
+	for detectIdent(ch) {
 		ch = s.next()
 	}
 	return ch
@@ -563,7 +562,7 @@ redo:
 	// determine token value
 	tok := ch
 	switch {
-	case unicode.IsLetter(ch) || ch == '_':
+	case detectIdent(ch):
 		if s.Mode&ScanIdents != 0 {
 			tok = Ident
 			ch = s.scanIdentifier()