TBH, I would like to rewrite the parser next time I need it again :)) but it still does its job.
Gonginx is an Nginx configuration parser helps you to parse, edit, regenerate your nginx config files in your go applications. It makes managing your balancer configurations easier.
%token Keyword Variable BlockStart BlockEnd Semicolon Regex
%%
config : /* empty */
| config directives
;
block : BlockStart directives BlockEnd
;
directives : directives directive
;
directive : Keyword [parameters] (semicolon|block)
;
parameters : parameters keyword
;
keyword : Keyword
| Variable
| Regex
;
Parser is the main package that analyzes and turns nginx structred files into objects. It basically has 3 libraries, lexer
explodes it into token
s and parser
turns tokens into config objects which are in their own package,
Config package is representation of any context, directive or their parameters in golang. So basically they are models and also AST
Dumper is the package that holds styling configuration only.
dumper.Style
There is no known limitations yet. PRs are more than welcome if you want to implement a specific directive / block, please read Contributing before your first PR.