Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing shell keyword in #1652

Closed
jmd-dk opened this issue Dec 29, 2020 · 1 comment
Closed

Missing shell keyword in #1652

jmd-dk opened this issue Dec 29, 2020 · 1 comment
Milestone

Comments

@jmd-dk
Copy link
Contributor

@jmd-dk jmd-dk commented Dec 29, 2020

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.

@Anteru Anteru closed this in d7dcc6d Dec 29, 2020
@Anteru
Copy link
Collaborator

@Anteru Anteru commented Dec 29, 2020

Thanks, good catch! As far as I can tell, it's in PowerShell already, it's not in TCSH, but it's a keyword in Bash/ZSH/KSH, so I added it to the BashLexer only.

@Anteru Anteru added this to the 2.7.4 milestone Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants