#!/usr/bin/sed -f # SPDX-FileCopyrightText: 2026 Lady # SPDX-License-Identifier: MPL-2.0 ## ⋯ 🧮🖍 Codemark ∷ sed ∷ syntax-comment.sed ## ## ⁌ The “syntax comment” Sed program ## ## ] Copyright © 2026 Lady [@ Ladys Computer]. ## ] ## ] This Source Code Form is subject to the terms of the Mozilla ## ] Public License, version 2.0. ## ] If a copy of the M·P·L was not distributed with this file, You ## ] can obtain one at {🔗}. ## The program begins in the “outside” state. ## When a line starting with `|´ is encountered, it prints a syntax ## comment and switches to the “inside” state. :outside /^|/{ s/^|/|⌦syntax:⌫/ b inside } ## If the line did not begin with `|´, the program advances and stays ## “outside”. n b outside ## Once “inside”, the program advances and switches to “outside” as ## soon as it encounters a line which does not begin with a `|´. ## Otherwise, it stays “inside”. :inside n /^|/!b outside b inside