Ruby's Line Breaks
summary
Ruby’s line-break rule is if a line break can end a sentence it does, but lexer-driven exceptions exist. Lexer uses 13 flags and acts as a double automaton so parser and lexer interaction makes some breaks ignored (notably endless ranges and unnamed number after splat). A model that combines parser and lex-state automatons is built by expanding grammar and adding lex-state-updating rules; it reveals those surprising exceptions and lets the team fix grammar-driven behavior.
AI-written summary · about
chapters (10)
- 0:00Introduction and welcome
- 1:03Ruby line breaks explained
- 3:52Key syntax concepts
- 7:17Automatons and parsers
- 11:17Lexer and lex state
- 15:57Challenges with lex state
- 20:17Modeling lex state
- 22:57Exceptions and edge cases
- 25:37Summary and future work
- 27:57Closing and acknowledgments
related talks
26mLiberating Ruby's Parser from Lexer Hacks
32mTime flies like an arrow; Fruit flies like a banana: Parsers for Great Good
32mParsing Ruby
29mHow does Lrama make the Ruby parser grammar G.O.A.T.?
46mGrammar a BNF like Ruby DSL Parsing
43mGrammars, Parsers, and Interpreters, In Ruby
41mWriting Lint for Ruby
40mRuby Writing Machines
