Conventions Used By GoldieLib

Line and Column Numbers

All line numbers and column numbers are internally stored and treated
by the API as zero-indexed and displayed to the user as one-indexed.

When Goldie refers to a "column number", it really means "the number of
characters (ie, UTF code-points) from the start of the line".
This behavior is more reliable and more useful than a true "column number"
because:

Tab-size is a matter of presentation (For better or worse, depending on one's perspective).

Non-printing characters may exist in a source to be parsed.

The increasingly popular concept of
elastic tabstops
makes proportional fonts practical for source code, which renders
the traditional concept of "column number" meaningless.

Tokens, Symbols, and Symbol Types:The Front-End's Building Blocks

A Token can be thought of as an instance of a Symbol.
A Token is part of the parsed source, and a Symbol
is part of the grammar.

Note that Goldie defines more symbol types
than just Terminal and NonTerminal (see the
SymbolType documentation).
So if you want to check if a Symbol or Token is a SymbolType.NonTerminal
do NOT do it by comparing the type with SymbolType.Terminal. Just because
something isn't a SymbolType.Terminal does NOT imply that
it's a SymbolType.NonTerminal.

Referring to a rule that has no subtokens

Just use null for the subtokens.

Example:

Suppose you have this in your grammar for language "myLang":

<Optional Fred> ::= 'fred'
|

The nonterminal <Optional Fred> can be created from either the
text fred or from nothing at all. To check if a token matches the
first case, ie. the fred rule, you use this: