Skip to content
andychu edited this page Oct 20, 2017 · 20 revisions

Facts

  • 15 lexer modes (lexical state)
  • 233 IDs (token types / node types) in 23 kinds? (core/id_kind_test.py shows this)
  • 3 recursive descent parsers (command, word, [[)
  • 1 Pratt parser (arithmetic)
  • [ fallback reuses osh/bool_parser

Other Parser Components That Do String Manipulation

  • Brace detection -- this is a separate metaprogramming pass (doesn't depend on input). This is a recursive parser.
  • core/glob_.py -- escape and unescape

Runtime String Manipulation

  • core/word_eval.py -- after evaluating VarOp arguments, we compile globs to Python regexes, e.g. for ${x%foo*}
  • IFS splitting
  • core/args.py -- this is not a recursive parser

Clone this wiki locally