If fgps never returns 0, then returning 0 instead of None would allow simplification of
if bod is not None or startat == 1:
break
parser.set_lo(bod or 0)
to
if bod or startat == 1:
break
parser.set_lo(bod)
If it can (or should) ever return 0, separate from None, I would like to see a test case for that. We could then think about whether or not the loop should break on 0 as well as None.
Perhaps separate issue: the 'if use_ps1' statements in editor and hyperparser, and a couple of lines before, is nearly identical, and could be factored into a separate editor method that returns a parser instance ready for analysis. It could then be tested in isolation. The method should return a parser instance ready for analysis.
Both blocks have an explicit set_lo(0) call, which does nothing, and could be removed. |