Skip to content

Does not minify case statements well. #3

@fidian

Description

@fidian

Input script:

#!/usr/bin/env bash
case "$PATH" in
    thing)
        echo "Shouldn't match this."
        ;;
esac

Resulting minified code:

case "$PATH" in thing);echo "Shouldn't match this.";;;esac

Bash's error:

bash: test.min: line 1: syntax error near unexpected token `;'
bash: test.min: line 1: `case "$PATH" in thing);echo "Shouldn't match this.";;;esac'

There shouldn't be a semicolon after the close parenthesis. Also, the three ;;; in a row cause a problem. Here's the fixed version:

case "$PATH" in thing) echo "Shouldn't match this." ;; esac

Also, you might need to treat ;& and ;;& because they parse similarly to ;;.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions