(command.CommandList
  children: [
    (C {(set)} {(-o)} {(nounset)})
    (C {(set)} {(-o)} {(pipefail)})
    (C {(set)} {(-o)} {(errexit)})
    (C {(source)} {(test/common.sh)})
    (command.FuncDef
      name: process-file
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:proj)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:abs_path)
                  op: Equal
                  rhs: {($ VSub_Number '$2')}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:rel_path)
                  op: Equal
                  rhs: {($ VSub_Number '$3')}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:raw_base)
                  op: Equal
                  rhs: 
                    {(_tmp/wild/raw/) ($ VSub_DollarName '$proj') (/) ($ VSub_DollarName '$rel_path')}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:www_base)
                  op: Equal
                  rhs: 
                    {(_tmp/wild/www/) ($ VSub_DollarName '$proj') (/) ($ VSub_DollarName '$rel_path')}
                )
              ]
            )
            (C {(mkdir)} {(-p)} 
              {
                (word_part.CommandSubPart
                  command_list: 
                    (command.CommandList
                      children: [(C {(dirname)} {($ VSub_DollarName '$raw_base')})]
                    )
                  left_token: <Left_DollarParen '$('>
                )
              }
            )
            (C {(mkdir)} {(-p)} 
              {
                (word_part.CommandSubPart
                  command_list: 
                    (command.CommandList
                      children: [(C {(dirname)} {($ VSub_DollarName '$www_base')})]
                    )
                  left_token: <Left_DollarParen '$('>
                )
              }
            )
            (C {(log)} 
              {
                (DQ ('--- Processing ') ($ VSub_DollarName '$proj') (' - ') 
                  ($ VSub_DollarName '$rel_path')
                )
              }
            )
            (command.SimpleCommand
              words: [{(wc)} {($ VSub_DollarName '$abs_path')}]
              redirects: [
                (redir.Redir
                  op: <Redir_Great '>'>
                  fd: 16777215
                  arg_word: {(${ VSub_Name raw_base) (__wc.txt)}
                )
              ]
            )
            (C {(cp)} {($ VSub_DollarName '$abs_path')} {(${ VSub_Name www_base) (.txt)})
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:task_file)
                  op: Equal
                  rhs: {(${ VSub_Name raw_base) (__parse.task.txt)}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:stderr_file)
                  op: Equal
                  rhs: {(${ VSub_Name raw_base) (__parse.stderr.txt)}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:out_file)
                  op: Equal
                  rhs: {(${ VSub_Name www_base) (__ast.html)}
                )
              ]
            )
            (command.SimpleCommand
              words: [
                {(run-task-with-status)}
                {($ VSub_DollarName '$task_file')}
                {(bin/osh)}
                {(--ast-format)}
                {(abbrev-html)}
                {(-n)}
                {($ VSub_DollarName '$abs_path')}
              ]
              redirects: [
                (redir.Redir
                  op: <Redir_Great '>'>
                  fd: 16777215
                  arg_word: {($ VSub_DollarName '$out_file')}
                )
                (redir.Redir
                  op: <Redir_Great '2>'>
                  fd: 2
                  arg_word: {($ VSub_DollarName '$stderr_file')}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:task_file)
                  op: Equal
                  rhs: {(${ VSub_Name raw_base) (__osh2oil.task.txt)}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:stderr_file)
                  op: Equal
                  rhs: {(${ VSub_Name raw_base) (__osh2oil.stderr.txt)}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:out_file)
                  op: Equal
                  rhs: {(${ VSub_Name www_base) (__oil.txt)}
                )
              ]
            )
            (command.SimpleCommand
              words: [
                {(run-task-with-status)}
                {($ VSub_DollarName '$task_file')}
                {($ VSub_DollarName '$OSH')}
                {(-n)}
                {(--fix)}
                {($ VSub_DollarName '$abs_path')}
              ]
              redirects: [
                (redir.Redir
                  op: <Redir_Great '>'>
                  fd: 16777215
                  arg_word: {($ VSub_DollarName '$out_file')}
                )
                (redir.Redir
                  op: <Redir_Great '2>'>
                  fd: 2
                  arg_word: {($ VSub_DollarName '$stderr_file')}
                )
              ]
            )
          ]
        )
    )
    (command.Assignment
      keyword: Assign_Readonly
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:NUM_TASKS) op:Equal rhs:{(200)})]
    )
    (command.Assignment
      keyword: Assign_Readonly
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:MANIFEST)
          op: Equal
          rhs: {(_tmp/wild/MANIFEST.txt)}
        )
      ]
    )
    (command.FuncDef
      name: parse-in-parallel
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:failed) op:Equal rhs:{(SQ )})]
            )
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (C {(xargs)} {(-n)} {(3)} {(-P)} {($ VSub_DollarName '$JOBS')} {(--)} {($ VSub_Number '$0')} 
                  {(process-file)}
                )
                (command.Assignment
                  keyword: Assign_None
                  pairs: [(assign_pair lhs:(lhs_expr.LhsName name:failed) op:Equal rhs:{(1)})]
                )
              ]
            )
            (C {(tree)} {(-L)} {(3)} {(_tmp/wild)})
          ]
        )
    )
    (command.FuncDef
      name: parse-and-report
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:manifest_regex)
                  op: Equal
                  rhs: 
                    {
                      (word_part.BracedVarSub
                        token: <VSub_Number 1>
                        suffix_op: (suffix_op.StringUnary op_id:VTest_ColonHyphen arg_word:{})
                      )
                    }
                )
              ]
            )
            (command.TimeBlock
              pipeline: 
                (command.BraceGroup
                  children: [
                    (C {(test/wild.sh)} {(write-manifest)})
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: (C {(test)} {(-n)} {(DQ ($ VSub_DollarName '$manifest_regex'))})
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (command.Pipeline
                              children: [
                                (C {(egrep)} {(--)} {(DQ ($ VSub_DollarName '$manifest_regex'))} 
                                  {($ VSub_DollarName '$MANIFEST')}
                                )
                                (C {(parse-in-parallel)})
                              ]
                              negated: F
                            )
                          ]
                        )
                      ]
                      else_action: [
                        (command.Pipeline
                          children: [
                            (C {(cat)} {($ VSub_DollarName '$MANIFEST')})
                            (C {(parse-in-parallel)})
                          ]
                          negated: F
                        )
                      ]
                    )
                    (C {(make-report)})
                  ]
                )
            )
          ]
        )
    )
    (command.FuncDef
      name: wild-report
      body: 
        (command.BraceGroup
          children: [
            (command.SimpleCommand
              words: [{(test/wild_report.py)} {(DQ ($ VSub_At '$@'))}]
              more_env: [
                (env_pair
                  name: PYTHONPATH
                  val: {(Lit_TildeLike '~') (/hg/json-template/python)}
                )
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: _link
      body: (command.BraceGroup children:[(C {(ln)} {(-s)} {(-f)} {(-v)} {(DQ ($ VSub_At '$@'))})])
    )
    (command.FuncDef
      name: make-report
      body: 
        (command.BraceGroup
          children: [
            (command.Pipeline
              children: [
                (C {(cat)} {($ VSub_DollarName '$MANIFEST')})
                (C {(wild-report)} {(summarize-dirs)})
              ]
              negated: F
            )
            (C {(_link)} 
              (word.BracedWordTree
                parts: [
                  ($ VSub_DollarName '$PWD')
                  (/web/osh-to-oil.)
                  (word_part.BracedTuple words:[{(html)} {(js)}])
                ]
              ) {(_tmp/wild/www)}
            )
            (C {(_link)} {($ VSub_DollarName '$PWD') (/web)} {(_tmp)})
          ]
        )
    )
    (command.FuncDef
      name: test-wild-report
      body: 
        (command.BraceGroup
          children: [
            (command.Pipeline
              children: [
                (C {(egrep)} {(--)} {(SQ <'^oil|^perf-tools'>)} {($ VSub_DollarName '$MANIFEST')})
                (C {(wild-report)} {(summarize-dirs)})
              ]
              negated: F
            )
          ]
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(test)} 
                  {
                    (DQ 
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [(C {(basename)} {($ VSub_Number '$0')})]
                          )
                        left_token: <Left_DollarParen '$('>
                      )
                    )
                  } {(Lit_Other '=')} {(SQ <wild-runner.sh>)}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(DQ ($ VSub_At '$@'))})]
        )
      ]
    )
  ]
)