Skip to content

Conversation

@notfoundzzz
Copy link
Owner

Motivation

  • Replace a Bash-only hardcoded special-case for recognizing # comments with a configurable parser option to avoid ad-hoc per-language code and make the rule data-driven.
  • Allow languages to require whitespace before inline comment starts so constructs like $# or ${#var} are not mis-highlighted as comments in Bash.

Description

  • Added a boolean flag and setter to the inline comment parser by updating src/Data/Parser/inline_comment_parser.hpp and src/Data/Parser/inline_comment_parser.cpp (m_require_space_before and set_require_space_before).
  • Made the parser obey the whitespace rule by returning false from can_parse() when m_require_space_before is true and the previous character is not whitespace in inline_comment_parser.cpp.
  • Wired a new space_before comment feature in prog_language_rep::customize_comment in src/System/Language/prog_language.cpp so languages can enable the rule via parser features and removed the previous Bash-specific # handling in get_color.
  • Enabled the rule for Bash by adding (space_before "true") to the Bash language config in TeXmacs/plugins/bash/progs/code/bash-lang.scm under the comment parser feature.

Testing

  • No automated tests were executed as part of this change (no test run was requested).

Codex Task

@notfoundzzz notfoundzzz force-pushed the zhl/209_7/fix-bash-lang branch 2 times, most recently from a05a5b2 to 2f5bafa Compare January 29, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants