Closed yaroslavyaroslav closed 7 months ago
Thank you for pr.
the xcode build log will echo a empty line after each section. so, to deal with multiple lines, just read_until_empty_line(self._input)
and output all the lines. other parse method all works this way: read first marker line and then all lines until empty line.
there may be a caveat that user may just has a error with empty line. eg: for this code:
will have output
/tmp/Test/Test/TestApp.swift:28:1: error: expected '}' in struct
^
/tmp/Test/Test/TestApp.swift:16:21: note: to match this opening '{'
struct TestApp: App {
^
/tmp/Test/Test/TestApp.swift:20:13: error: cannot find 'XXX' in scope
XXX()
^~~
/tmp/Test/Test/TestApp.swift:21:13: error: cannot find 'YYY' in scope
YYY()
^~~
/tmp/Test/Test/TestApp.swift:28:1: Expected '}' in struct
/tmp/Test/Test/TestApp.swift:20:13: Cannot find 'XXX' in scope
/tmp/Test/Test/TestApp.swift:21:13: Cannot find 'YYY' in scope
I am not sure if diag output will always be three lines: first is msg, second is text, last is arrow. if the case, we may read_until_empty_line, and recheck if last line has /Path: error:
marker, if the case, just continue read until next empty_line.
I've added additional parameter to the cli interface to manage output verbosity level. It's pretty straightforward.
Also I've tried to implement multiline solution and it worked unreliable (it skipped error message first line among others), so I deleted it for now. Haven't dug there any deep though.
seems fine. if the comment handled, this PR can be merged. thank you!.
for multiline parsing, note self._input
is a consumable line iterator. and the arg line
is already consumed by caller. so if you want to keep first line, you should use [line] + read_until_empty_line(self._input)
.
seems fine. if the comment handled, this PR can be merged. thank you!.
for multiline parsing, note
self._input
is a consumable line iterator. and the argline
is already consumed by caller. so if you want to keep first line, you should use[line] + read_until_empty_line(self._input)
.
Thanks for highlighting this, I believe it would be better to make this enhancement as a separate PR. I've tried it to enable such, it becomes kinda too verbose at my taste. But I'll provide a draft of such PR soonish anyway.
OK.Then I'll merge first,Thank you!
Here is the initial solution to pass compilation errors. It's quite straightforward and simple. It has the following output:
However, there are a few caveats with the further implementation, the main one is that errors have multiline output within building logs, while the utility parser is implemented in a simple loop manner (which I believe is a reasonable decision), as a significant amount of redundant complexity would be added to the project otherwise [see example below].
For now I think the question that needs to be answered before proceeding with any further work — wether it's worth to modifying a parser engine to make it capable of handle multiline output or not?
Pros:
Cons:
So I'd rather keep it that simple than make things more complicated.