Created
April 6, 2022 02:02
-
-
Save moonexpr/553f24f959a01d64b65d3977e634c5c8 to your computer and use it in GitHub Desktop.
Small curly-brace validator for anything. (Used for Valve Data Format)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import os | |
counter = 0 | |
with open(sys.argv[1], "r") as fd: | |
while True: | |
c = fd.read(1) | |
if (c == '{'): | |
counter += 1 | |
elif (c == '}'): | |
counter -= 1 | |
elif not c: | |
break | |
if counter != 0: | |
print(f"{sys.argv[1]}: FAIL") | |
Author
moonexpr
commented
Apr 6, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment