Closed genotrance closed 5 years ago
It is as simple as r.states.len != 0 but since states is a private field, there's no way to tell if a regex is initialized or not.
r.states.len != 0
states
I'm initializing many regexes recursively and can go into an infinite loop if I don't have a way to check if an object is already initialized.
For now, I'm going to "states: @[]" in $r but it seems hacky.
"states: @[]" in $r
I added r.isInitialized
r.isInitialized
https://github.com/nitely/nim-regex/commit/560cef536c78765b94754082c704678c4ebaae29
Brilliant!
It is as simple as
r.states.len != 0
but sincestates
is a private field, there's no way to tell if a regex is initialized or not.I'm initializing many regexes recursively and can go into an infinite loop if I don't have a way to check if an object is already initialized.
For now, I'm going to
"states: @[]" in $r
but it seems hacky.