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(B)

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

where ThisIsAVeryLongConditionExpression & \
      ThisIsAnotherVeryLongConditionExpression
  A = sum(B)

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

A = sum(B) by [Key, Key, Key]
        at [Key, Key, Key]
        if Condition

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 tokens cannot-be-at-start-of-line: