Comments & whitespace
How comments and whitespace work in .forge — line comments only, significant newlines, and no block comments.
Comments#
.forge has line comments only, introduced by //. Everything from // to the end
of the line is ignored. A comment may stand on its own line or trail a field.
// A standalone comment describing the model.
User {
id: +uuid
email: &string // inline comment after a field
}Block comments are not supported
/* ... */ block comments do not parse — the lexer has no handling for them. Some
older example files use them; those files fail in the CLI. Use // lines instead.
Whitespace#
- Newlines are significant. They delimit logical tokens — fields are separated by newlines, not semicolons.
- Horizontal whitespace (spaces and tabs) is skipped, so you may indent and align freely.
- Carriage returns (
\r) are skipped, so CRLF files parse fine. - Model, struct, and enum definitions may span multiple lines; blank lines between declarations are fine.
Terminators#
- There are no semicolons. The only structural delimiters are the
{and}block braces. - A field's
@directives must appear after its type, before the next newline or the next directive on the same field.
// Valid: newline-delimited fields, no semicolons, aligned for readability.
Post {
id: +uuid
title: string @length(1, 200)
published: bool @default(false)
author: *User
created_at: +timestamp
}