ohmjs / ohm

A library and language for building parsers, interpreters, compilers, etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proposed breaking changes

pdubroy opened this issue · comments

  • Deprecate node.primitiveValue. This is a remnant of the time when Ohm could be used to destructure objects, not just parse strings. It should be equivalent to sourceString now.
  • Get rid of grammarFromScriptElement. There is less need for it now since you can easily do multi-line strings in JS. Would also address #220.
  • Remove the methods related to example generation.
  • Fix sourceString on iter wrappers: it should return an Array that's the result of calling sourceString on all the child nodes.
    • scratching this since it's not compatible with the other changes we've made for v16. Operations and attributes should have a consistent return type no matter what the node type is. The proposed behavior can already be achieved via iterNode.children.map(c => c.sourceString).
  • Remove deprecated methods, e.g. Grammar.semantics().
  • Properly pull out extras into a separate package.

Typing-related things:

  • (Maybe) remove the implicit mapping behavior of iteration nodes, in favor of something more explicit, e.g. n.each.doSomething() instead of n.doSomething(). This would simplify the return type of operations.
    • alternatively, we could require the _iter action to be written.
  • Eliminate pass-through action when the single child is an iterator, as this is a type error. E.g., for a rule MaybeFoo = Foo?, we should require the user to write an action for MaybeFoo, rather than using the default pass-through action [#308]