From f0ca50b9e447d1caa70a5a40af1d181c726fd2f3 Mon Sep 17 00:00:00 2001 From: Pandurang Patil Date: Tue, 27 Jun 2023 22:22:08 +0530 Subject: [PATCH] ending position information (#22) * logging metadata information of processing 1. Added stdout message to be processed by invoking utility. 2. Better error handling mechanism and subsequently logging the error situation for given file on stout. Note: where messages are printed with `log` it will print it to `stderr`. `fmt.println` and its other version will print the message to `stdout` * ending poisition information Added ending line number and column number information for each node. --- goastgen/libgoastgen.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/goastgen/libgoastgen.go b/goastgen/libgoastgen.go index 3a7b91e..f005d9d 100644 --- a/goastgen/libgoastgen.go +++ b/goastgen/libgoastgen.go @@ -265,6 +265,11 @@ func processStruct(node interface{}, objPtrValue reflect.Value, fset *token.File objectMap["node_line_no"] = position.Line objectMap["node_col_no"] = position.Column } + if epos := astNode.End(); epos.IsValid() { + position := fset.Position(epos) + objectMap["node_line_no_end"] = position.Line + objectMap["node_col_no_end"] = position.Column + } } }