Long comments / Ignore blocks ============================= Rationale --------- Long comments are very useful for disabling some code during development. This is used quite a lot, so it's useful to have it in the compiler. It needs to be nestable, and it should be removed before the tokenization phase. So it has to either: * Appear at the start of the line, as in SLUL-try1 - If it uses keywords, then neither keyword can appear elsewhere. * Use some special character(s) that don't appear else. * Use some special sequences, e.g. /* */ and disallow those sequences in strings, comments, etc. Nice to haves: * Avoid introducing new special characters (e.g. `{` `[` `%` etc) * Avoid overloading special characters (e.g. `!`) * It should be intuitive to readers * It's good if it's possible to guess the syntax when writing code. * There should not be any confusion with other language elements. * If overloading # comment syntax, it must not be something that could: - appear in a comment - appear in code that might be commented out with # - appear immediately before a comment, e.g. `end` vs `end#` * It should not be something that appears in diffs or similar, e.g. +++ --- * It should not conflict with other tools (e.g. documentation tools, preprocessors, etc.) * It should be reasonably short (max 10 charactersS?) Most obvious solution: Start and end markers -------------------------------------------- I decided to go with the solution under the section "Alternative solution" at the end, instead of this. Syntax: #{{ #}} #ignore #endignore #ignore abc123 start #ignore abc123 end #[[ #]] #(( #)) %ignore %end #[[ #]] long# end# start# end# (# )# =ignore =endignore (* *) Alternative solution: Have only a start marker ---------------------------------------------- # Ignore something until next non-indented end ignore func xxx ... end # Nested ignores: ignore func xxx ... ignore ... end ... end # Multiple things can be ignored # Not sure if this is good idea? ignore ignore func xxx ... end func yyy ... end # Maybe a more powerful variant, that can stretch # across multiple functions: # ignorestart ... ignoreend # TODO actually implement this. not sure if it is needed? ignorestart func aaa ... func bbb ... ignoreend # Ignore stops here func ccc Implementation ideas: There are basically three paths here: * Rely on indentation <-- Chosen solution - skip to (and including `end`) at the same indentation level * Rely on start tokens - skip to one of some specific start token (e.g. `func` `type` etc.) * Rely on textual search - skip to some arbitrary sequence of (text) bytes (e.g. "func xyz")