Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Comments

FOL has two comment families, and both are first-class.

Slash comments

// runs to the end of the line, and /* ... */ spans lines without nesting. These are what most FOL source uses.

// a line comment
/* a block
   comment */

Backtick comments

A backtick-delimited comment spans as many lines as it needs:

SINGLE_LINE_COMMENT:

`this is a single line comment`

MULTI_LINE_COMMENT:

`this is a
multi
line
comment`

Doc comments

Documentation comments use the [doc] prefix inside the backtick form, which is the only documentation-comment spelling:

DOC_COMMENT:

`[doc] this is a documentation comment`

What the front end keeps

The current front-end also preserves comment kind and raw spelling past lexing. In the parser today, standalone root comments and standalone routine-body comments lower to explicit AST comment nodes, and many inline expression-owned comments now survive through AstNode::Commented wrappers around the parsed node they belong to. That gives later doc-comment tooling retained comment content to build on instead of re-scanning raw source text.