https://ch2.erosson.org/#?q=( fails. that search is an invalid regex. Elm cannot catch, or otherwise recover from, this error! Apparently this is a known bug, to be fixed in 0.19 (whenever that arrives), but until then any regex-from-user-input is kinda screwed.
This ruins my plan for #39, giving different regex submatches different colors. ex. (a)|(b) would color nodes matching "a" red, and nodes matching "b" but not "a" blue. it works great for valid regexes, but it's way too easy to trip over an unmatched paren while typing and have the site completely stop responding.
should do one of the following:
redesign search to be not-a-regex. either plain string matches only, or a custom parser of some kind. (lots of work, less functionality.)
see if there's a prerelease of 0.19's String -> Result String Regex. api anywhere so we can handle regex errors gracefully. (great if it exists, but I couldn't find it. elm/regex[p] won't exist until 0.19; evancz/regex[p] doesn't seem to exist; can't write my own without figuring out native code voodoo.)
wait for elm 0.19 to release and fix this. (there is no release date.)
validate searches with JS+ports. (Probably the least awful in a list of awful choices.)
https://ch2.erosson.org/#?q=click works as expected. that search is a valid regex.
https://ch2.erosson.org/#?q=( fails. that search is an invalid regex. Elm cannot catch, or otherwise recover from, this error! Apparently this is a known bug, to be fixed in 0.19 (whenever that arrives), but until then any regex-from-user-input is kinda screwed.
This ruins my plan for #39, giving different regex submatches different colors. ex.
(a)|(b)
would color nodes matching "a" red, and nodes matching "b" but not "a" blue. it works great for valid regexes, but it's way too easy to trip over an unmatched paren while typing and have the site completely stop responding.should do one of the following:
String -> Result String Regex
. api anywhere so we can handle regex errors gracefully. (great if it exists, but I couldn't find it.elm/regex[p]
won't exist until 0.19;evancz/regex[p]
doesn't seem to exist; can't write my own without figuring out native code voodoo.)