diff --git a/scanner.go b/scanner.go index aff29a6..e535cc6 100644 --- a/scanner.go +++ b/scanner.go @@ -192,4 +192,4 @@ func isLetter(ch rune) bool { return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && c // isDigit returns true if the rune is a digit. func isDigit(ch rune) bool { return (ch >= '0' && ch <= '9') } -func isMisc(ch rune) bool { return (ch == '.' || ch == '/' || ch == '-') } +func isMisc(ch rune) bool { return (ch == '.' || ch == '/' || ch == '-' || ch == ':') } diff --git a/scanner_test.go b/scanner_test.go index c5d1dfb..3fa3c05 100644 --- a/scanner_test.go +++ b/scanner_test.go @@ -27,6 +27,7 @@ func TestScanner_Scan(t *testing.T) { {s: `"hello \"my\" friend bla\`, tok: COMMENT, lit: "hello \\\"my\\\" friend bla\\"}, {s: "hello friend", tok: IDENT, lit: "hello"}, {s: "192.168.178.2/24", tok: IDENT, lit: "192.168.178.2/24"}, + {s: "2001:db8::/64", tok: IDENT, lit: "2001:db8::/64"}, {s: "# 192.168.178.2/24", tok: COMMENTLINE, lit: " 192.168.178.2/24"}, } { s := newScanner(strings.NewReader(tc.s))