Blank out RouterOS comments so a later delimiter re-scan cannot be fooled by
# text (a } or [ inside a comment is not a real delimiter). A # starts
a comment in statement-leading position (H4) or at the immediate start of a
line a continuation carried into (H5). Statement-leading is contextual:
scope/stored-script braces admit it, array/group expressions do not. Any
intervening space or tab makes a continuation-line # content unless the
surrounding statement context is still empty. Comments are opaque inside
strings. Comment characters become spaces; length and every non-comment
offset are preserved, so indices stay valid against the original and callers
can slice the original for content. Idempotent.
Blank out RouterOS comments so a later delimiter re-scan cannot be fooled by
#text (a}or[inside a comment is not a real delimiter). A#starts a comment in statement-leading position (H4) or at the immediate start of a line a continuation carried into (H5). Statement-leading is contextual: scope/stored-script braces admit it, array/group expressions do not. Any intervening space or tab makes a continuation-line#content unless the surrounding statement context is still empty. Comments are opaque inside strings. Comment characters become spaces; length and every non-comment offset are preserved, so indices stay valid against the original and callers can slice the original for content. Idempotent.