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

fix: parse '#' as char only if inside a variable expansion #418

Merged
merged 1 commit into from
Mar 21, 2025

Conversation

idealseal
Copy link
Contributor

Only in arithmetic expressions '#' is a valid token, in other contexts it is treated as a comment, and all following characters will be ignored by the tokenizer.

Closes: #408

Copy link

github-actions bot commented Mar 20, 2025

Performance Benchmark Report

Benchmark name Baseline (μs) Test/PR (μs) Delta (μs) Delta %
clone_shell_object 18.52 μs 17.77 μs -0.76 μs 🟢 -4.08%
eval_arithmetic 0.17 μs 0.17 μs 0.00 μs ⚪ Unchanged
expand_one_string 1.79 μs 1.82 μs 0.03 μs ⚪ Unchanged
for_loop 22.18 μs 21.95 μs -0.23 μs ⚪ Unchanged
function_call 2.32 μs 2.33 μs 0.01 μs ⚪ Unchanged
instantiate_shell 56.96 μs 56.72 μs -0.24 μs ⚪ Unchanged
instantiate_shell_with_init_scripts 23729.14 μs 22736.16 μs -992.97 μs ⚪ Unchanged
parse_bash_completion 1660.71 μs 1652.97 μs -7.74 μs ⚪ Unchanged
parse_sample_script 1.76 μs 1.74 μs -0.02 μs 🟢 -1.36%
run_echo_builtin_command 15.62 μs 15.32 μs -0.30 μs ⚪ Unchanged
run_one_external_command 2035.24 μs 3881.02 μs 1845.78 μs 🟠 +90.69%
tokenize_sample_script 2.79 μs 2.84 μs 0.05 μs 🟠 +1.83%

Code Coverage Report: Only Changed Files listed

Package Base Coverage New Coverage Difference
Overall Coverage 🟢 78.28% 🟢 78.28% ⚪ 0%

Minimum allowed coverage is 70%, this run produced 78.28%

Test Summary: bash-completion test suite

Outcome Count Percentage
✅ Pass 1345 63.77
❗️ Error 229 10.86
❌ Fail 157 7.44
⏩ Skip 366 17.35
❎ Expected Fail 11 0.52
✔️ Unexpected Pass 1 0.05
📊 Total 2109 100.00

Copy link
Owner

@reubeno reubeno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing a fix for the issue! I have a few comments/questions about testing, but the fix seems like a reasonable, targeted one to go with.

@idealseal idealseal force-pushed the push-lktvlvlmkrlu branch 2 times, most recently from 8608327 to ca0ce8d Compare March 21, 2025 22:22
Only in arithmetic expressions '#' is a valid token, in other contexts it
is treated as a comment, and all following characters will be ignored by
the tokenizer.

Closes: reubeno#408

Signed-off-by: idealseal <realidealseal@protonmail.com>
Copy link
Owner

@reubeno reubeno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making those changes, @idealseal. LGTM

@reubeno reubeno merged commit e55ecd2 into reubeno:main Mar 21, 2025
21 checks passed
@idealseal idealseal deleted the push-lktvlvlmkrlu branch March 22, 2025 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quotes in comments inside of sub shells are not ignored and generate an error if not terminated.
2 participants