Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Modifying AST and generating source code

未关闭
#3,466 11 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
ruby
领域
compilers

调研方向

从 issue 中描述的 Prism.parse(text) 入口点和 Prism::Visitor 用法开始。检查 Prism 是否记录了可变 AST 遍历或源代码重新生成,并找出现有的涵盖这些 API 的示例或测试。只有在支持的转换和 unparse 行为得到定义并完成文档记录或实现后,范围才算完成。

由索引模型根据 Issue 内容生成。

描述

enhancement

Forgive my ignorance but I'm trying to use Prism to modify Ruby source (add nodes) and then regenerate the source to be interpreted. I'm using Prism.parse(text) and then implementing a Prism::Visitor to potentially modify the nodes as they are visited. I assume this is possible but I haven't really seen any examples of it. Finally I would like to 'unparse' the AST back into source code.

The Python equivalent is indeed unparse which is where I'm taking many of the ideas. They also have a NodeTransformer which is allowed to modify the nodes in the visit pattern. I don't see equivalents in Prism but perhaps you're always allowed to modify the nodes ... this is Ruby afterall.

Thanks for any help pointing me in the right direction!

主要语言
C
星标
1k
派生
194
平均合并
2 天 6 小时
30 天内合并 PR
15

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ruby/prism 的其他 Issue

查看 ruby/prism 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。