1 parent
7d21785af7
commit
784d80ca30
2 files changed
+31
-1
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"strconv"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
@@ -84,6 +85,10 @@ func isSpace(b byte) bool {
|
||||
return unicode.IsSpace(rune(b))
|
||||
}
|
||||
|
||||
func isDigit(b byte) bool {
|
||||
return unicode.IsDigit(rune(b))
|
||||
}
|
||||
|
||||
func isPrefix(b byte) bool {
|
||||
// TODO: how to differentiate slash in path vs search?
|
||||
return b == '$' || b == '!' || b == '&' // || b == '/' || b == '?'
|
||||
@@ -228,7 +233,20 @@ scan:
|
||||
case 'v':
|
||||
buf = append(buf, '\v')
|
||||
}
|
||||
s.next()
|
||||
if isDigit(s.chr) {
|
||||
var oct []byte
|
||||
for isDigit(s.chr) {
|
||||
oct = append(oct, s.chr)
|
||||
s.next()
|
||||
}
|
||||
n, err := strconv.ParseInt(string(oct), 8, 0)
|
||||
if err != nil {
|
||||
log.Printf("scanning: %s", err)
|
||||
}
|
||||
buf = append(buf, byte(n))
|
||||
} else {
|
||||
s.next()
|
||||
}
|
||||
} else {
|
||||
buf = append(buf, s.chr)
|
||||
s.next()
|
||||
|
||||
Reference in new issue
Block a user