JLS question regarding Text Blocks

Dan Smith daniel.smith at oracle.com
Mon Apr 6 23:46:10 UTC 2020


> On Apr 6, 2020, at 12:43 PM, Jim Laskey <james.laskey at oracle.com> wrote:
> 
> In section 3.10.6 Text Blocks of the updated spec;
> 
> "The opening delimiter is a sequence that starts with three double quote characters ("""), continues with zero or more space, tab, and form feed characters, and concludes with a line terminator."
> 
> However, the JEP 378 description reads "The opening delimiter is a sequence of three double quote characters (""") followed by zero or more white spaces followed by a line terminator.
> 
> javac uses the Character.isWhitespace test for characters following the opening three double quote characters.
> 
> Shouldn't the spec read as;
> 
> "The opening delimiter is a sequence that starts with three double quote characters ("""), continues with zero or more white space characters (Ex. space, tab, and form feed), and concludes with a line terminator."?

Is there a question about semantics here, or just a question of how best to present it?

Right now, TextBlockWhiteSpace defines precisely which characters can appear. Per 3.6, WhiteSpace is a grammar production that consists of 3 specific characters (space, horizontal tab, and form feed), plus the line terminators. TextBlockWhiteSpace excludes the line terminators.

Given this, I don't think redirecting through an abstract notion of "white space" or the "Character.isWhitespace" API would be helpful—the grammar has already nailed it down to exactly three characters.


More information about the amber-spec-experts mailing list