From 63c768bd4922a3014056803849d85447f04ecdc9 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 21 Dec 2024 19:18:45 -0300 Subject: Combine "CompiledGrammar" and "Report" payloads Instead of one JSON file for each output, a single file with both outputs combined, each under its own key. The beauty of maps. Also instead of using a flag to determine where to put the data, just print to stdout and be done with it. --- src/urubu/cmd/vartan/parse.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/urubu/cmd/vartan/parse.go') diff --git a/src/urubu/cmd/vartan/parse.go b/src/urubu/cmd/vartan/parse.go index 9c5fd9c..41b8723 100644 --- a/src/urubu/cmd/vartan/parse.go +++ b/src/urubu/cmd/vartan/parse.go @@ -78,12 +78,14 @@ func readCompiledGrammar(path string) (*spec.CompiledGrammar, error) { if err != nil { return nil, err } - cg := &spec.CompiledGrammar{} - err = json.Unmarshal(data, cg) + + output := &spec.Output{} + err = json.Unmarshal(data, output) if err != nil { return nil, err } - return cg, nil + + return &output.Grammar, nil } func writeSyntaxErrorMessage(b *strings.Builder, cgram *spec.CompiledGrammar, synErr *driver.SyntaxError) { -- cgit v1.2.3