From b97681c710a9db600c7f9e4d50ce3800f18c8504 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Tue, 8 Nov 2022 19:26:23 -0500 Subject: [PATCH] Add support for "event"-like interface to parsing and drop the querier --- Makefile | 6 ++ README.md | 1 + argh.go | 3 + argh_test.go | 138 ++++++++++++++++++++++++++++++++++--- ast.go | 69 +++++++++++++++++++ cmd/argh-example/main.go | 2 +- parser.go | 118 ++++++++++++++++++++++---------- parser_config.go | 17 ++++- parser_test.go | 144 ++++++++++++++++++++++++--------------- querier.go | 94 ------------------------- querier_test.go | 60 ---------------- 11 files changed, 395 insertions(+), 257 deletions(-) create mode 100644 ast.go delete mode 100644 querier.go delete mode 100644 querier_test.go diff --git a/Makefile b/Makefile index 0743ca6..4da2687 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +BENCHTIME ?= 10s + .PHONY: all all: test @@ -9,6 +11,10 @@ clean: test: go test -v -coverprofile=coverage.out ./... +.PHONY: bench +bench: + go test -v -bench . -benchtime $(BENCHTIME) ./... + .PHONY: show-cover show-cover: go tool cover -func=coverage.out diff --git a/README.md b/README.md index 04317b5..40c94c0 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ library [parser](https://pkg.go.dev/go/parser). - support both POSIX-y and Windows-y styles - build a printable/JSON-able parse tree - support rich error reporting +- support event-like reactive parsing