(command.CommandList
  children: [
    (C {<_Dbg_help_add>} {(SQ <reverse>)} 
      {(SQ <'?search\n'> <'\n'> <'Search backword and list line of a script.'>)}
    )
    (command.ShFunction
      name: _Dbg_do_reverse
      body: 
        (BraceGroup
          children: [
            (C {<typeset>} {<Id.Lit_VarLike 'delim_search_pat='> ($ Id.VSub_Number '$1')})
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DParen
                              child: 
                                (arith_expr.Binary
                                  op_id: Id.Arith_Less
                                  left: {($ Id.VSub_Pound '$#')}
                                  right: {<Id.Lit_Digits 1>}
                                )
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<_Dbg_errmsg>} {(DQ <'Need a search pattern'>)})
                    (command.ControlFlow
                      token: <Id.ControlFlow_Return return>
                      arg_word: {<1>}
                    )
                  ]
                  spids: [86 101]
                )
              ]
            )
            (C {<shift>})
            (command.Case
              to_match: {(DQ ($ Id.VSub_DollarName '$delim_search_pat'))}
              arms: [
                (case_arm
                  pat_list: [{<Id.Lit_LBracket '['> <Id.Lit_QMark '?'> <Id.Lit_RBracket ']'>}]
                  spids: [132 136 139 -1]
                )
                (case_arm
                  pat_list: [
                    {<Id.Lit_LBracket '['> <Id.Lit_QMark '?'> <Id.Lit_RBracket ']'> <Id.Lit_Star '*'>}
                  ]
                  action: [
                    (C {<typeset>} {<-a>} {<word>})
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:word)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (sh_array_literal
                                left: <Id.Op_LParen _>
                                words: [
                                  {
                                    (command_sub
                                      left_token: <Id.Left_DollarParen '$('>
                                      child: 
                                        (C {<_Dbg_split>} {(SQ <'?'>)} 
                                          {($ Id.VSub_DollarName '$delim_search_pat')}
                                        )
                                    )
                                  }
                                ]
                              )
                            }
                          spids: [157]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:_Dbg_last_search_pat)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (braced_var_sub
                                token: <Id.VSub_Name word>
                                bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 0>})
                              )
                            }
                          spids: [171]
                        )
                      ]
                    )
                  ]
                  spids: [142 147 180 -1]
                )
                (case_arm
                  pat_list: [{<Id.Lit_Star '*'>}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:_Dbg_last_search_pat)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_DollarName '$delim_search_pat')}
                          spids: [192]
                        )
                      ]
                    )
                  ]
                  spids: [187 189 -1 196]
                )
              ]
            )
            (C {<typeset>} {<-i>} {<i>})
            (command.ForExpr
              init: 
                (arith_expr.BinaryAssign
                  op_id: Id.Arith_Equal
                  left: <Id.Lit_ArithVarLike i>
                  right: 
                    (arith_expr.Binary
                      op_id: Id.Arith_Minus
                      left: <Id.Lit_ArithVarLike _Dbg_listline>
                      right: {<Id.Lit_Digits 1>}
                    )
                )
              cond: 
                (arith_expr.Binary
                  op_id: Id.Arith_Great
                  left: <Id.Lit_ArithVarLike i>
                  right: {<Id.Lit_Digits 0>}
                )
              update: (arith_expr.UnaryAssign op_id:Id.Node_PostDMinus child:<Id.Lit_ArithVarLike i>)
              body: 
                (command.DoGroup
                  children: [
                    (C {<_Dbg_get_source_line>} {($ Id.VSub_DollarName '$i')} 
                      {(DQ ($ Id.VSub_DollarName '$_Dbg_frame_last_filename'))}
                    )
                    (C {<eval>} {(DQ ($ Id.VSub_DollarName '$_seteglob'))})
                    (command.If
                      arms: [
                        (if_arm
                          cond: 
                            (condition.Shell
                              commands: [
                                (command.Sentence
                                  child: 
                                    (command.DBracket
                                      expr: 
                                        (bool_expr.Binary
                                          op_id: Id.BoolBinary_GlobDEqual
                                          left: {($ Id.VSub_DollarName '$_Dbg_source_line')}
                                          right: 
                                            {<Id.Lit_Other '*'> 
                                              ($ Id.VSub_DollarName '$_Dbg_last_search_pat') <Id.Lit_Other '*'>
                                            }
                                        )
                                    )
                                  terminator: <Id.Op_Semi _>
                                )
                              ]
                            )
                          action: [
                            (C {<eval>} {(DQ ($ Id.VSub_DollarName '$_resteglob'))})
                            (C {<_Dbg_do_list>} {($ Id.VSub_DollarName '$i')} {<1>})
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:_Dbg_listline)
                                  op: assign_op.Equal
                                  rhs: {($ Id.VSub_DollarName '$i')}
                                  spids: [285]
                                )
                              ]
                            )
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:_Dbg_last_cmd)
                                  op: assign_op.Equal
                                  rhs: {(SQ <search>)}
                                  spids: [289]
                                )
                              ]
                            )
                            (command.ControlFlow
                              token: <Id.ControlFlow_Return return>
                              arg_word: {<0>}
                            )
                          ]
                          spids: [252 268]
                        )
                      ]
                    )
                    (C {<eval>} {(DQ ($ Id.VSub_DollarName '$_resteglob'))})
                  ]
                )
            )
            (C {<_Dbg_msg>} 
              {
                (DQ <'search pattern: '> ($ Id.VSub_DollarName '$_Dbg_last_search_pat') <' not found.'>)
              }
            )
            (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>})
          ]
        )
    )
    (C {<_Dbg_help_add>} {(SQ <search>)} {(SQ <'/search/ -- Search forward and list line of a script.'>)})
    (command.ShFunction
      name: _Dbg_do_search
      body: 
        (BraceGroup
          children: [
            (C {<typeset>} {<Id.Lit_VarLike 'delim_search_pat='> (${ Id.VSub_Number 1)})
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (command.DParen
                              child: 
                                (arith_expr.Binary
                                  op_id: Id.Arith_Less
                                  left: {($ Id.VSub_Pound '$#')}
                                  right: {<Id.Lit_Digits 1>}
                                )
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  action: [
                    (C {<_Dbg_errmsg>} {(DQ <'Need a search pattern'>)})
                    (command.ControlFlow
                      token: <Id.ControlFlow_Return return>
                      arg_word: {<1>}
                    )
                  ]
                  spids: [361 376]
                )
              ]
            )
            (C {<shift>})
            (C {<typeset>} {<search_pat>})
            (command.Case
              to_match: {(DQ ($ Id.VSub_DollarName '$delim_search_pat'))}
              arms: [
                (case_arm pat_list:[{<'/'>}] spids:[411 413 416 -1])
                (case_arm
                  pat_list: [{<'/'> <Id.Lit_Star '*'>}]
                  action: [
                    (C {<typeset>} {<-a>} {<word>})
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:word)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (sh_array_literal
                                left: <Id.Op_LParen _>
                                words: [
                                  {
                                    (command_sub
                                      left_token: <Id.Left_DollarParen '$('>
                                      child: 
                                        (C {<_Dbg_split>} {(SQ <'/'>)} 
                                          {($ Id.VSub_DollarName '$delim_search_pat')}
                                        )
                                    )
                                  }
                                ]
                              )
                            }
                          spids: [432]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:_Dbg_last_search_pat)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (braced_var_sub
                                token: <Id.VSub_Name word>
                                bracket_op: (bracket_op.ArrayIndex expr:{<Id.Lit_Digits 0>})
                              )
                            }
                          spids: [446]
                        )
                      ]
                    )
                  ]
                  spids: [419 422 455 -1]
                )
                (case_arm
                  pat_list: [{<Id.Lit_Star '*'>}]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:_Dbg_last_search_pat)
                          op: assign_op.Equal
                          rhs: {($ Id.VSub_DollarName '$delim_search_pat')}
                          spids: [463]
                        )
                      ]
                    )
                  ]
                  spids: [458 460 -1 467]
                )
              ]
            )
            (C {<typeset>} {<max_line>})
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:max_line)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: 
                          (C {<_Dbg_get_maxline>} 
                            {(DQ ($ Id.VSub_DollarName '$_Dbg_frame_last_filename'))}
                          )
                      )
                    }
                  spids: [476]
                )
              ]
            )
            (C {<typeset>} {<-i>} {<i>})
            (command.ForExpr
              init: 
                (arith_expr.BinaryAssign
                  op_id: Id.Arith_Equal
                  left: <Id.Lit_ArithVarLike i>
                  right: 
                    (arith_expr.Binary
                      op_id: Id.Arith_Plus
                      left: <Id.Lit_ArithVarLike _Dbg_listline>
                      right: {<Id.Lit_Digits 1>}
                    )
                )
              cond: 
                (arith_expr.Binary
                  op_id: Id.Arith_Less
                  left: <Id.Lit_ArithVarLike i>
                  right: <Id.Lit_ArithVarLike max_line>
                )
              update: (arith_expr.UnaryAssign op_id:Id.Node_PostDPlus child:<Id.Lit_ArithVarLike i>)
              body: 
                (command.DoGroup
                  children: [
                    (C {<_Dbg_get_source_line>} {($ Id.VSub_DollarName '$i')} 
                      {(DQ ($ Id.VSub_DollarName '$_Dbg_frame_last_filename'))}
                    )
                    (C {<eval>} {(DQ ($ Id.VSub_DollarName '$_seteglob'))})
                    (command.If
                      arms: [
                        (if_arm
                          cond: 
                            (condition.Shell
                              commands: [
                                (command.Sentence
                                  child: 
                                    (command.DBracket
                                      expr: 
                                        (bool_expr.Binary
                                          op_id: Id.BoolBinary_GlobDEqual
                                          left: {($ Id.VSub_DollarName '$_Dbg_source_line')}
                                          right: 
                                            {<Id.Lit_Other '*'> 
                                              ($ Id.VSub_DollarName '$_Dbg_last_search_pat') <Id.Lit_Other '*'>
                                            }
                                        )
                                    )
                                  terminator: <Id.Op_Semi _>
                                )
                              ]
                            )
                          action: [
                            (C {<eval>} {(DQ ($ Id.VSub_DollarName '$_resteglob'))})
                            (C {<_Dbg_do_list>} {($ Id.VSub_DollarName '$i')} {<1>})
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:_Dbg_listline)
                                  op: assign_op.Equal
                                  rhs: {($ Id.VSub_DollarName '$i')}
                                  spids: [573]
                                )
                              ]
                            )
                            (command.ControlFlow
                              token: <Id.ControlFlow_Return return>
                              arg_word: {<0>}
                            )
                          ]
                          spids: [540 556]
                        )
                      ]
                    )
                    (C {<eval>} {(DQ ($ Id.VSub_DollarName '$_resteglob'))})
                  ]
                )
            )
            (C {<_Dbg_errmsg>} 
              {
                (DQ <'search pattern: '> ($ Id.VSub_DollarName '$_Dbg_last_search_pat') <' not found.'>)
              }
            )
            (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>})
          ]
        )
    )
  ]
)