]> ocean-lang.org Git - ocean/commit
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)
commit151e984bb8300e4eb3f7cdf41135f9a3b0261fd5
tree60217e88498c4d74abf79df24d8cfea978451180
parentc040191336b755321af667a0251b97782d8eed71
scanner: fix handling of indents in sub-nodes

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>
csrc/mdcode.mdc
csrc/scanner.mdc