]> ocean-lang.org Git - ocean/commitdiff
scanner: fix handling of indents in sub-nodes
authorNeilBrown <neil@brown.name>
Sat, 8 Jun 2019 04:35:34 +0000 (14:35 +1000)
committerNeilBrown <neil@brown.name>
Sat, 8 Jun 2019 04:45:00 +0000 (14:45 +1000)
I seem to have confused ->indent_sizes[] and ->col

->col is used for the reported location of a token so
must be the actual column in the file, with no adjustment.

->indent_sizes[] is indents, which must include any inherited from
parent nodes.  So this is a completely different value.

So change mdcode to store the local node indent in ->needs_strip -
this is the number of text columns that are stripped off.
This, subtracted from ->indent is the text offset of the physical
start-of-line.  Adding the measured ->col then gives us
the indent in the composed file, the indent that must be used
for detecting TK_in and TK_out.

Introduce a new function state_indent() which determines that indent,
and use it instead of ->col.

Signed-off-by: NeilBrown <neil@brown.name>

No differences found