ruby / prism

Prism Ruby parser

Home Page:https://ruby.github.io/prism/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Better scope prism's C API

kddnewton opened this issue · comments

At the moment, prism exposes a lot of structs and functions in its C API. Overall, the shape is not clearly defined. We should take a couple of steps to resolve this:

  • We should have a split between our public and private header files.
  • Ideally, I would love pm_node_t to be an opaque pointer. Because they are always heap-allocated, we should be able to get away with this.
  • The public API should be documented here: https://ruby.github.io/prism/c/index.html. At the moment, it is clear that too much is exposed.
  • Every attribute should have a defined getter macro to make it maintainable going forward, in case we need to change a name or the structure of the AST.