Laurel User Guide

2.3. Identifiers🔗

A regular identifier starts with a Unicode alphabetic character, _, or $, and continues with alphanumeric characters or any of _, ', ., ?, !, $, @. So these are all one identifier each:

x
_temporary
Option..value!
module.name

The . being an identifier character rather than a selector is why field access uses #, and why a generated name like Option..value is a single token rather than a projection.

Most names that are not regular identifiers can be pipe-quoted:

|name with spaces|
|123-leading-digit|
|name\|with\|pipes|
|path\\segment|

Inside a pipe-quoted identifier \| denotes | and \\ denotes \; other backslash pairs are accepted and keep the backslash literally. Pipe quoting is also the escape hatch for a name that collides with a Laurel keyword. Because the lexer must still distinguish the | and || operators, an empty pipe identifier — or one whose first character is whitespace — does not parse.