reqlanOverviewIdeasFilesCode filesClustersAttributesGraphPrint

Printable idea sheet

comments

reqlan rq/language/syntax.rq:414

Katz 0.145

Line comments use `//` through end of line ( hidden `SL_COMMENT` ).
Block comments use `/* … */` and may span multiple lines ( hidden `ML_COMMENT` ).
Meta comments on the same line after content are allowed ( `keep this // meta` ).
Comments must not open inside a string / reference-string context:
- Naked body quotes ( naked_strings_in_body ): a quoted slash-slash that is not a comment, quoted urls,
`"../mod/**/*.rq"`.
- Reference / import `STRING` paths ( `…`, `from "…" import …` ) — the lexer consumes the
whole quoted path as one `STRING`, so neither `//` nor `/*` inside the quotes starts a comment.
Example: a file reference whose path text contains slash-slash,
`*.rq".*webview*`.
- URL / path-segment guard: `//` immediately after `:` or `/` is not a line comment.
Same-line fences: fencing_comments — complete `"…"`, `'…'`, and ` ` ` … ` ` ` spans keep `
Unclosed quote or backtick openers are not fences, so `//` after them is a comment.
Comment-range identity across lexer, scanner, and TextMate: comment_span_align.
Multiline / glob clash: the empty block form `/**/` is **not** a comment — it is the recursive
glob segment used in paths such as `../mod/**/*.rq`. A real block comment needs a non-empty body
( `/* note */`, `/*\n note\n*/` ). The token builder rejects length-4 `/**/` matches; comment-span
scanners skip the same sequence so embedded `rq:…` discovery stays aligned.
Related: comment_reference_ignore, string_literals, wildcard_references, comment_span_align.

implementation
reqlan-token-builder.ts, reqlan.langium, reqlan-comment-resolver.ts, reqlan-line-fences.ts, patch-textmate.mjs, reqlan.tmLanguage.json
status
done
tests
comment-in-string.test.ts, glob survives tokenize → parse in prose, naked quotes, and reference STRING, comment-in-string.test.ts:e2e: real block comments still hide body text, tokenizes, parses, and keeps path text, inside string literals when locating line comments, inside complete backtick fences when locating line comments, glob segments, comment-span-align.test.ts:golden corpus C-style comment ranges match lexer, scanner, and TextMate, * in block body is not a block comment, * inside complete backtick fences, ignore-error.test.ts, wildcard-references.test.ts:e2e: ** path glob matches nested fixture files, lexer.rs:url_slashes_are_not_line_comments, lexer.rs:glob_star_star_is_not_a_block_comment, lexer.rs:meta_line_comment_after_content_is_hidden

Interactive page: comments