colis-anr / morbig

A static parser for POSIX Shell
Other
190 stars 8 forks source link

Weird parsing of imbricated quotes. #109

Open Niols opened 5 years ago

Niols commented 5 years ago

When parsing:

${foo:-"bar"}

Morbig gives:

[
    "Word",
    "${foo:-\"bar\"}",
    [
        [
            "WordVariable",
            [
                "VariableAtom",
                "foo",
                [
                    "UseDefaultValues",
                    ":-",
                    [
                        "Word",
                        "\"bar\"",
                        [
                            [
                                "WordDoubleQuoted",
                                [
                                    "Word",
                                    "\"bar\"",
                                    [
                                        [
                                            "WordDoubleQuoted",
                                            [
                        "Word",
                        "bar",
                        [ [ "WordLiteral", "bar" ] ]
                                            ]
                                        ]
                                    ]
                                ]
                            ]
                        ]
                    ]
                ]
            ]
        ]
    ]
]

where we have WordDoubleQuoted inside WordDoubleQuoted. I thought it wasn't supposed to happen. Is it?