docs(spec): document directive syntax in language grammar#11022
docs(spec): document directive syntax in language grammar#11022Copilot wants to merge 4 commits into
Conversation
- Add LineTerminator and LineTerminatorSequence productions to lexical grammar, separate from WhiteSpace (matching how the scanner emits Token.NewLine vs Token.Whitespace) - Update Trivia to include LineTerminatorSequence alongside Comment and WhiteSpace - Fix the incorrect comment claiming newlines have no language-semantic impact; directives are terminated by newlines so they ARE significant - Add DirectiveList, DirectiveExpression, DirectiveArguments, and DirectiveArgument productions to the syntactic grammar with notes on newline-aware termination and currently supported directive names (#suppress, #deprecated) - Add DirectiveList? before DecoratorList? in all statement/declaration productions that accept annotations Closes #949 Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
|
@copilot ecmarkcup runs out memory now |
Defining `LineTerminator` caused ecmarkup to try expanding the "SourceCharacter but not ... or LineTerminator" productions in BacktickedIdentifierChar, StringCharacter, and SingleLineCommentChar. This triggered a memory blowup that crashed the build at 4GB heap. Since LineTerminator was already referenced-but-undefined in those three productions before this PR, keep it undefined. Define only `LineTerminatorSequence` (using <LF>/<CR> character literals directly) since it is the production that needs to appear in Trivia. Also remove the two-alternative form of DirectiveExpression that used `LineTerminatorSequence` as a syntactic-grammar terminal — directive termination is explained in prose instead. Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
... Fixed in the latest commit. The root cause was the Fix: remove the |
|
@copilto fix spellcheck |
|
@copilot fix spellcheck |
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Fixed — two instances of |
|
You can try these changes here
|
The grammar spec had no coverage of the
#suppress/#deprecateddirective syntax, and incorrectly claimed that newline sequences have no language-semantic impact — which is false since directives are newline-terminated.Lexical grammar
LineTerminatorSequencefromWhiteSpace— the scanner already emitsToken.NewLine(CR, LF, CRLF) separately fromToken.Whitespace; the spec now reflects thisLineTerminatorandLineTerminatorSequenceproductions defining the three recognised sequencesTriviato includeLineTerminatorSequencealongsideCommentandWhiteSpaceSyntactic grammar
DirectiveList,DirectiveExpression,DirectiveArguments,DirectiveArgument— with prose notes on newline-aware termination, the EOF edge case, the two recognised directive names, and their per-directive argument counts (validated semantically)DirectiveList?into all annotatable productions —BlocklessNamespaceStatement,ModelStatement,ScalarStatement,InterfaceStatement,InterfaceMember,UnionStatement,UnionVariant,EnumStatement,EnumMember,NamespaceStatement,OperationStatement,ModelPropertyExample of what is now documented: