ohm
ohm copied to clipboard
Allow a semantics to be passed an input string OR a matchResult.
Since a semantics instance is always associated with a particular, concrete grammar, we could support a shorthand that avoids calling g.match:
var g = ohm.grammar('Arithmetic { ... }');
s = g.semantics().addOperation('eval()', { ... });
s('1 + 2').eval();
If the input fails to match, I guess it would have to throw an exception.
I guess that makes sense without the object matching now.
Don't think we need this — closing.