Skip to content

prism: OCaml (* ... *) block comments leak into code_stream (34/35 keyword families affected) #9303

Done

Description

@squid-protocol

Bug

Surfaced by the parserless keyword-family decoy runner (tests/tools/family_decoy_runner.py, part of #8863):

OCaml (gitgalaxy/standards/language_standards/languages/ocaml.py) currently sets lexical_family: "recursive_block", which only strips C-style // and /* ... */ comments. OCaml's actual comment syntax (* ... *) (including nested block comments) is not stripped by Prism.split_streams(), so 34 of 35 code-stream keyword families fire on keywords inside OCaml comments.

(F# also supports (* ... *) block comments in addition to //, so adding (* ... *) support to Prism will benefit both OCaml and F#.)

Repro

from gitgalaxy.core.prism import Prism
from gitgalaxy.standards.gitgalaxy_config import LEXICAL_FAMILY_HEURISTICS
from gitgalaxy.standards.language_standards import LANGUAGE_DEFINITIONS

p = Prism(LEXICAL_FAMILY_HEURISTICS, LANGUAGE_DEFINITIONS)
res = p.split_streams("(* if open_in failwith *)\n", "ocaml")
# Expected: code_stream has no keywords, comment_stream holds the comment
# Actual:   code_stream == "(* if open_in failwith *)\n", comment_stream == ""

Affected Families (34/35)

api, auth_middleware, bitwise_ops, branch, cleanup, closures, comprehensions, concurrency, debug_prints, dependency_injection, encapsulation, events, explicit_casts, globals, high_risk_execution, immutability_locks, io, ipc_rpc_bridges, listeners, memory_alloc, panics_and_aborts, pointers, regex_execution, safety, safety_bypasses, scientific, serialization_parsing, state_mutation, system_config_mutation, test, time_date_logic, ui_framework, etc.

Suggested Fix

Add a (* ... *) comment-stripping lexical family (or extend Prism with bounded (* ... *) stripping, keeping doc comments (** ... *) routed to comment_stream), switch ocaml.py to it, and re-run python tests/tools/family_decoy_runner.py --lang ocaml --write.

Activity

  1. squid-protocol commented on Nov 26, 2026

    @squid-protocol
    OwnerAuthor

    Claimed by promoter-bot host nyx, lease renewed 2026-11-27T00:01Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove the claim:nyx label.

  2. added a commit that references this issue on Nov 27, 2026
    8ffcb88
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions