New ToNoder option to fill missing position elements. Unified parser.go skeleton.#166
Conversation
Codecov Report
@@ Coverage Diff @@
## master #166 +/- ##
==========================================
- Coverage 40.57% 37.72% -2.85%
==========================================
Files 21 21
Lines 2223 2396 +173
==========================================
+ Hits 902 904 +2
- Misses 1233 1404 +171
Partials 88 88
Continue to review full report at Codecov.
|
| toNoder := &native.ObjectToNoder{} | ||
| parser, err := native.ExecParser(toNoder, opts.NativeBin) | ||
| func ParserBuilder(opts driver.ParserOptions) (parser driver.Parser, err error) { | ||
| psr, err := native.ExecParser(ToNoder, opts.NativeBin) |
There was a problem hiding this comment.
There's no need for a different (and harder to understand) psr name, is it? You can just reassign parser if needed.
There was a problem hiding this comment.
I wanted to differentiate the normal parser from the transformation parsers that take the first as one of their fields (2 and 3 cases in the switch), but maybe using a single parser var is clearer.
| psr, err := native.ExecParser(ToNoder, opts.NativeBin) | ||
| if err != nil { | ||
| return nil, err | ||
| return psr, err |
There was a problem hiding this comment.
If using named return values, and parser is used instead of psr, return would be enough here.
|
|
||
| switch ToNoder.PositionFill { | ||
| case native.None: | ||
| parser = psr |
There was a problem hiding this comment.
No need for this case if psr is named parser
Part of src-d/backlog/issues/889