diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bb688ec8..d3b3ff6fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed * Types generated by `reify` may optionally be marked as `^:mutable` now to prevent `attrs.exceptions.FrozenInstanceError`s being thrown when mutating methods inherited from the supertype(s) are called (#1088) +### Fixed + * Fix a bug where symbols and keyword containing `:` characters in the name were rejected by the reader (#1105) + ## [v0.3.0] ### Added * Added support for Python 3.13 (#1056) @@ -17,8 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fix an issue with `basilisp test` standard streams output that can lead to failures on MS-Windows (#1080) * Fix an issue where destructuring a vector would throw an exception rather than returning `nil` for invalid key types (#1090) * Fix an issue where destructuring default values would take precedence over falsey values in the source data structure (#1078) - * Fixed a bug where imported Python names containing `-` (in lieu of `_`) could not be referenced using the `-` syntax (#1085) - * Fixed a compatibility issue where `*print-length*` defaulted to 50 instead of `nil` (#1093) + * Fix a bug where imported Python names containing `-` (in lieu of `_`) could not be referenced using the `-` syntax (#1085) + * Fix a compatibility issue where `*print-length*` defaulted to 50 instead of `nil` (#1093) ### Removed * Removed support for Python 3.8 (#1083) diff --git a/src/basilisp/lang/reader.py b/src/basilisp/lang/reader.py index a4de62227..ee71722ba 100644 --- a/src/basilisp/lang/reader.py +++ b/src/basilisp/lang/reader.py @@ -55,7 +55,7 @@ from basilisp.lang.util import munge from basilisp.util import Maybe, partition -ns_name_chars = re.compile(r"\w|-|\+|\*|\?|/|\=|\\|!|&|%|>|<|\$|\.") +ns_name_chars = re.compile(r"\w|-|\+|\*|\?|/|\=|\\|!|&|%|>|<|\$|:|\.") alphanumeric_chars = re.compile(r"\w") begin_num_chars = re.compile(r"[0-9\-]") maybe_num_chars = re.compile(r"[0-9A-Za-z/\.]") diff --git a/tests/basilisp/reader_test.py b/tests/basilisp/reader_test.py index 51f6b0c06..954cc75c0 100644 --- a/tests/basilisp/reader_test.py +++ b/tests/basilisp/reader_test.py @@ -594,6 +594,7 @@ class TestKeyword: ("*muffs*", ":*muffs*"), ("yay!", ":yay!"), ("*'", ":*'"), + ("a:b", ":a:b"), ], ) def test_legal_bare_symbol(self, v: str, raw: str): @@ -605,6 +606,8 @@ def test_legal_bare_symbol(self, v: str, raw: str): ("kw", "ns", ":ns/kw"), ("kw", "qualified.ns", ":qualified.ns/kw"), ("kw", "really.qualified.ns", ":really.qualified.ns/kw"), + ("a:b", "ab", ":ab/a:b"), + ("a:b", "a:b", ":a:b/a:b"), ], ) def test_legal_ns_symbol(self, k: str, ns: str, raw: str): @@ -661,6 +664,7 @@ class TestSymbol: ".interop", "ns.name", "*'", + "a:b", ], ) def test_legal_bare_symbol(self, s: str): @@ -672,6 +676,8 @@ def test_legal_bare_symbol(self, s: str): ("sym", "ns", "ns/sym"), ("sym", "qualified.ns", "qualified.ns/sym"), ("sym", "really.qualified.ns", "really.qualified.ns/sym"), + ("sy:m", "ns", "ns/sy:m"), + ("sy:m", "n:s", "n:s/sy:m"), ], ) def test_legal_ns_symbol(self, s: str, ns: str, raw: str):