regex_objects.py in the hyperon root doesn't look nice. I'd just put its code into stdlib.py for now, and wouldn't introduce a separate regex_atom just for one token. There are text_ops, where regex can be put for now (or, maybe, in type_tokens if it should be a token rather than an atom). If regex-related functionality becomes richer (or united with other string-processing tools), then we can either have a subfolder (stdlib or whatever) with this and possibly other larger parts of stdlib in separate files, or move it to its own module.
Regarding [[, etc., you can take a look how String is implemented in stdlib (with "\"[^\"]*\""). Something like "r\"[^\"]*\"" (like in Python, or "regex:... if we want to be more verbose) may work
regex_matcher_test.metta is not added as a unit test, and scripts folder is organized in a certain way. So, this test/example should either be put at some place in the other scripts, or should be just a Python test. But I can sort it out later, so maybe no actions should be taken regarding this point.
InG(RegexMatchableObject(value, atom_id), AtomType.UNDEFINED) it might be better to use Regex instead ofUNDEFINED.
A few minor comments.
regex_objects.py
in thehyperon
root doesn't look nice. I'd just put its code intostdlib.py
for now, and wouldn't introduce a separateregex_atom
just for one token. There aretext_ops
, whereregex
can be put for now (or, maybe, intype_tokens
if it should be a token rather than an atom). If regex-related functionality becomes richer (or united with other string-processing tools), then we can either have a subfolder (stdlib
or whatever) with this and possibly other larger parts ofstdlib
in separate files, or move it to its own module.[[
, etc., you can take a look howString
is implemented instdlib
(with"\"[^\"]*\""
). Something like"r\"[^\"]*\""
(like in Python, or"regex:...
if we want to be more verbose) may workregex_matcher_test.metta
is not added as a unit test, andscripts
folder is organized in a certain way. So, this test/example should either be put at some place in the other scripts, or should be just a Python test. But I can sort it out later, so maybe no actions should be taken regarding this point.G(RegexMatchableObject(value, atom_id), AtomType.UNDEFINED)
it might be better to useRegex
instead ofUNDEFINED
.