Writing small linters using mini parsers: https://blog.acolyer.org/2016/05/31/how-to-build-static-checking-systems-using-orders-of-magnitude-less-code/ (interesting approach, but they must have corner cases)