morganstanley / hobbes

A language and an embedded JIT compiler

Home Page:http://hobbes.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

match with regex doesn't set variable correctly when backtracking.

adam-antonik opened this issue · comments

Changing the example from the from the front-page slightly to match "f(o*)obar"

match "foobar" with
| 'f(?<os>o*)obar' -> os
| _               -> "???"

will evaluate to "oo", not "o". Similarly, if we use 'f(?.*)bar', then os = "oobar".

Good catch, I will take a look.

Sorry adam, lots going on, I'm no longer part of the project or Morgan Stanley, can't submit a change anymore. I might be able to get a fix into my fork but have some other issues to take care of first.