INNER CODE UNIT · Python
wrapped_sidebar_span
wasm3/wasm3 · extra/format.py:362
def wrapped_sidebar_span(self, lines, i):
"""Line count of a sidebar whose call runs past the end of lines[i], else 0.
The disguise in hide_sidebars only works on a sidebar that ends on its own line:
a `//` comment cannot carry the continuation, which would be left behind as code
and read as a continuation of the statement, cascading the indent of everything
after it. Only the continuation lines are held back -- the first line still goes
through the run, since it carries the real code, up to and including a brace that
the parse depends on.
"""
m = self.RE_SIDEBAR_HIDE.match(lines[i])
if not m or lines[i].lstrip().startswith("#"):
return 0
n = self.sidebar_call_span(lines, i, m.group("tail"))
return n if n > 1 else 0
def code_indent(self, lines, i, step):
"""Indent of the nearest line to lines[i] in direction `step` that shows where