promlexer is a tool built with JFlex to tokenize prometheus format text (metrics).
It's basically based on the prometheus promlex.l.
But unlike the Prometheus, it drops the lines begin with a character #, e.g., HELP lines and TYPE lines.
You can run the following maven command to build your lexer:
mvn clean packageThere is also a demo shows a way of using this little lexer.
There is NO WARRANTY for promlexer, its code and its documentation.
According to this paper[1], Antlr has an O(n4) theoretical computation complexity while JFlex has an O(n) one. So I choose JFlex over Antlr.