Skip to content

[bug] mid-word {/} braces mis-lexed as word delimiters: function names like ble/highlight/layer:{selection}/declare are a fatal syntax error (ble.sh -n now blocked at line 14525) #244

Closed

Description

@caomengxuan666

Corpus: ble.sh nightly-2026-09-27 (corpus2 re-run after the #215 fix). Found while re-verifying the #215 lane: the ANSI-C lexer fix advanced rubash -n corpora/ble.sh past line 7319; the parse now dies at a NEW site.

Minimal reproducer (LF script file, identical bytes both shells):

function ble/x:{s}/d {
  echo ok
}
echo done

Full-file impact: rubash -n ble.sh now reports ble.sh: line 14525: syntax error near unexpected token '}' (GNU rc=0). Line 14525 closes function ble/highlight/layer:{selection}/declare { (ble.sh uses {selection}-style names throughout the highlight layer section, ~dozens of sites).

GNU C source owner: parse.y:5305 read_token_word() assembles a word until a shell metacharacter; { and } are NOT in the shellmeta/shellbreak tables (general.c sh_shellmeta() — only space/tab/newline and |&;()<>), so mid-word braces are word text. The reserved word { is only recognized when an entire word at command position (parse.y word → reserved word check). Rubash's lexer delimiter set treats {} as word delimiters universally (src/lexer/classification.rs is_word_delimiter: " \t\r\n|&;<>(){}"), which is the wrong invariant for mid-word positions.

Classification: rubash-caused, parse-level (byte-reproduced both shells from identical files). Artifacts: target/issue-suites/results/corpus2/results/ble/n.rubash.err, bisect probes probe/p-new1-min*.sh (min3/min5/min6 all GNU rc=0 vs rubash rc=2).

Fix direction (not attempted in the #214-#217 lane): the class fix is in the word scanner's delimiter classification — {/} must only end a word when positioned as the reserved-word token (start of word at command position), never mid-word; GNU owner read_token_word + sh_shellmeta. Note ble.sh source-mode now PARSES but times out (see companion issue).

Activity

  1. caomengxuan666 commented on Sep 27, 2026

    @caomengxuan666
    MemberAuthor

    已修复并合入 master(commit b20fb6a7,lane wt5/ble;GNU 引用与矩阵验证见提交:#244 词中 {} 不再是分隔符(syntax.h:29-30 两表均无)+函数名取任意 WORD;#245 算术 ((...<<=...)) 不再误判 heredoc(parse.y:3727 parse_dparen 先于重定向分支)——ble.sh source 终止且 rc=1 与 GNU 一致;#246 arrayfunc.c:454/498 无条件转数组(5.3.0 与 5.2.21 同行为)。ble.sh -n 推进到 28570 的新阻塞已开 #255。感谢报告!

  2. added
    bug
    area:parser
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:parserbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions