This is the parser library for the Virgo4 Search Grammar. It is based on an Antlr BNF specification, and the base implementation was autogenerated by the same tool. The package contains the base parser generated by Antlr and a basic Solr-specific parser.
It includes a sample cmd that sends strings though the parser and produces output. This can be used as a template for creating new parsers for search pools.
- GO version 1.12 or greater (mod required)
Much of this code is generated by Antlr (https://github.com/antlr/antlr4/blob/master/doc/getting-started.md) using .g4 token and lexer definition files. The commands used to do the generate are in the Virgo4 API repo.
The code includes an example that demonstrates basic usage of the parser. Run it with:
go run example/main.go
Some basic validator unit tests are also included. Run them with:
go test -v ./v4parser/validator_test.go
For Solr query tests, run the basic ones with:
go test -run 'TestSolrShould*' ./v4parser/solr_test.go