Diagnostics

Every message .Gram reports carries an identifier, so it can be looked up, suppressed, or argued with. This is the list.

Numbers go by the stage that raises them. GRAM0xxx is the Roslyn shell — the part that finds a grammar and hands it to the compiler; GRAM1xxx the lexer; GRAM2xxx the parser; GRAM3xxx the binder, which resolves names; GRAM4xxx the normalizer, which lowers the grammar and checks what it means; GRAM5xxx the analyses that decide what a grammar gets rather than whether it is one. GRAM6xxx is about the tooling a grammar is annotated for, and has a section of its own before the retired numbers.

Severity is what the build reports an identifier with unless the project says otherwise (.editorconfig, <NoWarn>, <WarningsAsErrors>). Every row has an anchor, and a diagnostic's help link points at its row in this file as it stood in the version that reported it.

This file is the list, and the analyzer's release files are not. AnalyzerReleases.Shipped.md holds only what the Roslyn shell declares as rules of its own, which is GRAM0xxx. Everything a grammar is told is reported through a descriptor made from its identifier as the message arrives, so Roslyn never sees those rules to track them — and a suppression or a severity is written against the identifier either way.

A retired number is not reused. A suppression written against the old meaning would silently acquire a new one. The retired numbers are listed at the end.

Where a message points. A grammar in a .gram file is underlined in that file. A grammar written into the [Gram("…")] attribute is underlined inside the string literal, at the character the grammar's own position maps to. A grammar inherited from a base class, or included with [GramInclude], is underlined where it was written, in its own file — see syntax.md §6.7.


GRAM0xxx — finding the grammar

Id Severity What it says What to do
GRAM0001 Error The generator itself failed. A defect in .Gram, not in the grammar. The message names the stage and carries the exception; please report it.
GRAM0002 Error A class hosting a grammar must be partial. Add partial to the class the [Gram] attribute is on. A nested host needs every enclosing class to be partial as well.
GRAM0003 Error No grammar file for a [Gram] class. Add the .gram file, or add it to the project as <AdditionalFiles Include="…" />.
GRAM0004 Error More than one grammar file matches. Two additional files answer to the same name. Name one of them in the attribute: [Gram("Feed.gram")].
GRAM0005 Error The name a grammar is included under is not an identifier. [Gram(DefaultAlias = "…")] names the namespace an including grammar reaches this one through, so it has to be one identifier.
GRAM0006 Error Two readings of one grammar want the same scope. The [Gram] and every [GramParserVariant] on a class is a compilation of its own and needs a scope of its own: the [Gram] goes in the class itself, and every [GramParserVariant] names a nested class, its one argument.
GRAM0007 Error The name a grammar is compiled under is not an identifier. [GramParserVariant("…")], and [Gram(Name = "…")], name a nested class, and a class is named by an identifier that is not a C# keyword (class, null); a [GramParserVariant] whose name is empty is told the same.
GRAM0008 Error Two grammars are included under one name. An included grammar is wrapped in a namespace named after it, which is what keeps two grammars' rules apart: Sql92.Identifier and Lex.Identifier are different names. Two under one name are one namespace, and their rules do collide — give all but one an Alias of its own.
GRAM0009 Error A buffer option is not positive. [Gram(MaxBufferedInputLength = …)] is the most a buffered parse may hold and InitialBufferSize the capacity it starts with, so either is at least 1. Leave it out for no limit, or give a call its own maxRetained.
GRAM0010 Error The generated parser needs C# 8 or later. The project compiles an earlier version — C# 7.3 is the default for netstandard2.0 and .NET Framework — and no parser is generated below C# 8. Set <LangVersion>8.0</LangVersion> or later in the project. Reported once, at the first [Gram]; a project with none builds at any version.
GRAM0011 Error The location type declares no Locate. LocationType names an interface, or a class, whose implementors are told where they were written, through void Locate(int at, int length) — with UsePerCallLocations, void Locate(int at, int length, int gapStart) (syntax.md §6.8). Name such a type, or declare the method on the one named; an interface's is called through the interface, so an explicit implementation serves. Said on the attribute that names the type: for a per-call reading, its [GramParserVariant].
GRAM0012 Error A name was renamed in 0.3.0. The attribute is written with a name it had before 0.3.0, and the message says what it is now: IncludedAs is DefaultAlias, Suffix is Name, [GramOptions(Suffix = "X", …)] is [GramParserVariant("X", …)], GramCarrier.Tape is GramCarrier.Deferred, [GramInclude(…, As = …)] is Alias, and the rest as the release notes' table lists them. Said beside C#'s own error, at the old name, and only of DotGram's own attributes and GramCarrier, however they are spelled — an alias, a qualified name — and GramCarrier.Tape wherever it is written. Where the old name dropped an alias (As on a [GramInclude], IncludedAs on the [Gram] without a Name of an included class, the one an include splices, on the host or on any class its grammar is built on), what that alias explains is not reported again: GRAM3003 for the alias itself, and GRAM3002 for a name qualified by it, or any where the grammar opens it with using. Every other report stands.
GRAM0017 Info A local grammar file is not the grammar a referenced assembly carries. Information. A class from a referenced assembly that carries its grammar ([GramSource]) is always included with that grammar, which is the one the assembly was compiled from; a .gram file of the same name in this project — a fixture, a copy — is not read in its place, and this says so where the two differ. Nothing to do unless the local file was meant to be the grammar: then rename the file, or include a class of this project that reads it.

GRAM1xxx — reading the characters

Id Severity What it says What to do
GRAM1001 Error Unterminated character literal. Close the '.
GRAM1002 Error Unterminated string literal. Close the ".
GRAM1003 Error Unterminated comment. Close the */.
GRAM1004 Error Unrecognized escape sequence. The escapes are the C# ones: \n, \r, \t, \\, \', \", \0, \uXXXX.
GRAM1005 Error Unexpected character. Nothing in the notation begins with it.
GRAM1006 Error Unterminated inline @(…) expression. Close the bracket. The scanner reads C# to find where the expression ends, so an unbalanced one runs to the end of the file.
GRAM1007 Error An inline @(…) expression needs a C# scanner, and none was supplied. Only reachable when the grammar half is driven directly, without a host compilation. Inside a build there is always one.
GRAM1008 Error Expected a Unicode category in the form \p{Lu}. Braces and a category name.
GRAM1009 Error Not a Unicode category. One of Lu, Ll, Nd, Zs, … or a group such as L or N.
GRAM1010 Error A character literal holds one character. '' holds none and 'ab' holds two. Write "ab" for a string.
GRAM1011 Error $ or # needs a name right after it. The sigil and the name are one token: $name: X binds the text X matched, $name matches it again, and X{#name} counts by its length. Write them with no space, and with a name rather than a number.
GRAM1012 Error A name contains _DotGram. The generated code gives its own parameters, locals and the methods that call the author's a _DotGram in the name, and a rule, a capture, a binding, an external @M or a publication written with one would meet them (an external called argument0_DotGram would hide itself). Rename it. Members of the host class with _DotGram in the name are reserved too, and not checked (§7.1).

GRAM2xxx — reading the shape

Id Severity What it says What to do
GRAM2001 Error Expected a particular token. The message names it.
GRAM2002 Error Expected a rule, a namespace or a publication directive. Only these stand at the top of a grammar: using/@using lines at its head, a rule (trivia among them), namespace, parse/find (with public, internal or private before it, if any), and the context/state declarations.
GRAM2003 Error Expected a literal, a reference, an element set, a group or an atomic group. An operand is missing where one has to stand — often after a & or a \|. Said in its own words for when:, a capture called when: when begins a guard, so rename the capture.
GRAM2004 Error Expected a name.
GRAM2005 Error A binding power is a whole number from 0 to 9999. << 2, >> 3 (§4.3.1).
GRAM2006 Error A namespace header's rebindings need with. namespace Name with (A = B) { … } (§5.1).
GRAM2007 Error A publication of anything but a rule's name needs as. parse and find name the method after the rule; an expression has no name to make one from, so give it one: parse X & Y as Both.
GRAM2008 Error A named yield publication places a result type before yield. Write the element contract after yield : @T (§6).
GRAM2009 Error A condition after when whose operand is not followed by is. A when is either a C# guard, written when @(…) and asked while the parser runs, or a condition about the grammar, written when A is B and answered while it is built. Both sides of that question are written out, so an operand with no is after it is neither one thing nor the other. A rule's name after when with no is (when Version) is this too: a bare name is the grammar's, and a guard is written with @.
GRAM2010 Error A length #q stands only inside count braces. #q is the length of the text bound to $q, and a length is a count: X{#q}, X{#q,}, X{2,#q}. To match the bound text itself, write $q.
GRAM2011 Error Something stands more than 128 levels deep inside others: groups, braces, lookaheads, captures, bindings, a call's arguments, a condition's parentheses, a C# type's arguments, namespaces. One level each, so a group is two, itself and what it holds: sixty-three groups inside each other are read, the sixty-fourth is not. The parser and every stage after it take a rule apart by recursion over its tree, so how deep one rule may nest is bounded here, and what went too deep is said once and read past. Name the inner part as a rule of its own and call it: a chain of rules calling each other may be as long as you like.
GRAM2012 Error positional on a find or on a parse … yield. Neither has forms read from a position: a find looks at every position of the input itself, and a yield has no Try form to begin where it is told (§6.3). Drop the word.
GRAM2013 Error The words before a directive's verb are out of order, one is written twice, or one stands after a directive on its line. The access comes first and positional after it, at the start of the directive's line: internal positional parse X (§6). A directive has one access, and each word is written once. Written after a directive, as stream is, the word would be read as the next directive's.
GRAM2014 Error A character range is malformed: nothing after its .. (['a'..]), a string as its bound (['a'.."z"]), or written outside brackets ('a'..'z'). A range is an element of a set and has a character at both ends: ['a'..'z']. A set of one character is ['a']. ['a'..] used to be read as ['a'] without a word.
GRAM2015 Error A case-insensitive character is an element of a set or a bound of a range: ['a'i], ['a'..'z'i]. A set holds characters as they are written. Write both cases, ['a'..'z' \| 'A'..'Z'], or a choice of literals, 'a'i \| 'b'i.
GRAM2016 Error Type arguments after a name of the grammar: B<int>. A rule, a parameter or a capture takes no type arguments; only a C# name is generic, and it is written with @: @B<int>. They used to be read and dropped without a word.
GRAM2017 Error A second quantifier on one operand: 'a'*?, 'a'+*, 'a'{2}?. An operand takes one quantifier, and a repetition is always greedy: there are no lazy or possessive forms. To repeat a repetition, group it, ('a'*)?; to keep a repetition from giving back what it took, make it atomic, { 'a'* } (§3.3).
GRAM2019 Error A using or @using after the first declaration of its file or namespace block. Imports stand at the head of the file or of the block, before every rule, namespace and directive: move it up.
GRAM2020 Error A switch's braces hold something that is not a case label, a default or a body; or a label is not a whole number or a string, or is a number too large for a long (a ulong if it is not negative). switch @(kind) { case 0: Text case -1: none case "s": Text default: none } (§3.6). What follows a label the switch cannot read is read past, to the brace that closes it.
GRAM2021 Error A switch label, or its default, is written twice. Each value selects one body. Labels that share a body are written one after another: case 0: case 1: Text.
GRAM2022 Error A switch's labels are numbers and strings both. The value they are compared with has one type: all whole numbers or all strings.
GRAM2023 Error A switch has no case, or a label has no body after its :. A label is followed by the grammar its value selects; none is a body that matches nothing.
GRAM2024 Error A side of is has a quantifier: when Version is ['0'..'9']+. A side of is is a name, a literal, a set or a bracketed choice. Name the repetition as a rule and ask about that: Digits = ['0'..'9']+, then when Version is Digits.

GRAM3xxx — resolving the names

Id Severity What it says What to do
GRAM3001 Error A rule of this name is already defined in this namespace. Rename one, or put one in a nested namespace to shadow the other.
GRAM3002 Error No rule of that name. Where the name is a capture of the rule, it stands where a recognizer goes: a capture is read only in a value, after =>, in a guard or as a switch selector (§3.5).
GRAM3003 Error No namespace of that name is in view.
GRAM3004 Error No C# type of that name is in view. The type is looked up the way C# would look it up beside the using directives the grammar declares.
GRAM3005 Error Two publications would generate the same method. Give one another name with as.
GRAM3006 Error A rebinding's left side names no visible rule. (§5.1)
GRAM3007 Error A rebinding's right side names no visible rule. (§5.1)
GRAM3008 Error A rule is bound more than once in one with.
GRAM3009 Error A rebinding's two sides take different numbers of parameters. A rebinding substitutes one recognizer for another, so they have to take the same arguments (§4.2).
GRAM3010 Error A rule bound by the active namespace's own header cannot be redeclared. Use a nested namespace header to replace it. Said for such a name wherever it came from, an enclosing namespace or an import; a name the header binds and the block declares again is never GRAM3012.
GRAM3011 Error A rebinding is circular. In one header (with (A = B, B = A)), or once substitutions stack: (X with (D = Y)) with (Y = D) loops the same way, and so does a with over the header of a namespace its operand calls into from outside — Ns.E with (D = B) where Ns binds B = D — through however many bindings the loop goes (§5.1).
GRAM3012 Error A rule shadows one from an enclosing namespace or an import. If it is meant to replace it, say so with a rebinding: namespace Name with (X = …) { … } (§5.1).
GRAM3014 Error A grammar declares two context types. One contract for the rules written here. A grammar including this one may strengthen it for its own (§7.7).
GRAM3016 Error A grammar declares two state types. Two concerns are told apart by their values, read by the hook that cares — not by a second type (§7.8).
GRAM3019 Error The context handed to a parse does not satisfy a contract it inherited. A grammar including another may strengthen the contract; it cannot replace it (§7.7).
GRAM3020 Error Two grammars in one composition declare a different state. Every mark a parse places is written in one type (§7.8).
GRAM3021 Error $q or #q where the rule binds nothing called q. A binding is read in the rule that bound it (§3.5.1). Binding names are their own: a capture q: is not a binding — write q: ($q: X) to have both — and $q never names a rule. A rule that needs another rule's text receives it as a capture and compares with a guard.
GRAM3022 Error Two imports at one scope each declare a trivia, and the scope declares none. Which one it reads with would depend on the order of the usings, which never decides between two imports (§5). Declare the one meant in the scope itself, trivia = Spaces.trivia. An import at a nearer scope is not ambiguous with one further out: the nearer one is read (§4.5).
GRAM3023 Error A name two imports at one scope supply, read where the scope does not declare it. Which one it means would depend on the order of the usings, which never decides between two imports (§5): write the one meant in full, A.W. A rule the scope declares itself, or one nearer, is read as before, and so is one name imported twice from one namespace. Before 0.3.0 the first using was read without a word.

GRAM4xxx — what the grammar means

Id Severity What it says What to do
GRAM4001 Error The body of a repetition can match without consuming input. The repetition would not terminate. A word over a wordboundary that can match nothing is a repetition of it, and is said at the boundary's declaration (§4.6).
GRAM4002 Error Left recursion the rewrite cannot take. Direct left recursion is built, and so is an indirect one through rules that only forward. What is refused is an intermediary that does something of its own, a rule with no alternative to start from, and an alternative recursive on both sides (§4.3).
GRAM4003 Error trivia must accept empty input. It is inserted between every pair of operands, and a required match would demand whitespace everywhere (§4.5).
GRAM4005 Error A name in an element set is not a rule.
GRAM4006 Error A capture inside a lookahead, or one read there. What a lookahead records is dropped whether it matched or not. Capture the lookahead itself: ?=X produces X's value (§3.4). A when inside a lookahead may not yet read a capture made before it, c: X & ?=(when @(c.Length > 0)): the lookahead is a reading of its own and is not handed it. A guard reads nothing and needs no lookahead around it — write it beside the lookahead, and ?!(when @(g)) as when @(!(g)).
GRAM4007 Error One name is captured twice with different types. A member has one type; give the two captures the same one, or different names (§7.3). A fold step (§4.3) that collects a name another alternative holds once is the same case: one side is a sequence, the other a scalar.
GRAM4008 Error A => is not on an alternative, or a rule that builds does not say what type. A => builds the rule's value, so it belongs at the end of an alternative, and the rule needs : @T to say what it builds.
GRAM4009 Error An alternative is recursive and states no strength while its siblings do. A rule uses one convention or the other — levels as rules, or << and >> on every recursive alternative (§4.3.1).
GRAM4010 Error A recovery's => has no sequence to put the rejected element in. The repetition collects text rather than values. Give the repeated rule a capture of its own, or drop the => and report out of band (§8.2). Said too where the elements build values, no capture holds each one, and the alternative they stand in has no => of the author's — the rule is its text (: @string, or no type) or its extent (: @SourceSpan), or a sequence they do not join: the rejection would be dropped with them. Declare the rule a sequence of them (: T[]) or capture each element. An alternative with its own => says what it builds and is not refused. A rule whose every alternative forwards another rule's value — Line : @T = v: Item => @(v) \| v: Remark => @(v) — builds a value, and is read as one here. A repetition of values captured whole, rows: (Row* recover ';' => …), is its text too (§7.3), and is refused the same way: capture each element, rows: Row* recover ';' => ….
GRAM4011 Error A rule's declared type is neither a C# type nor a rule in view. §4.1 case 3 takes the value of a rule named here; a C# type is written with @.
GRAM4012 Error A capture or a rule's parameter takes one of the supplied names, or one of the names the generated parser gives parameters of its own: parserSource, parserStarts, parserLengths, parserReading, parserLocating, parserWhole. Every name the parser supplies to a => or a when, and every one it keeps for itself, begins with parser, which is what that prefix is for (§7.3, §8.2). A capture or a parameter of one of them would be declared beside the generated one. Rename it.
GRAM4013 Error A call of a parameterized rule that cannot be built, or a value where a piece of grammar goes. The message says which: a value standing where a piece of grammar goes — a value is allowed where a value is expected, a count, an argument of @Method, inside @(…), so drop its type to make it a recognizer; a call with the wrong number of arguments, said at the call; a parameterized rule named without any, Std.Nested for Std.Nested("/*", "*/"), which is no rule until a call gives it its arguments — in a publication too, which names a rule and passes nothing, so a rule that calls it is published instead; a value parameter passed something that is not a value; a count naming a parameter that was given no number; or a call that would specialize for ever (§4.2).
GRAM4014 Error A rebinding's replacement produces an incompatible result. A rule that reads the replaced one into a type of its own — a declared C# type, a sequence, a constructor — expects the replaced rule's type; so does one that reads a copy of a rule following it (R : B) under a with or a publication's with, whatever its action then does with the value. The message names that reader, the rule it reads and both types. Declare the reader as : Rule of the rule it reads, so that its type follows the replacement (§4.1 case 3), or replace with a rule whose result converts to the expected type (§5.1).
GRAM4015 Error An external recognizer has more than one value-returning overload with different T. Bare @Name cannot say which is meant; give it one such overload, or none (§7.1).
GRAM4016 Warning Two alternatives begin with the same operand, and that operand leads back to the rule. A warning, and a choice rather than a mistake. Ordered choice reads the operand once for each alternative, so the reading doubles at every level of nesting. Written as one alternative with the rest of the longer one optional it is read once — but that is a different grammar wherever the operand can give back. See §4.5 on saying a lexeme is read once.
GRAM4017 Error Two substitutions each need the other applied first: two rules each contain a with that reaches the other, a namespace's header reaches a with that calls back into the namespace from outside it, or two namespaces' headers each reach, from outside, a rule the other rebinds. Neither can be specialized against the other already specialized. Give one of them the rebinding the other was going to apply, or write the substitution as a namespace Name with (…) block around both; for a header, write the rebinding inside the namespace or on a publication (§5.1).
GRAM4018 Warning A rule nothing reaches. A warning: nothing published names it, no rule the grammar reads calls it, no element set drew its items from it, and no rebinding puts it in place of one — so nothing it says is ever read. Publish it, call it, or delete it. Said only about a grammar that is otherwise sound, because a declaration whose syntax did not come out can leave any rule below it unreached; and never about trivia, wordboundary or the rest of the built-in rules, which are configuration rather than rules a grammar calls; nor about the standard library (Std), which every grammar has whole and few call much of. A grammar that publishes nothing is not asked at all.
GRAM4019 Error word in a grammar that never said what continues a word. word is a run of whatever wordboundary matches (§4.6), so without one it is a run of nothing: the rule matches everywhere and consumes nothing. Declare the boundary, or say the shape that was actually meant.
GRAM4020 Error A when … is … somewhere other than beside the operands of an alternative. The condition is answered while the parser is built, and what it decides is whether an alternative is in this parser at all — so an alternative is what it has to be able to delete. Inside a group, a repetition or a capture there is nothing for it to remove. Move it out to the operands of the alternative it belongs to; to guard one element of a group or a repetition, make that element a rule of its own whose alternatives carry the conditions, and call the rule from there — the message says so.
GRAM4021 Error A when … is … whose sides are not two listable sets of strings. is asks whether two recognizers have a string in common. That is decidable, but this compiler answers it only where each side is a literal, a choice of them, or a rule that is one — which is what a domain and a range are. An error, and the build fails with it: the alternative is kept as though the condition held rather than guessed at, since deciding it either way silently changes what the parser reads. Write each side as one of those. Where a side is a rule declared in a namespace under the name of a domain or a range declared outside it, the message says so: the name in the condition now means the local rule, which shadows the outer one (GRAM3012), and a condition written for the range asks about something else; rename the local rule or write the condition outside the namespace.
GRAM4022 Info Every alternative of a rule is ruled out by a condition in this parser. Information, not a warning: a construct removed from a dialect has to be removable, and this is what removing one looks like — a grammar written per version does it in nearly every parser it publishes. The rule becomes one that cannot match, so a caller of it fails where the construct is written and nowhere else. Worth a second look only where no removal was meant.
GRAM4023 Error A grammar published in more than 64 readings. A with that substitutes a rule only conditions ask about makes a reading of the grammar, and the parsers of one rule share one machine told apart by the reading's number — one bit each in a word. Sixty-four is room for every version and product of a real language several times over; publish fewer, or split the grammar.
GRAM4024 Error A when that leaves different C# behind in different readings. The parsers of one rule share a machine, and a condition decides per reading whether its alternative is there. Where the C# beside it survives in two readings as two different pieces of C#, the C# would have to be told which reading it runs in, and it is not. Write the condition so that the C# that survives is the same wherever it does.
GRAM4025 Error A C# method a grammar names cannot be called the way its position calls it. A bare @Name is an external recognizer, static bool M(ReadOnlySpan<char> input, ref int pos) or the same with out T value after the position; an [@Name] in an element set is a predicate, static bool M(char c) — any method a character can be passed to (§7.1). It is looked for where the generated call will look: the class the grammar is attached to, the classes around it, what they derive from, and the classes of the grammars it includes. The message says which it is — no method of that name, only methods of another shape or out of reach, or a name the generated class gives a publication's method, which hides any method of that name outside it. Said only where that is certain: a method of the right shape anywhere in the compilation's source is taken to be the one meant, and a grammar compiled without a host is not asked.
GRAM4026 Error An explicitly requested buffered input form is unsupported. The diagnostic names the unsupported construct or input domain. Existing text and legacy reader forms are not replacements for this explicit request. See syntax §6.3 for the current supported subset. Over bytes that includes a type the grammar makes for a rule from a raw capture: its member is a string, and a raw capture of the byte form is a ReadOnlySpan<byte> that nothing decodes, so the message names the rule and the capture; declare the rule's type and build it with =>. The same holds for a rule declared @string whose => is that capture alone, => @(t), or parserText: the span would be handed back as the string, and the message says to build it with a method the host declares for each input. A recognizer of the host over a span is refused wherever the rule reads it, a recovery's synchronization (recover @M) included.
GRAM4027 Error A yield publication cannot safely produce the requested element sequence. Publish a complete non-nullable Rule* or Rule+ sequence, optionally through transparent wrappers. Collection factories, outer choices, suffixes, recovery and implicit collection trivia are not supported yet. Use a compatible C# element type after yield : @T.
GRAM4028 Error A publication result does not fit its explicit C# contract. Choose a compatible base type, interface or array type. The contract changes the public API, not construction. Byte extent publications must also accept byte[].
GRAM4029 Error A mark is placed, or parserState/parserMarks asked for, in a grammar that declares no state. A mark is a value of the type state : @T declares, so without one there is nothing to write it in. Declare the type the marks are written in (§7.8).
GRAM4030 Error A mark's value names a capture of its own alternative. A mark is what the grammar wrote at the site, the same every time the site is reached; a capture is a value of one reading. Place one mark per value, in an alternative each, and let a construction that must tell readings apart name parserMarks (§7.8).
GRAM4031 Error A guard in a fold step names another step's name for the value so far, which this step has none of. Several steps of one left-recursive rule (§4.3) may capture the leading, self-recursive call under different names; a guard is handed the value so far only under the name its own step gave it. Naming a sibling step's name instead is not bound in this step — give every step that shares a head the same name, or capture the leading call of this step under the name the guard reads.
GRAM4032 Error A reference or a length may be read where nothing bound its text. Every route to $q or #q binds q before it, in the same alternative (§3.5.1). An option ($q: X)? binds nothing on the route that skips it — $q: (X?) binds "" there; a binding in a repetition whose turns hold more than the binding, ($q: X & ',')*, is read only within its turn — bind the whole run; and a binding in a sibling alternative, or to the right of the reference, does not count.
GRAM4033 Error A binding's text read where a value goes. $q in C# after => or when, in when … is …, or as an argument, which is read inside another rule; and the binding's name read as C# there, => @(q), which is handed nothing of that name. A binding is read again only as a recognizer, later in the alternative that bound it: capture the text as well, q: ($q: …), or rename one of the two (§3.5.1). The other places a binding cannot stand have numbers of their own, GRAM4060-GRAM4064; they were GRAM4033 before 0.3.0.
GRAM4034 Error A binding, reference or length where it is not supported yet. Three places not yet supported: a repetition that recovers (recover, §8.2), what such a repetition skips to, or a binding around one, written inside it or in a rule it calls; what trivia is made of once the grammar is cut in two (Lexical = true), which a scanner skips between tokens; and a terminal of such a grammar that binds text but begins with nothing an automaton reads — a lookahead, a host recognizer, a rule that reaches itself first — the message naming the terminal. A terminal that binds text and begins with a literal or a class is begun by the lexer and read whole by its own rule from the token's start (§7.1). A reader or stream form (TextReader, Stream) of a publication reads bindings as its string form does; the automatic windowed reader form beside a find is left out for a rule that reaches a binding rather than refused.
GRAM4035 Error A binding, reference or length in a rule read over token kinds. Once a grammar is cut into a lexer and a parser (Lexical = true), a rule with trivia reads tokens, and a binding there would bind kinds, not text. Compare two captures with a guard instead, close: Name & when @(close == open), or read the grammar over characters (§3.5.1).
GRAM4036 Error A with expression inside an instance of a parameterized rule made only while another rebinding was applied. Not supported yet: the instance is made after every with is put in order, and its with was dropped. The message names the instance, the call as written and the substitution that replaced its rule: R = Ns.G with (E = F) where G = E(B) makes F(D), and a with in F's body is what is refused. Write the rebinding where the instance is called, or on the rule's own declaration (§5.1).
GRAM4037 Error Std.Nested(open, close) called with arguments a counter cannot tell apart. A scanner and a lexer read the pair with a counter, which stops where either delimiter can begin and has to know which one stands there. So both are literals ("…" or "…"i), neither is empty, and they cannot begin at one place: their first characters differ, and differ under folding where a literal folds. Said at the call, the message naming which of these failed; where a parameterized rebinding put it in place (P("<", "<") with (P = Std.Nested)), once at the start of the grammar, naming every reason (§5.2). A refused call is not told anything else: what its empty or overlapping delimiters would make of the library's own text follows from the same mistake.
GRAM4038 Error A recover inside a lookahead. A lookahead is a reading of its own that answers yes or no, and the rule it is written in plans no recovery for it, so the repetition would be read as a plain one. Name the recovering repetition as a rule and call that rule from the lookahead — a rule plans its own recoveries — or take the recover off (§8.2). Also said where a parameter used inside a lookahead is passed a recovering repetition.
GRAM4039 Error A step of a left-recursive rule with no => captures something: its leading call, or an operand after it. Without a => on any alternative nothing is folded (§4.3): the value is what the base made, so the leading call names a value so far that nothing builds, and a capture after it would be written once per step into a record that has one place for it. Give every alternative a => that builds the value step by step, or capture only in the alternatives that are not recursive.
GRAM4040 Error An argument of a call into a namespace with a header, written outside that namespace, names a rule the header rebinds. Not supported yet: the instance is a rule of the namespace, and the header's clone of it rewrites the argument with the rest — Ns.L(B) under B = D read D where B was written, rather than what the argument means where it is written (§5.1). At any depth of the argument (Ns.L(P(B)), Ns.L((Y & B))), through a parameter that passes it on (M(x) = Ns.L(x) called M(B)), under a header the namespace inherits, and where a rebinding is what makes the call one into the namespace (L(B) with (L = Ns.F)). A name the caller's own header binds to the same rule means the same on both sides, and is not refused: a caller inside O with (B = D) passing B into a namespace nested in O, which inherits that binding. Pass a rule the header does not rebind, or write the call inside the namespace if the rebinding is meant.
GRAM4041 Error A with expression inside an argument of a parameterized rule. Not supported yet: an instance is one rule for every call that passes the same argument, keyed by what the argument lowers to, and a with lowers to its operand alone — so L(D with (D = Y)) and L(D) are one instance, and the rebinding was dropped (§4.2, §5.1). Declare a rule with the rebinding and pass that rule: X = D with (D = Y), then L(X).
GRAM4042 Warning A strength on an alternative of a climbing rule reaches no operand. A warning. A strength binds the call of the rule an alternative ends with — a when after it does not count — and sets the strength it is read at (§4.3.1). Here the call the alternative may end with is inside an optional, a choice or a repetition (left: E & '?' & mid: E & (':' & right: E)? >> 1), so it is read at 0 and the marker says only at what strength the alternative is entered. Write the alternative twice, once ending with the operand and once without it, to give the operand its strength.
GRAM4043 Warning A rule is spelled from single characters where trivia is not empty. A warning. Every operand of the rule tests one input item — a class, any, a one-character literal, eol, a call to a rule that is itself one such item, a back-reference, or a group, option, repetition, {} or capture of those — at least one is a class or any, and trivia is woven between two of them, so Std.Digit+ & ('.' & Std.Digit+)? reads 1 . 5 as one number and Letter & (Letter \| Digit)* reads i f as one name (§4.5). Write ~ between the parts, or declare the rule where trivia = none; if the space is meant, write trivia there. Not told: a rule that names trivia, the rules trivia itself is made of, a template's specializations, and runs — Std.Digits & ('.' & Std.Digits)? and Word & ('.' & Word)* have the shape of a dotted name, which only the author can tell from a dotted number. Braces do not silence it: they commit a reading and keep the seams. A single-digit calculator meant to be spaced, Digit & ('+' & Digit)*, is told too; write trivia where the space goes.
GRAM4044 Error A recover in a rule the lexer reads. Said only where the grammar is cut in two (Lexical = true): the lexer reads a terminal, what a terminal is made of and trivia as the longest match of a regular language, so a repetition there would be read as a plain one, with no element to step over. Recover in the syntax that reads the tokens, or leave Lexical off. Said where each such recover is written, an inner one too (§8.2).
GRAM4045 Error A recover inside another one's repetition, or a synchronization with a guard, shares what a rule of its own could not. A marked repetition inside another one's element recovers as if it were its own rule there, and that rule cannot read, or be read by, what the rest of the enclosing rule reads while it is being read: a guard inside reading a capture made outside it and not inside it before the guard, a guard outside reading one made inside it, a value built inside it with =>, or a capture of a lookahead inside it. Said where the inner recover is written. Move the part into its own rule and pass it what it needs (§8.2); the enclosing rule's own => may read what was captured inside. A synchronization that holds a guard or a capture is a rule of its own in the same way, and a guard in it reading a capture of the rule around it is said at its recover.
GRAM4046 Error A rule that is told where it was written builds a Nullable of a struct. An error, said where the rule is written, for a grammar that names a LocationType and has a rule of type S? or Nullable<S> with S a struct implementing it. A Nullable has no property of the interface to write: where every rule is located the generated call did not compile (CS1061), and with UsePerCallLocations the value was boxed, told and handed back without its location. Build the struct itself, make the type a class or a record class, or keep the rule out of the located ones (§6.8). A struct itself is told on the value the rule returns, and is accepted.
GRAM4047 Error A literal, or a class item, is U+0000 in a grammar that names eos. That character is how this version reads the end of a segment: no segment holds it, so the item could never match. Match the end of a segment with eos. A range or a category that merely holds it, ['\0'..'\u001F'] or \p{Cc}, is read without it and not told (§3.1.1).
GRAM4048 Error Text is captured, bound or published across an eos, or parserText or parserInput would hold one. A boundary has no character, so there is no text of it to keep. Capture the parts on either side of it, or a value built from them; a capture of a rule that builds a value may span boundaries. Text around a repetition marked recover is taken to hold one, whatever it synchronizes on, and so is what a when inside it reads after its first turn (X? and X{1} have none), or in its synchronization; a when in a rule that builds no value is read as if it stood where the rule is called, whose text it may be handed; the parserText of a left-recursive step is the rule's text from its seed on; a count by a length (X{#q}) is read as any repetition, and one whose most is nought (X{0}) reads nothing, and recovers nothing when it is marked recover. A recover without a => is refused unless it synchronizes on eos: it hands OnRecovered the text it stepped over, which up to eos is the rest of one segment. parserText may be read where what it stands for holds no boundary: a rule's own text inside one segment, a when before the first eos, a recover eos. parserInput is not supplied to such a grammar (§3.1.1).
GRAM4049 Error Lexical = true over a grammar that names eos. A token cannot reach over the end of a segment, and the end of a segment is not a kind of token. Leave Lexical off for it (§3.1.1).
GRAM4050 Error A buffered or byte form is asked of a grammar that names eos. Such a grammar reads a list, a sequence or a reader of lines, and nothing else (§6.3). Leave the buffered and byte forms off for it.
GRAM4051 Warning trivia is not atomic, and a class beside one of its seams reads a character it reads. A warning. A class, any or a negated class at the edge of an operand on either side of a seam — written there, or at the start or the end of the rule that operand calls — admits a character trivia can begin with. A run of such characters can then be split between the two in as many ways as it is long, and since trivia without braces gives back what it read, an input that is refused is read again for every split at every seam: exponentially many times in the number of seams. trivia = ' '* beside Field = [^ ',' \| '\n']+ is the shape, where a few refused rows of a CSV file take seconds. The message names the characters, the class, the rule it is written in and the rule whose seam it stands beside. Write the trivia in braces, trivia = { ' '* }, so that what it reads stays read; or, where that is the rule the trivia forwards to, brace that one. Not said at the end of a braced operand, which keeps what it read (its beginning is still told: the trivia in front of it can give it characters); not for the characters a negative look right in front of an element refuses, (?![' ' \| ','] ~ any); not where the class is joined to its neighbour with ~, where it asks the host ([@IsBlank]), or for a grammar cut in two, whose scanner never gives trivia back (§4.5).
GRAM4052 Warning A repetition can read one run of text in two ways. A warning. In a grammar that publishes parsers under different substitutions (parse X with (Version = …) as Y), the message ends by naming the publications whose parser reads the repetition, each with the values of its with, since the ambiguity may be in one version's parser and not another's. Over characters a choice and a repetition give back what they read to a later failure, and a rule call does not stop that, so an input that is refused is refused only once every reading of what came before it has been tried. Where a repetition can read some text in two ways — a turn that can end in two places, (X+)*; two alternatives that read the same, ('a' \| 'a' & 'a')+; folding white space optional on both sides of a repeated word, (Cfws? & Word & Cfws?)+ — that text repeated n times has two to the n readings, and a refusal after it tries every one, as does an input accepted only by an alternative after the one that read the run: a URI template's run of literal characters and an address's words were both met this way, at seconds for a few dozen characters. The message is at the rule the repetition is written in, spells the repetition and the shortest text it reads two ways, and is said once a repetition, for the innermost of a nest. Asked of every *, + and count without an upper bound read over characters, and in a grammar cut in two (Lexical = true) of those in rules marked ? only, over kinds; of the author's own rules, not those of an included grammar or the standard library. Not said for a repetition where nothing after it, up to the braces or the look around it, can fail, since its first reading then stands — { (('a' \| 'a' & 'a')+)* }, ?=(('a' \| 'a' & 'a')+) — unless it must take more than one turn or as many as the input says, and can fall short after any reading ({ ('a' \| 'a' & 'a'){#q,} } never succeeds there and so never commits); a repetition whose body is braced, which keeps what a turn read; a repetition marked recover, which commits each turn it finishes (§8.2); a turn the parser reads as one test of one character, as (X \| Y)* is where X and Y each read one; the lexer's terminals; a rule over kinds not marked ?, which answers once (§4); the trivia woven at the seams between operands, which is GRAM4051's (trivia the author joins with ~ is no seam, and is read as any call is); the doubling a recursion drives, which is GRAM4016's; and two runs one after the other, 'a'* & 'a'*, which cut a text in as many ways as it is long and not exponentially many. It can tell too much. A look of more than one character, or a when, that removes one of the two readings is taken as reading nothing; a look of one class (?!'"', ?=eof), a look behind, and the end of a braced run of one class ({ [^ '\n']* }, after which no such character can follow) are asked what they leave, against what a braced or opaque step after them begins with: (X \| X & X)+ with X = { 'a'+ } is not told, since the first X takes the whole run. A repetition whose automaton is past the analysis's budget is not told either. And too little, so silence is no proof. A call to a recursive or braced rule, a back-reference, a recognizer of the host and a call past the inlining budget are each read as one opaque letter that overlaps only itself: (X \| 'a')+ with X recursive and reading a is not told. Calls are followed sixty-four deep and no deeper, and the one past is such a letter too: A0 = 'a' \| 'a' & 'a' under sixty guards Ai = when @(true) & A{i-1} is told in A60+, and under sixty-five is not. Two cures, and they differ. Braces around the repetition or what it repeats keep what a turn read, and so can change the language: {('a' \| 'a' & 'a')+} & 'a' refuses aa, which the unbraced rule reads. Rewriting the repetition so that each text has one reading keeps it: 'a'+ for ('a' \| 'a' & 'a')+, X* for (X+)* (which reads nothing too) and X+ for (X+)+, Cfws? & (Word & Cfws?)+ for the word with folding on both sides. Brace where no input needs a turn read again; rewrite where one may. A warning that is wrong is silenced as any is, #pragma warning disable GRAM4052 around the [Gram] or NoWarn, with the reason beside it; raised to an error as any is, <WarningsAsErrors>GRAM4052</WarningsAsErrors>, /warnaserror, or dotnet_diagnostic.GRAM4052.severity = error in a global analyzer configuration or in the .editorconfig section of the C# file a [Gram] is written in (a [*.gram] section does not reach a grammar file's diagnostics) — the build and dotnet dotgram generate alike (docs/cli.md).
GRAM4053 Error A supplied name is written where it is not handed over: parserInput, parserState or parserMarks in a when; one of the parser's own parameters (parserSource, parserReading, …, GRAM4012) anywhere; a rejected element's name (parserMessage, parserLine, …) in a =>; the marks in a recover factory; or a supplied name used as a method, a type or a variable, where it is reserved. Each place is handed a fixed set of the names §8.2 lists, and a name outside it would be an undeclared identifier in the generated file. A when runs while the text is read, before what stands over it is settled, and builds no value that could keep the input; a => builds the value of an element that was read, so has none of a rejected one's; a rejected element was never read, so no mark stands over it.
GRAM4054 Info Two alternatives of a rule read a nested instance of the rule's own recursion before either can be refused. Information. Ordered choice decides by trying, and a trial that fails keeps nothing of what it read. Where two alternatives share a prefix holding a construct the recursion they stand in can occur in again — a bracket whose content the same tower reads — and the token that tells them apart comes after it, the construct is read once per alternative, at every level of a nest: (CASE WHEN c THEN 1 END = 1) read as a value in brackets, refused at =, and read again as a condition in brackets, doubling with the depth (§4.7). The message is at the rule, names the alternatives (for an optional, a repetition or a lookahead, the reading and what follows it) and the shortest text after which both go on reading the same construct, and says what the parser does about it. Over tokens, on the immediate carrier, the reader remembers where the rules of that recursion succeed and what they built, beside the memo of failures, so that every level is read once (Machine.Memo.cs); the message names the rule remembered — the first of the recursion both alternatives enter at one token — and the cost: a store at each of its successes of four tokens or more, and 8 bytes a token for it. Over characters, carried deferred, in a trace build, where a construction may throw (ConstructionsMayThrow), for a lookahead's pair (a reading inside a look is not remembered), where a rule of the recursion reaches a hook naming its context or is marked ?, or where DOTGRAM_NO_SUCCESS_MEMO is defined, nothing is remembered: then the message says why, and that the nest costs its depth's power until the alternatives are written to read the shared text once. Either way the rewrite is shown, and it needs no memo: factor the prefix the alternatives share (A & (X \| Y), GRAM4016), read a bracket's content in one rule and tell what it was by a switch on it, or read the value and then its tail. Whether to rewrite is a measurement: on SQL-92 the rewrite cost more on accepted texts than the memo does. Said for a when on the way too, with a note that the guard may separate the two, since a guard is read as nothing. Bounded, not a proof: the two alternatives are followed over at most fourteen tokens, a rule at most twice on one stack, three thousand states a pair; a shared prefix longer than that before the nested construct is not seen, and silence is no proof. A switch is not an ordered choice and is not asked; a ?! of up to three literals is honoured. Not a warning and never an error: a grammar written this way is correct and, where the memo applies, linear; dotnet_diagnostic.GRAM4054.severity = none hides it, and a hidden hint changes nothing in the parser.
GRAM4055 Error positional parse in a grammar that names eos. Such a grammar reads its segments joined, which only the parser does, so no position of the caller's can stand in that text and no form begins where it is told (§6.3). Drop positional.
GRAM4056 Error A construction's value cannot be the type it is declared to give: a capture handed back whole (=> x, => @(x)) that holds text where an array or a value type is declared, or a generated type where another type is; a grammar's type built with the wrong number of values, or from a capture that cannot be its member (=> Pair(right)); a rule's name built or taken as a type where the grammar generates none for it, because it declares its own type or captures nothing. Said on the grammar rather than by the C# compiler in the generated file, and only between types whose every conversion the grammar knows: the types it generates, C#'s own written by their keywords (string, int, …), and arrays of those. A type of the host's on either side may declare a conversion, and is left to the C# compiler. Capture what holds the declared type, hand the generated type one value per capture of its rule, in the order the rule writes them (§3.7, §4.1). What a C# expression makes of a capture is left to the C# compiler.
GRAM4057 Error What a rule can begin with does not settle. A defect of the compiler's rather than of the grammar: working out the first sets came back to a state it had been in, so it would have gone round for ever instead of settling, and the grammar is refused rather than compiled from an unfinished answer. Every grammar known to do this is refused already as left recursion (GRAM4002); report one that is not.
GRAM4058 Error C# in a rule — a guard, a switch's selector, a construction, a mark — names one of the rule's parameters that stands for a piece of grammar: Value(tag) = switch @(Kind(tag)) { … }. Such a parameter holds no value C# could read; it used to fail as CS0103 in the generated file. A value is handed by a parameter written with its type, Value(tag: @string), and is a literal or a value the caller was handed itself (§4.2); what the parse produces is captured where the rule is called and handed to a => there. Only the C# the rule's own declaration writes is asked — a guard, a selector, a =>, a mark, a value handed to a call — not what an argument brings in, and a name before a dot counts, when @(item.Length > 0). Nothing is said where the host has something of the name that the C# reads: a member, a field or a method handed on, or a namespace or a type before a dot, System.Math or Math under the grammar's @using System;; with no host to ask (a grammar compiled on its own), nothing is said, and C# that does not compile is the C# compiler's to say on the grammar's line.
GRAM4059 Warning A grammar publishes nothing, and nothing includes it. A warning. The grammar has no parse, find or yield of any visibility, so its class gets no method to call: it is only of use included by another grammar, and no [Gram] class in the compilation includes it ([GramInclude]) or is derived from its class. Most often a parse was forgotten. A grammar written for other assemblies to include says so with [Gram(ExportGrammar = true)], written out: that a public class exports its grammar by default is not enough, since every public host does. Said once per class, and only where nothing else is wrong: not beside any error the generator reports for the class: in the grammar or the class itself, of any of its readings and variants (GRAM0002 to GRAM0011 among them), or in an attribute on any declaration of it (an option under its 0.2 name, GRAM0012); never of a [GramParserVariant], whose class's [Gram] answers for the grammar.
GRAM4060 Error A binding inside a lookahead. A lookahead gives back what it read, and its own records with it. Bind outside the lookahead; a reference inside one, ?!$q, reads an outer binding and is fine (§3.5.1). A read after such a binding is not told again as GRAM4032.
GRAM4061 Error One name bound twice on one route. A name is bound once on each route. Give the second binding another name (§3.5.1).
GRAM4062 Error A reference or a length inside its own binding. The text is still being bound there. Read it after the binding (§3.5.1).
GRAM4063 Error A binding and its reference on two sides of a constructing group. A group ( … => … ) builds its value as a rule of its own, and a binding is read only in the rule that bound it. Bind and read on one side (§3.5.1).
GRAM4064 Error A binding in a step of a left-recursive rule, or around its leading call to itself. The steps are read as a loop of their own, after the base (§4.3). Put the binding and its read in a rule the step calls; for the leading call, in the base or in such a rule (§3.5.1).
GRAM4065 Error A piece of grammar, a group or an operator, written where a value goes. After =>, in a when, in a with state or in a recover's =>, a value is a name, a call, a literal, or C# after @. (l & r), (l), (l | r) and (l?) are what a rule reads, with no C# to hand over: write an expression as @(…), as in => @(l + r), or => l for a capture handed back whole.

GRAM5xxx — what a grammar gets

These do not say a grammar is wrong. They say what it will not be given, and why.

Id Severity What it says What to do
GRAM5001 Info A publication gets no overload taking a reader, or, in a grammar that names eos, reads its segments whole. The message says which of the reasons applies: something the rule matches can cross a line (a segment, where the grammar names eos) — a repetition is measured by one turn, but one marked recover that hands over nothing is read whole, and measured whole — it marks two repetitions recover side by side, or the one it marks is not the repetition of a rule the stream hands back, the rule keeps what it cannot keep from a window, or a stream would hand back other values than the string does — a part that is not a call collects one, the rule builds its value with =>, a part can end in more than one place, the trivia can read into a part, or a guard among the parts reads the rule's extent (parserSpan, parserText), which over a string runs from where the rule began (§6.3). Over segments a yield publication is told too: its forms over a sequence and over a reader read the input whole, then hand the elements over; a plain parse of the sequence rule is the one that streams.
GRAM5002 Info A repetition can begin with the same input as what follows it. Information: the reading is ambiguous where the two overlap, and the parser resolves it by order rather than by meaning.
GRAM5003 Warning A generated method is left past the size at which the JIT stops optimizing it. A warning: the parser is correct and several times slower than it needs to be. The message names the estimate, the budget the generator divides methods under, and what to split to restore optimization.
GRAM5004 Warning Lexical = true was asked for and the grammar cannot be cut in two. A warning: the parser that comes out is the one the grammar would have been without the request, which reads the same grammar over characters — and the two readings are not always the same parser, since a lookahead after a seam sees the next token's first character over characters and nothing over tokens. Asked for and not given is worth a warning. The message says which it is — no trivia at all, so there is nothing to tell a token from a character; a terminal that is not a regular language; a find, which hunts through characters for a place to begin; a trivia not written in braces, the seam between tokens being skipped by the scanner braces ask for; a published rule that is no token of its own over tokens — what the seam is made of, or a helper a terminal calls; a published terminal that builds a value, which over tokens only the rules that call it read; or a terminal that builds its value from its own captures, where over tokens a terminal's value is read again only as a type it declares (: @T with =>). A terminal that binds text (§3.5.1) adds four, each naming the fix and ending "this part is read over characters": its body is not atomic, so write { } around it to read it as one token; another token can match a longer text that begins like it, so keep that token from continuing the beginning, or put both in one terminal as alternatives; trivia can begin where it begins; or two such terminals have beginnings of which one begins the other's.
GRAM5005 Warning A split grammar's syntactic half cannot be read by methods, so it runs on the shared engine. A warning: the grammar was cut in two to be read by methods, and part of it is not. The engine reads it as the methods would — over kinds it compiles each call, and each choice and repetition of a rule not marked ?, as if braced, so a rule's answer stands (docs/syntax.md §4) and a choice or a repetition that has matched is revisited only inside a rule marked ? — but it is the slower rendering, and a grammar written to be read by methods is told which rule took it off them. The message names the rule and what about it the methods refused: a recovery, a stream, a find, a captured lookahead, a guard handed what a reader cannot hand it, or a rule called with arguments.
GRAM5007 Warning The immediate carrier was asked for by name and is not what carries some of the grammar. Only where Carrier = GramCarrier.Immediate is written: a grammar left to the generator falls back to Deferred in silence, and the carriers report says which of its machines did. The machines named are compiled deferred, and each is the one it would have been without the request; the rest of the grammar keeps the carrier. The message names the publications and the input forms that moved, and every reason and every rule that stands in the way: the carrier refuses a machine that recovers where a construction is not settled at its rule's end, one with a rule that is an extent collected across the turns of a repetition, one where two members gathered across turns onto the stack of one type are taken by one construction (members of alternatives with a construction each never meet, so those are carried), and one where a sequence is gathered from values of several types. The other case is a grammar nothing of which is read by methods at all, since a carrier is what a reader holds: then the whole grammar is carried deferred, and the message says why it is not read by methods. A find beside a parse is not one of these: it is a machine on the engine next to one the carrier is carrying, which is GRAM5005. A warning: the parser is correct, but a carrier asked for by name is a carrier somebody means to measure or to rely on, and one that quietly is not there makes every comparison against it compare the deferred carrier with itself.
GRAM5009 Info An optional or a repetition can take what follows it, where nothing can give it back. Information. Over characters this is settled by backtracking and the parse succeeds by the second reading, which is GRAM5002; over kinds a rule's answer stands (§4), so the optional takes what follows, what follows is not there any more, and the rule fails one token past what it ate. Asked only of a grammar cut in two, and only of what the optional can match in one token — an optional that begins like the next clause and cannot match the whole of it fails and gives nothing back. The fix is a lookahead in front of it naming what it may not take, as ?!SourceClause & Identifier does. Where the sequence has nothing left to read, what follows is what follows the rule.
GRAM5011 Warning A terminal of a split grammar is nothing but @M. A warning: the lexer has no beginning to stop on, so it asks the host at the start of every token, before its own automaton. Write what the terminal begins with in front of it — Blob = '<' & @ReadBlob — and the automaton reads that beginning with every other token, and the host is asked only where it stands, from where it ends. The rest may be a rule instead of a method, where the grammar can say it: Comment = '/*' & Nested.
GRAM5012 Info A grammar left to the generator is carried as Immediate, and Deferred would hold some of its constructions back. Information, said only where Carrier is not written. The generator carries every grammar it can with the immediate carrier: every construction runs where its alternative is read, and the walk the deferred carrier runs at the end is not there. Where a rule it builds is read for a derivation that may be given up, or can be read again after it has answered, its constructions can run for text the parser then reads another way, or reads a second time — in a grammar with no context and no recovery a constant number of times, at most two attempts for each enclosing loop that gives back: the reading made again for the message, and every attempt after a turn has been given back a second time until one stands, build nothing but what a guard names. With a context, the reading for the message builds again; where a way back is taken in a loop that cannot read unbuilt — a context, a recovery, a rule whose own guard asks for its value so far — the warning is GRAM5016 instead. Where a construction writes context and nothing that runs during recognition reads it, the message says so first. A construction that only builds does not mind; one that can throw, or has side effects, behaves differently there than deferred: an exception it throws escapes the publication (§7.5), unless the grammar says ConstructionsMayThrow = true, which holds it and throws it only where the deferred carrier would have. The message names that option where the grammar does not set it; a grammar whose constructions only throw, and have no other effect, can set it and keep the immediate carrier. The message names the rules. Carrier = GramCarrier.Deferred holds every construction back until a parse has accepted (§3.7); Carrier = GramCarrier.Immediate says the author has checked, and silences this and every reason found later. Nothing is said where nothing is held back, where the immediate carrier refuses the grammar, or where GRAM5016 is said.
GRAM5014 Info A buffered form is read by the engine where its string form is read by methods. Information. A publication read by methods over a string is read by methods over a TextReader or a Stream too, except where a rule it reaches can reach itself: a reading that deep goes on in another thread with the whole input, and a buffer cannot hand that over. The parse is correct either way; this says why the two forms are two renderings.
GRAM5013 Info Whether a refused input is read again over a context put back as it was. Information. A parse reads first without recording what it would say if refused, and reads a refused input again to say it (§7.7). Over a context the reading writes into, the second reading has to begin where the first began: where the context's type has an instance Mark() and a Rollback taking what Mark() returns, the parser calls them and says so; where it has not, every input is read once, recording, and the message says the pair is what would change that.
GRAM5016 Warning A grammar left to the generator is carried as Immediate, and Deferred would be safer. A warning, said only where Carrier is not written, for the two reasons that can change more than whether a construction runs twice. One: constructions that name context share it with a hook that runs during recognition — a when, a switch selector, or an external recognizer handed the context — and a rule they are in is read for a derivation that may not stand or can be read again. Carried immediately a construction runs as its alternative is read, interleaved with those hooks, rather than after the parse has accepted, so a guard or a recognizer can see what a construction wrote, and a construction that reads context sees it as it stands at that point: what the grammar accepts and the values it builds can both differ from the deferred carrier's (§7.7). Two: a refused input can allocate memory quadratic in its length, because what a rule that builds has read is built again each time a way back is taken — a list once a turn given back: the reader reads unbuilt after a loop's second give-back, and does not where the grammar has a context or a recovery, or where a rule's own guard asks for its value so far. Said of every loop that asks for another reading of a rule that builds, in such a grammar: whether the input can take a way back once a turn is not something the generator can see. For untrusted input keep it deferred. The message names the rules. Carrier = GramCarrier.Deferred holds every construction back until a parse has accepted; Carrier = GramCarrier.Immediate says the author has checked, and silences this and every reason found later.
GRAM5017 Info A construction of a publication read from a reader or lines changes the context. Information. A construction that assigns to, compound-assigns or increments a member of context (context.Rows++) is reachable from a publication that has an overload over a reader or a sequence of lines. A streamed reading may run a construction a different number of times than a reading of a string does (§6.3), so what it leaves in the context may differ. Said once for the publication, at it. Syntactic and best-effort: comments are skipped and parentheses, !, ?. and @ in the member are seen, but a string that spells such a change is taken for one, and a change made by calling a method of the context, or through a local that holds it, is not seen. Read the context in a construction, or do the work in the one that builds the result.
GRAM5018 Error A name would be written twice into the generated class. An error, said where the author wrote the name. A publication, or the Try of a parse, named after a class of a reading of the host ([GramParserVariant("Name")]), or Match, Outcome, SourceSpan, ParserInput, OnRecovered, OnHandingOff, OnTakingOver, Scan (in a grammar read over tokens only), DefaultBufferSize, DefaultMaxRetained, Limits, ParserLimits, Failure, ParserEntry, one of the fields of the pools (_spareParser, …), or one of the names a trace build declares (GramTrace, GramRead, GramWhy, GramTraceLog, GramProfile, Tracing; in every build, traced or not), after the class itself, or written by another publication (§6); two rules that are written alike once their namespaces are joined with _ (A.B and A_B), or one whose joined name would hold _DotGram (DotGram_B in namespace A); two captures of one rule that become one property (a and A, or r and rValue in a rule called R) (§7.3). Rename one of them. And a part of SourceSpan declared in the class of a reading of a host with several readings, which share one span in the host: declare the part in the host (§6.2). And a class a reading is compiled into that is called Limits or ParserLimits, or that declares a member Limits or ParserLimits itself, where the generated part declares the limits a caller sets (§6.5): rename the class or the member. The type a rule's value takes is given another name by the generator where it would take one of the names above or another rule's type, and is not this error — except where the grammar names that type by its rule, as Swapped : Pair or => Pair(a, b) do (§3.7, §4.1): a name the grammar writes has to be the type's, so a rule whose type would be renamed is this error, and is renamed by its author. That is the whole list, and it is closed: every other name the class writes has _DotGram in it, and every one made from a name of the grammar's is its kind, _DotGram_ and that name, with nothing after it (§6), so it is never a name an author can write and never another such name.
GRAM5019 Warning A guard that names context is read again where a terminal's value is built. A warning, at the terminal, in a grammar read over tokens (Lexical = true). The lexer reads the token under the context as the publication was handed it; a terminal whose value is built by reading its token again runs its guards again then, against the context as the parse has written it by that time. Where the context has changed in between, the value can be another alternative's, with nothing to say so, or the reading again refuses the token and the parse throws an InvalidOperationException naming the terminal and where it stood (§7.1). A risk and not a proven error: a guard that reads configuration holding for the whole parse is safe, and the warning can be suppressed for it; one that reads what the syntax writes needs the grammar read over characters, without Lexical = true. Not said of a terminal whose value is its token's own text, which is not read again.

GRAM6xxx — the tooling a grammar is annotated for

GRAM600x are about the classifications a [GramClassify] attribute declares for a grammar's language. The build reports them, underlined inside the attribute's target, and Visual Studio shows the build's; the editor holds the targets to the grammar with the same binder and does not report them a second time. GRAM61xx are the Visual Studio extension's alone, reported in the editor about a string written in that language at an embedded DSL site; a build never shows them.

Id Severity What it says What to do
GRAM6001 Warning A classification target is neither Rule nor Rule.capture. A warning, underlined inside the attribute's target. Name a rule, or a rule and one of its captures, separated by one dot.
GRAM6002 Warning The grammar rule a classification target names was not found. A warning. Name a rule the grammar declares.
GRAM6003 Warning The grammar rule a classification target names is ambiguous. A warning: more than one rule answers to the name. Name the one meant.
GRAM6004 Warning The capture a classification target names was not found in its rule. A warning. Name a capture the rule declares.
GRAM6005 Warning A classification target is specified more than once. A warning. Keep one [GramClassify] per target.
GRAM6101 Error The text of an embedded DSL site does not match its language. An error, underlined at the position where recognition failed. The message names what was expected there.

Retired numbers

Not reused, and listed so that a suppression written against one is recognizable as dead.

Id What it used to say
GRAM3013 Refused a context inside a namespace. See GRAM3019.
GRAM3015 Refused a state inside a namespace. See GRAM3020.
GRAM3017 One context per assembly. See GRAM3019.
GRAM3018 One state per assembly. See GRAM3020.
GRAM4004 Retired before release.
GRAM5006 Said that the reader was asked for and declined a grammar. See GRAM5005.
GRAM5008 Said, as information, that the deferred carrier (then Tape) was holding constructions back for a promise the grammar might not need, and offered Carrier = GramCarrier.Immediate. See GRAM5012.
GRAM5010 Said, as information, that a publication compiled as a plain method gets no overload taking a position or a window.
GRAM5015 Warned that the immediate carrier was asked for by name over a grammar the generator would have kept deferred (then Tape). The generator keeps no grammar deferred by choice now, and an explicit carrier is the author's decision and is told nothing; a grammar left to choose is told the reasons as GRAM5016 and GRAM5012.