Line continuations

The Envision grammar offers both implicit and explicit line continuation mechanisms; i.e. the ability to write code that spreads over multiple lines, as if it was a single line. The explicit line continuation leverage the\ symbol. However when a line ends with a token that is not allowed to be an end-of-line, then the grammar assumes that a line continuation in intended.

Overview

The line continuation rule is: if a sequence (newline, indent) is preceded by a token that cannot-be-at-end-of-line or followed by a token that cannot-be-at-start-of-line, then the (newline, indent) sequence is completely ignored. For example, & is not allowed at end of line, so it is possible to split:

where ThisIsAVeryLongConditionExpression & ThisIsAnotherVeryLongConditionExpression
  A = sum(T.B)

This syntax is more compact and preferable to the alternative that uses the explicit continuation symbol:

where ThisIsAVeryLongConditionExpression &
  ThisIsAnotherVeryLongConditionExpression
  A = sum(T.B)

Similarly, by, if, or and at cannot appear at the start of a line, so it is possible to write:

A = sum(T.B) by [T.Key1, T.Key2, T.Key3]
             at [Key1, Key2, Key3]
             if Condition
             or DefaultValue

Continuation tokens

Only tokens that cannot appear at the end of line are eligible for line continuation. Those tokens are:

At the same time, infix keyword cannot-be-at-start-of-line tokens are: