Skip to content

Semicolon causes ERROR in Parameter Expansion #267

Open

Description

@jbdyn

Hi!

First of all, thank you all for your amazing work and precious time. ❤️

When using a semicolon ; in a parameter expansion, it causes a parsing ERROR, although it should not:

From playground :

Example 1

In:

${a:+$a;}

Out:

program [0, 0] - [1, 0]
  ERROR [0, 0] - [0, 9]
    variable_name [0, 2] - [0, 3]
    simple_expansion [0, 5] - [0, 7]
      variable_name [0, 6] - [0, 7]

Example 2

In (note the space after ;:

${a:+$a; }

Out:

program [0, 0] - [1, 0]
  command [0, 0] - [0, 10]
    name: command_name [0, 0] - [0, 10]
      expansion [0, 0] - [0, 10]
        variable_name [0, 2] - [0, 3]
        concatenation [0, 5] - [0, 9]
          simple_expansion [0, 5] - [0, 7]
            variable_name [0, 6] - [0, 7]
          ERROR [0, 7] - [0, 8]
          word [0, 8] - [0, 9]

The error occurs also when ; is not the last character in the default word.
When ; is a prefix or suffix pattern, it seems to be fine.

Activity

  1. changed the title [-]Semicolon causes ERROR in Paramter Expansion[/-] [+]Semicolon causes ERROR in Parameter Expansion[/+] on Jun 24, 2024
  2. sjmik commented on Oct 22, 2026

    @sjmik

    +1 encountered this today in zed

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions