]> ocean-lang.org Git - ocean/commit
scanner: change the meaning of ignoring comment tokens.
authorNeilBrown <neil@brown.name>
Tue, 6 Oct 2020 04:44:46 +0000 (15:44 +1100)
committerNeilBrown <neil@brown.name>
Tue, 6 Oct 2020 04:53:50 +0000 (15:53 +1100)
commit850a39a0a761e0af89c15253f075ecd9e9ecc6ee
treefe3a7378feb2cc662fa51a0302c3ad68cd58c49f
parent86e54542650f7f72a04c70618e07091f905398c8
scanner: change the meaning of ignoring comment tokens.

Previously ignoring comment tokens meant they were still parsed, but not
returned.  The only way to stop them being parsed was to declare
known marks for the start symbols.

This made is not possible for parsergen to define a language that had
a known mark that would otherwise start a comment.

So change the ignoring of comment tokens to mean they aren't parsed.  If
you want to parse comments but not return them, leave the new
"return_comments" field as so.  In the unusual case that you want to
return comments set return_comments to 1.

Confirm that this has the desired effect by added in "//" as an
integer-division operator to the sample calculator.

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