Analyzing Ruby Code in IRB
summary
IRB now combines Ripper tokenization with SyntaxTree/Prism parsing to do coloring, nesting, completion and execution checks, using Ripper lexer and prism.parseLex together. Prism 1.0 exposes about 151 nodes, so a hybrid rule set maps tokens plus node ranges to fix symbol/interpolation and here-doc edge cases. Nest and indent use node start/end traversal instead of ad‑hoc token subset logic. repl-type-completer (Ruby 3.4) gives chained-method completions but some type expansion is intentionally limited.
AI-written summary · about
chapters (8)
- 0:00Introduction
- 1:06Syntax highlighting in IRB
- 9:53Nesting analysis for indentation
- 16:34Code completion judgment
- 19:24Eval judgment and edge cases
- 23:39Echo suppression and output
- 25:45Auto-completion in IRB
- 28:55Future with Prism and Ripper
related talks
32mParsing Ruby
37mRuby Parser In IRB 20th Anniversary...Now Let Time Resume
40mThe Future of Understanding Ruby Code
43mGrammars, Parsers, and Interpreters, In Ruby
29mRuby Internals: A Guide For Rails Developers
52mTreetop: Syntactic Analysis with Ruby
24mRuby Internals
45mUsing Ruby to Generate Faster Ruby Code through Partial Evaluation
