Skip to content

Command required after assignment #461

Closed
@phy1729

Description

@phy1729
Member

zsh errors out with a parse error for
FOO=bar { :; }
FOO=bar ( :; )
FOO=bar (( foo ))
FOO=bar [[ foo ]]
FOO=bar ! :
We should highlight the word after the assignment as an unknown-token (or perhaps other style) as long as these are parse errors.

Activity

danielshahaf

danielshahaf commented on Dec 5, 2017

@danielshahaf
Member

What's the rule?

danielshahaf

danielshahaf commented on Dec 5, 2017

@danielshahaf
Member

[[ is a reserved word. What about builtins?

danielshahaf

danielshahaf commented on Dec 5, 2017

@danielshahaf
Member

@phy1729 reports builtins don't error

danielshahaf

danielshahaf commented on Dec 6, 2017

@danielshahaf
Member

Asked upstream about the syntax users/23000

danielshahaf

danielshahaf commented on Dec 6, 2017

@danielshahaf
Member

Could you have a look at danielshahaf@d2ed7f4?

phy1729

phy1729 commented on Jan 20, 2018

@phy1729
MemberAuthor

Could use a test, but the code looks good.

self-assigned this
on Jan 20, 2018
removed their assignment
on Oct 28, 2019
danielshahaf

danielshahaf commented on Mar 19, 2020

@danielshahaf
Member

Asked upstream about the syntax users/23000

Upstream's answer (by Bart):

Literally, the rule is "parameter assignments may precede only a simple command." (In fact the assignment syntax is part of the definition of simple command syntax.)

Of the set of $reswords from zsh/parameter, "nocorrect" and all of the aliases for "typeset" may begin a simple command. The rest may not.

3 remaining items

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @phy1729@danielshahaf

        Issue actions

          Command required after assignment · Issue #461 · zsh-users/zsh-syntax-highlighting