pygments / pygments/pygments

bash lexer incorrect detection of heredoc

Open
#1,068 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

S-major T-bug X-imported
Dominant language
Python
Stars
2.2k
Forks
885
PR merge metrics
No merged PRs in 30d

Description

(Original issue 1364 created by 0e4ef622 on 2017-07-23T01:32:31.754829+00:00)

When bit shifting to the left, if the right operand occurs again in the script, the shift is incorrectly identified as a heredoc.

#!bash

# ok
$(( 1 << 3 ))
$(( 1 << 4 ))
#!bash

# not ok
$(( 1 << 3 ))
$(( 1 << 3 ))

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Pygments' bash lexer and reproduce the two arithmetic-shift snippets from the issue, comparing cases where the right operand is repeated. Done means repeated operands in left-shift expressions are not detected as heredocs, while genuine heredoc syntax remains correctly recognized.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.