diff --git a/scanner.go b/scanner.go index 54c4637..c8077e9 100644 --- a/scanner.go +++ b/scanner.go @@ -196,4 +196,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 == '-' || ch == '_') } +func isMisc(ch rune) bool { return (ch == '.' || ch == '/' || ch == '-' || ch == '_' || ch == ':') } diff --git a/scanner_test.go b/scanner_test.go index bbcd03c..8f19a67 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: "I_test_rule-something", tok: IDENT, lit: "I_test_rule-something"}, } {