]> Lady’s Gitweb - Codemark/blob - sed/syntax-comment.sed
Initial commit
[Codemark] / sed / syntax-comment.sed
1 #!/usr/bin/sed -f
2 # SPDX-FileCopyrightText: 2026 Lady <https://www.ladys.computer/about/#lady>
3 # SPDX-License-Identifier: MPL-2.0
4
5 ## ⋯ 🧮🖍 Codemark ∷ sed ∷ syntax-comment.sed
6 ##
7 ## ⁌ The “syntax comment” Sed program
8 ##
9 ## ] Copyright © 2026 Lady [@ Ladys Computer].
10 ## ]
11 ## ] This Source Code Form is subject to the terms of the Mozilla
12 ## ] Public License, version 2.0.
13 ## ] If a copy of the M·P·L was not distributed with this file, You
14 ## ] can obtain one at {🔗<https://mozilla.org/MPL/2.0/>}.
15
16 ## The program begins in the “outside” state.
17 ## When a line starting with `|´ is encountered, it prints a syntax
18 ## comment and switches to the “inside” state.
19
20 :outside
21 /^|/{
22 s/^|/|⌦syntax:⌫/
23 b inside
24 }
25
26 ## If the line did not begin with `|´, the program advances and stays
27 ## “outside”.
28
29 n
30 b outside
31
32 ## Once “inside”, the program advances and switches to “outside” as
33 ## soon as it encounters a line which does not begin with a `|´.
34 ## Otherwise, it stays “inside”.
35
36 :inside
37 n
38 /^|/!b outside
39 b inside
This page took 0.049269 seconds and 5 git commands to generate.