# SPDX-License-Identifier: MIT """Print the shape of lines (kind, brace depth change, trailing char), never their text.""" import sys path, a, b = sys.argv[1], int(sys.argv[2]), int(sys.argv[3]) lines = open(path).read().split("\n") for i in range(a, b + 1): l = lines[i - 1]; s = l.strip() if not s: k = "blank" elif s.startswith("//!"): k = "moddoc" + (" (empty)" if s == "//!" else "") elif s.startswith("///"): k = "doc" + (" (empty)" if s == "///" else "") elif s.startswith("//"): k = "comment" elif s.startswith("#["): k = "attr" else: k = f"code d{l.count('{')-l.count('}'):+d} ends'{s[-1]}'" print(i, k)