From 3bb8ea9f25775ca3f9a0c05894d208e06659af83 Mon Sep 17 00:00:00 2001 From: Maximilian Eschenbacher Date: Mon, 12 Feb 2024 15:09:34 +0100 Subject: [PATCH] fix: ipv6 ident --- scanner.go | 2 +- scanner_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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))