]> ocean-lang.org Git - ocean/commit
scanner: improve transition from node to node.
authorNeilBrown <neil@brown.name>
Sat, 8 Jun 2019 23:42:05 +0000 (09:42 +1000)
committerNeilBrown <neil@brown.name>
Sat, 8 Jun 2019 23:56:51 +0000 (09:56 +1000)
commitfcd83db1af72cf3da045ca85e89e4d9b119be651
tree67c773009c31ee52609a8664462557abcf444d7d
parent0d310d6b1da44a35e5c8be250796a6cf2fcd0e06
scanner: improve transition from node to node.

When we are at the end of a node, it is wrong to use do_strip() as
that looks beyond the end of the node.
It is better, once we have determined to accept the newline at the
end of a node (i.e. once no unget is possible), to move to the
start of the next node, and assess column position and indents from
that perspective.
Do this removes some tests on at_son/at_eon, and make some code a
bit more transparent - for example the flag that say whether an "out"
is next now depends on where a newline was recently seen, which makes
more sense than whether we were at the start of a node (out and newline
alternate in some contexts).

Also: add the test which found this problem.   This requires a
new set of tests - tests which can scan tokens from multiple nodes.

Now that we are testing node transitions, the coverage has jumped
over 92%

Signed-off-by: NeilBrown <neil@brown.name>
csrc/scanner-tests.mdc
csrc/scanner.mdc