Skip to content

Missing shell keyword in #1652

@jmd-dk

Description

@jmd-dk

The shell lexer does not include the in keyword. In particular, the BashLexer class contains the following basic tokens:

if|fi|else|while|do|done|for|then|return|function|case|select|continue|until|esac|elif

which does not include in. Thus Bash code like

for i in 1 2 3; do
    echo $i
done

is not lexed and formatted correctly with respect to in (unlike the rendering above as done by GitHub).

This is easily fixed by just adding in to the list of tokens. I believe the in keyword is not present for any of the shell lexers in lexers/shell.py, though I do not know which of the non-Bash shells also supports this keyword.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions