---
source: brush-parser/src/parser/tests/complex.rs
expression: "ParseResult { input, result: &result }"
---
ParseResult(
  input: "if true; then\n    while read line; do\n        echo \"$line\"\n    done < file.txt\nfi",
  result: Program(
    complete_commands: [
      CompoundList([
        CompoundListItem(AndOrList(
          first: Pipeline(
            seq: [
              Compound(IfClause(IfClauseCommand(
                condition: CompoundList([
                  CompoundListItem(AndOrList(
                    first: Pipeline(
                      seq: [
                        Simple(SimpleCommand(
                          word_or_name: Some(Word(
                            value: "true",
                            loc: "[location]",
                          )),
                        )),
                      ],
                    ),
                  ), Sequence),
                ]),
                then: CompoundList([
                  CompoundListItem(AndOrList(
                    first: Pipeline(
                      seq: [
                        Compound(WhileClause(WhileOrUntilClauseCommand(CompoundList([
                          CompoundListItem(AndOrList(
                            first: Pipeline(
                              seq: [
                                Simple(SimpleCommand(
                                  word_or_name: Some(Word(
                                    value: "read",
                                    loc: "[location]",
                                  )),
                                  suffix: Some(CommandSuffix([
                                    Word(Word(
                                      value: "line",
                                      loc: "[location]",
                                    )),
                                  ])),
                                )),
                              ],
                            ),
                          ), Sequence),
                        ]), DoGroupCommand(
                          list: CompoundList([
                            CompoundListItem(AndOrList(
                              first: Pipeline(
                                seq: [
                                  Simple(SimpleCommand(
                                    word_or_name: Some(Word(
                                      value: "echo",
                                      loc: "[location]",
                                    )),
                                    suffix: Some(CommandSuffix([
                                      Word(Word(
                                        value: "\"$line\"",
                                        loc: "[location]",
                                      )),
                                    ])),
                                  )),
                                ],
                              ),
                            ), Sequence),
                          ]),
                          loc: "[location]",
                        ), SourceSpan(
                          start: SourcePosition(
                            index: 18,
                            line: 2,
                            column: 5,
                          ),
                          end: SourcePosition(
                            index: 67,
                            line: 4,
                            column: 9,
                          ),
                        ))), Some(RedirectList([
                          File(None, Read, Filename(Word(
                            value: "file.txt",
                            loc: "[location]",
                          ))),
                        ]))),
                      ],
                    ),
                  ), Sequence),
                ]),
                loc: "[location]",
              )), None),
            ],
          ),
        ), Sequence),
      ]),
    ],
  ),
)
