From 1faa499f734d9af318617ea3e224183467905ab5 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Mon, 15 Jun 2026 08:00:43 +0200 Subject: [PATCH] Rewrite AST node grammar productions in W3C EBNF The grammar-production doc comments were transcribed in ANTLR style and often copied the C# spec verbatim, including sub-rules the AST does not model. Rewrite them as W3C EBNF (::=, ?, *, +), unroll sub-productions that are not themselves AST nodes (e.g. anonymous_function_modifier -> 'async'), and shape each production to the node's actual members. Render top-level alternations of node productions as multi-line blocks; keep operator and keyword token lists inline. Assisted-by: Claude:claude-opus-4-8:Claude Code --- .../CSharp/Syntax/ComposedType.cs | 10 +++---- .../CSharp/Syntax/DocumentationReference.cs | 7 ++++- .../Expressions/AnonymousMethodExpression.cs | 2 +- .../AnonymousTypeCreateExpression.cs | 2 +- .../Expressions/ArrayCreateExpression.cs | 2 +- .../Expressions/ArrayInitializerExpression.cs | 2 +- .../CSharp/Syntax/Expressions/AsExpression.cs | 2 +- .../Expressions/AssignmentExpression.cs | 4 +-- .../Expressions/BaseReferenceExpression.cs | 2 +- .../Expressions/BinaryOperatorExpression.cs | 4 +-- .../Syntax/Expressions/CastExpression.cs | 2 +- .../Syntax/Expressions/CheckedExpression.cs | 2 +- .../Expressions/ConditionalExpression.cs | 2 +- .../Expressions/DeclarationExpression.cs | 2 +- .../Expressions/DefaultValueExpression.cs | 2 +- .../Syntax/Expressions/DirectionExpression.cs | 2 +- .../Syntax/Expressions/ErrorExpression.cs | 2 +- .../Expressions/IdentifierExpression.cs | 2 +- .../Syntax/Expressions/IndexerExpression.cs | 2 +- .../InterpolatedStringExpression.cs | 14 +++++++--- .../Expressions/InvocationExpression.cs | 2 +- .../CSharp/Syntax/Expressions/IsExpression.cs | 2 +- .../Syntax/Expressions/LambdaExpression.cs | 2 +- .../Expressions/MemberReferenceExpression.cs | 2 +- .../Expressions/NamedArgumentExpression.cs | 2 +- .../Expressions/NullReferenceExpression.cs | 2 +- .../Expressions/ObjectCreateExpression.cs | 2 +- .../OutVarDeclarationExpression.cs | 2 +- .../Expressions/ParenthesizedExpression.cs | 2 +- .../Expressions/PointerReferenceExpression.cs | 2 +- .../Syntax/Expressions/PrimitiveExpression.cs | 11 +++++++- .../Syntax/Expressions/QueryExpression.cs | 26 +++++++++++-------- .../Expressions/RecursivePatternExpression.cs | 8 ++++-- .../Syntax/Expressions/SizeOfExpression.cs | 2 +- .../Expressions/StackAllocExpression.cs | 7 ++++- .../Syntax/Expressions/SwitchExpression.cs | 4 +-- .../Expressions/ThisReferenceExpression.cs | 2 +- .../Syntax/Expressions/ThrowExpression.cs | 2 +- .../Syntax/Expressions/TupleExpression.cs | 2 +- .../Syntax/Expressions/TypeOfExpression.cs | 2 +- .../Expressions/TypeReferenceExpression.cs | 2 +- .../Expressions/UnaryOperatorExpression.cs | 11 +++++--- .../Syntax/Expressions/UncheckedExpression.cs | 2 +- .../Expressions/UndocumentedExpression.cs | 9 ++++++- .../Expressions/WithInitializerExpression.cs | 2 +- .../CSharp/Syntax/FunctionPointerAstType.cs | 2 +- .../CSharp/Syntax/GeneralScope/Attribute.cs | 2 +- .../Syntax/GeneralScope/AttributeSection.cs | 3 +-- .../CSharp/Syntax/GeneralScope/Comment.cs | 2 +- .../CSharp/Syntax/GeneralScope/Constraint.cs | 2 +- .../GeneralScope/DelegateDeclaration.cs | 2 +- .../GeneralScope/ExternAliasDeclaration.cs | 2 +- .../GeneralScope/NamespaceDeclaration.cs | 8 ++++-- .../GeneralScope/PreProcessorDirective.cs | 6 ++--- .../Syntax/GeneralScope/TypeDeclaration.cs | 5 +--- .../GeneralScope/TypeParameterDeclaration.cs | 3 +-- .../GeneralScope/UsingAliasDeclaration.cs | 2 +- .../Syntax/GeneralScope/UsingDeclaration.cs | 8 ++++-- .../CSharp/Syntax/Identifier.cs | 8 +++++- .../CSharp/Syntax/InvocationAstType.cs | 2 +- .../CSharp/Syntax/MemberType.cs | 2 +- .../CSharp/Syntax/PrimitiveType.cs | 4 +-- .../CSharp/Syntax/SimpleType.cs | 2 +- .../Syntax/Statements/BlockStatement.cs | 2 +- .../Syntax/Statements/BreakStatement.cs | 2 +- .../Syntax/Statements/CheckedStatement.cs | 2 +- .../Syntax/Statements/ContinueStatement.cs | 2 +- .../Syntax/Statements/DoWhileStatement.cs | 2 +- .../Syntax/Statements/EmptyStatement.cs | 2 +- .../Syntax/Statements/ExpressionStatement.cs | 2 +- .../Syntax/Statements/FixedStatement.cs | 2 +- .../CSharp/Syntax/Statements/ForStatement.cs | 2 +- .../Syntax/Statements/ForeachStatement.cs | 2 +- .../CSharp/Syntax/Statements/GotoStatement.cs | 6 ++--- .../Syntax/Statements/IfElseStatement.cs | 2 +- .../Syntax/Statements/LabelStatement.cs | 2 +- .../LocalFunctionDeclarationStatement.cs | 2 +- .../CSharp/Syntax/Statements/LockStatement.cs | 2 +- .../Syntax/Statements/ReturnStatement.cs | 2 +- .../Syntax/Statements/SwitchStatement.cs | 6 ++--- .../Syntax/Statements/ThrowStatement.cs | 2 +- .../Syntax/Statements/TryCatchStatement.cs | 5 ++-- .../Syntax/Statements/UncheckedStatement.cs | 2 +- .../Syntax/Statements/UnsafeStatement.cs | 2 +- .../Syntax/Statements/UsingStatement.cs | 3 +-- .../VariableDeclarationStatement.cs | 2 +- .../Syntax/Statements/WhileStatement.cs | 2 +- .../Syntax/Statements/YieldBreakStatement.cs | 2 +- .../Syntax/Statements/YieldReturnStatement.cs | 2 +- .../CSharp/Syntax/SyntaxTree.cs | 2 +- .../CSharp/Syntax/TupleAstType.cs | 4 +-- .../TypeMembers/ConstructorDeclaration.cs | 5 ++-- .../TypeMembers/DestructorDeclaration.cs | 2 +- .../TypeMembers/EnumMemberDeclaration.cs | 2 +- .../Syntax/TypeMembers/EventDeclaration.cs | 4 +-- .../TypeMembers/ExtensionDeclaration.cs | 2 +- .../Syntax/TypeMembers/FieldDeclaration.cs | 2 +- .../TypeMembers/FixedFieldDeclaration.cs | 2 +- .../TypeMembers/FixedVariableInitializer.cs | 2 +- .../Syntax/TypeMembers/IndexerDeclaration.cs | 7 ++++- .../Syntax/TypeMembers/MethodDeclaration.cs | 2 +- .../Syntax/TypeMembers/OperatorDeclaration.cs | 2 +- .../TypeMembers/ParameterDeclaration.cs | 4 +-- .../Syntax/TypeMembers/PropertyDeclaration.cs | 7 ++++- .../Syntax/TypeMembers/VariableInitializer.cs | 2 +- .../CSharp/Syntax/VariableDesignation.cs | 4 +-- 106 files changed, 214 insertions(+), 151 deletions(-) diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs index 8da3e13e3..8637696fd 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs @@ -33,10 +33,10 @@ using ICSharpCode.Decompiler.CSharp.OutputVisitor; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// array_type : non_array_type rank_specifier+ ; (C# grammar §8.2.1) - /// pointer_type : dataptr_type | funcptr_type | voidptr_type ; (C# grammar §24.3.1) - /// nullable_reference_type : non_nullable_reference_type nullable_type_annotation ; (C# grammar §8.2.1) - /// nullable_value_type : non_nullable_value_type nullable_type_annotation ; (C# grammar §8.3.1) + /// array_type ::= non_array_type rank_specifier+ (C# grammar §8.2.1) + /// pointer_type ::= dataptr_type | funcptr_type | voidptr_type (C# grammar §24.3.1) + /// nullable_reference_type ::= non_nullable_reference_type nullable_type_annotation (C# grammar §8.2.1) + /// nullable_value_type ::= non_nullable_value_type nullable_type_annotation (C# grammar §8.3.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class ComposedType : AstType @@ -150,7 +150,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// rank_specifier : '[' ','* ']' ; (C# grammar §8.2.1) + /// rank_specifier ::= '[' ','* ']' (C# grammar §8.2.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class ArraySpecifier : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs b/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs index 6d1c91b54..bd782db48 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs @@ -22,7 +22,12 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// No C# spec grammar production: this models a 'cref' reference inside XML documentation comments, not C# source syntax. - /// documentation_reference : type_name | type_name '.' member_name | member_name ; + /// + /// documentation_reference ::= + /// type_name + /// | type_name '.' member_name + /// | member_name + /// /// [DecompilerAstNode(hasNullNode: false)] public partial class DocumentationReference : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs index c30d6a580..c6e06c254 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs @@ -30,7 +30,7 @@ using System.Linq; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// anonymous_method_expression : anonymous_function_modifier? 'delegate' explicit_anonymous_function_signature? block ; (C# grammar §12.22.1) + /// anonymous_method_expression ::= 'async'? 'delegate' parameter* block (C# grammar §12.22.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class AnonymousMethodExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs index f066ea765..1a08fead2 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs @@ -28,7 +28,7 @@ using System.Collections.Generic; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// anonymous_object_creation_expression : 'new' anonymous_object_initializer ; (C# grammar §12.8.17.4) + /// anonymous_object_creation_expression ::= 'new' '{' expression* '}' (C# grammar §12.8.17.4) /// [DecompilerAstNode(hasNullNode: false)] public partial class AnonymousTypeCreateExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs index 97a38ab68..b6fc315bb 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs @@ -19,7 +19,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// array_creation_expression : 'new' non_array_type '[' expression_list ']' rank_specifier* array_initializer? | 'new' array_type array_initializer | 'new' rank_specifier array_initializer ; (C# grammar §12.8.17.5) + /// array_creation_expression ::= 'new' type '[' expression* ']' array_specifier* array_initializer? (C# grammar §12.8.17.5) /// [DecompilerAstNode(hasNullNode: false)] public partial class ArrayCreateExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs index ce3869a72..c0960d9cb 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// array_initializer : '{' variable_initializer_list? '}' | '{' variable_initializer_list ',' '}' ; (C# grammar §17.7) + /// array_initializer ::= '{' expression* '}' (C# grammar §17.7) /// [DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)] public partial class ArrayInitializerExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs index dbc6f784b..e7f0eb3b4 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// Operator precedence is not represented in the syntax tree; required parentheses are reconstructed by . - /// as_expression : expression 'as' type ; (C# grammar §12.15.1) + /// as_expression ::= expression 'as' type (C# grammar §12.15.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class AsExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs index 97f4dd17b..a8ffe69e0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs @@ -31,8 +31,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// Operator precedence is not represented in the syntax tree; required parentheses are reconstructed by . - /// assignment_expression : expression assignment_operator expression ; (C# grammar §12.24) - /// assignment_operator : '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '<<=' | '>>=' | '>>>=' | '&=' | '|=' | '^=' ; + /// assignment_expression ::= expression assignment_operator expression (C# grammar §12.24) + /// assignment_operator ::= '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '<<=' | '>>=' | '>>>=' | '&=' | '|=' | '^=' /// [DecompilerAstNode(hasNullNode: false)] public partial class AssignmentExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs index c1c4cac98..5105da5ee 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// base_access : 'base' '.' identifier type_argument_list? | 'base' '[' argument_list ']' ; (C# grammar §12.8.15) + /// base_access ::= 'base' (C# grammar §12.8.15) /// [DecompilerAstNode(hasNullNode: false)] public partial class BaseReferenceExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs index a0c6441ec..625bdb282 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs @@ -31,8 +31,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// Operator precedence is not represented in the syntax tree; required parentheses are reconstructed by . - /// binary_operator_expression : expression binary_operator expression ; (C# grammar §12.13-§12.18, precedence-flattened) - /// binary_operator : '*' | '/' | '%' | '+' | '-' | '<<' | '>>' | '>>>' | '<' | '>' | '<=' | '>=' | '==' | '!=' | '&' | '^' | '|' | '&&' | '||' | '??' | '..' ; + /// binary_operator_expression ::= expression binary_operator expression (C# grammar §12.13-§12.18, precedence-flattened) + /// binary_operator ::= '*' | '/' | '%' | '+' | '-' | '<<' | '>>' | '>>>' | '<' | '>' | '<=' | '>=' | '==' | '!=' | '&' | '^' | '|' | '&&' | '||' | '??' | '..' /// [DecompilerAstNode(hasNullNode: false)] public partial class BinaryOperatorExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs index 93d57ebdf..3248d97ce 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs @@ -26,7 +26,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// cast_expression : '(' type ')' unary_expression ; (C# grammar §12.9.8) + /// cast_expression ::= '(' type ')' expression (C# grammar §12.9.8) /// [DecompilerAstNode(hasNullNode: false)] public partial class CastExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs index c94bd01e4..597b071a0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// checked_expression : 'checked' '(' expression ')' ; (C# grammar §12.8.20) + /// checked_expression ::= 'checked' '(' expression ')' (C# grammar §12.8.20) /// [DecompilerAstNode(hasNullNode: false)] public partial class CheckedExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs index 5d18d1b4a..129795340 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// Operator precedence is not represented in the syntax tree; required parentheses are reconstructed by . - /// conditional_expression : expression '?' expression ':' expression ; (C# grammar §12.21) + /// conditional_expression ::= expression '?' expression ':' expression (C# grammar §12.21) /// [DecompilerAstNode(hasNullNode: false)] public partial class ConditionalExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs index 6f41ef0a1..82b315a79 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs @@ -19,7 +19,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// declaration_expression : 'scoped'? local_variable_type identifier ; (C# grammar §12.20) + /// declaration_expression ::= type variable_designation (C# grammar §12.20) /// [DecompilerAstNode(hasNullNode: false)] public partial class DeclarationExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs index 32e947e75..3b31797a4 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// default_value_expression : explicitly_typed_default | default_literal ; (C# grammar §12.8.21) + /// default_value_expression ::= 'default' ( '(' type ')' )? (C# grammar §12.8.21) /// [DecompilerAstNode(hasNullNode: false)] public partial class DefaultValueExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs index 9a4f1ab5d..1bfec8d17 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs @@ -35,7 +35,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// argument_value : expression | 'in' 'scoped'? variable_reference | 'ref' 'scoped'? variable_reference | 'out' 'scoped'? variable_reference ; (C# grammar §12.6.2.1) + /// argument_value ::= ( 'ref' | 'out' | 'in' )? expression (C# grammar §12.6.2.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class DirectionExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs index 3794ae74d..7f955301c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// No C# spec grammar production: placeholder inserted when the AST is built from input that does not parse as valid C#. - /// error_expression : /* unparseable input */ ; + /// error_expression ::= /* unparseable input */ /// [DecompilerAstNode(hasNullNode: false)] public partial class ErrorExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs index e96fe04ee..b6ab3e0c2 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// simple_name : identifier type_argument_list? ; (C# grammar §12.8.4) + /// simple_name ::= identifier ( '<' type ( ',' type )* '>' )? (C# grammar §12.8.4) /// [DecompilerAstNode(hasNullNode: false)] public partial class IdentifierExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs index ac87b60ae..8ed592ea1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// element_access : primary_expression '[' argument_list ']' ; (C# grammar §12.8.12.1) + /// element_access ::= expression '[' expression* ']' (C# grammar §12.8.12.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class IndexerExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs index 5c0d3269e..3e2b43a3f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// interpolated_string_expression : interpolated_regular_string_expression | interpolated_verbatim_string_expression | interpolated_raw_string_expression ; (C# grammar §12.8.3) + /// interpolated_string_expression ::= interpolated_string_content* (C# grammar §12.8.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class InterpolatedStringExpression : Expression @@ -25,6 +25,14 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } + /// + /// + /// interpolated_string_content ::= + /// interpolation + /// | interpolated_string_text + /// + /// (C# grammar §12.8.3) + /// [DecompilerAstNode(hasNullNode: true)] public abstract partial class InterpolatedStringContent : AstNode { @@ -34,7 +42,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// regular_interpolation : expression (',' interpolation_minimum_width)? Regular_Interpolation_Format? ; (C# grammar §12.8.3) + /// interpolation ::= '{' expression ( ',' alignment )? ( ':' format )? '}' (C# grammar §12.8.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class Interpolation : InterpolatedStringContent @@ -63,7 +71,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// Interpolated_Regular_String_Mid : Interpolated_Regular_String_Element+ ; (C# lexical grammar §12.8.3) + /// interpolated_string_text ::= text_character+ (C# lexical grammar §12.8.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class InterpolatedStringText : InterpolatedStringContent diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs index d0b5bf5a9..a35d915c2 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// invocation_expression : primary_expression '(' argument_list? ')' ; (C# grammar §12.8.10.1) + /// invocation_expression ::= expression '(' expression* ')' (C# grammar §12.8.10.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class InvocationExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs index 511297b27..5ad38ff45 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs @@ -28,7 +28,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// Operator precedence is not represented in the syntax tree; required parentheses are reconstructed by . - /// is_expression : expression 'is' (type | pattern) ; (C# grammar §12.15.1) + /// is_expression ::= expression 'is' type (C# grammar §12.15.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class IsExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs index c0ea00201..7f4b2a7b9 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// lambda_expression : attributes? anonymous_function_modifier? (return_type | ref_kind ref_return_type)? anonymous_function_signature '=>' anonymous_function_body ; (C# grammar §12.22.1) + /// lambda_expression ::= attribute_section* 'async'? parameter* '=>' ( block | expression ) (C# grammar §12.22.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class LambdaExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs index 3b181a64b..d281de319 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// member_access : primary_expression '.' identifier type_argument_list? | predefined_type '.' identifier type_argument_list? | qualified_alias_member '.' identifier type_argument_list? ; (C# grammar §12.8.7.1) + /// member_reference_expression ::= expression '.' identifier ( '<' type ( ',' type )* '>' )? (C# grammar §12.8.7.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class MemberReferenceExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs index c51b74f99..1ced81192 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs @@ -20,7 +20,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// Represents a named argument passed to a method or attribute. - /// argument : argument_name? argument_value ; (C# grammar §12.6.2.1) + /// named_argument_expression ::= identifier ':' expression (C# grammar §12.6.2.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class NamedArgumentExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs index a652eb5f6..d80da832a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// literal : boolean_literal | Integer_Literal | Real_Literal | Character_Literal | String_Literal | null_literal ; (C# grammar §6.4.5.1) + /// null_reference_expression ::= 'null' (C# grammar §6.4.5.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class NullReferenceExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs index 7e9548d6a..dfa1e6754 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// object_creation_expression : 'new' type '(' argument_list? ')' object_or_collection_initializer? | 'new' type object_or_collection_initializer | target_typed_new ; (C# grammar §12.8.17.2.1) + /// object_create_expression ::= 'new' type '(' expression* ')' array_initializer_expression? (C# grammar §12.8.17.2.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class ObjectCreateExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs index e1dd2787a..e2605302e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs @@ -19,7 +19,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// declaration_expression : 'scoped'? local_variable_type identifier ; (C# grammar §12.20) + /// out_var_declaration_expression ::= type variable_initializer (C# grammar §12.20) /// [DecompilerAstNode(hasNullNode: false)] public partial class OutVarDeclarationExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs index 2def108b2..e2db4008f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// parenthesized_expression : '(' expression ')' ; (C# grammar §12.8.5) + /// parenthesized_expression ::= '(' expression ')' (C# grammar §12.8.5) /// [DecompilerAstNode(hasNullNode: false)] public partial class ParenthesizedExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs index a92cabf11..8998b279a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// pointer_member_access : primary_expression '->' identifier type_argument_list? ; (C# grammar §24.6.3) + /// pointer_member_access ::= expression '->' identifier ( '<' type ( ',' type )* '>' )? (C# grammar §24.6.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class PointerReferenceExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs index 488fb3833..e73c589bb 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs @@ -45,7 +45,16 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Represents a literal value. - /// literal : boolean_literal | Integer_Literal | Real_Literal | Character_Literal | String_Literal | null_literal ; (C# grammar §6.4.5.1) + /// + /// literal ::= + /// boolean_literal + /// | integer_literal + /// | real_literal + /// | character_literal + /// | string_literal + /// | null_literal + /// + /// (C# grammar §6.4.5.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class PrimitiveExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs index 71b038c43..75c06fe32 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs @@ -19,7 +19,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// query_expression : from_clause query_body ; (C# grammar §12.23.1) + /// query_expression ::= query_clause+ (C# grammar §12.23.1) /// [DecompilerAstNode(hasNullNode: true)] public partial class QueryExpression : Expression @@ -47,7 +47,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// Represents a query continuation, e.g. "(from .. select ..) into Identifier". /// Note that "join .. into .." is not a query continuation. /// A continuation is always the first clause of the query expression that contains it. - /// query_continuation : 'into' identifier query_body ; (C# grammar §12.23.1) + /// query_continuation ::= query_expression 'into' identifier (C# grammar §12.23.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class QueryContinuationClause : QueryClause @@ -78,7 +78,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// from_clause : 'from' type? identifier 'in' expression ; (C# grammar §12.23.1) + /// from_clause ::= 'from' type? identifier 'in' expression (C# grammar §12.23.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class QueryFromClause : QueryClause @@ -113,7 +113,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// let_clause : 'let' identifier '=' expression ; (C# grammar §12.23.1) + /// let_clause ::= 'let' identifier '=' expression (C# grammar §12.23.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class QueryLetClause : QueryClause @@ -144,7 +144,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// - /// where_clause : 'where' boolean_expression ; (C# grammar §12.23.1) + /// where_clause ::= 'where' expression (C# grammar §12.23.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class QueryWhereClause : QueryClause @@ -163,8 +163,12 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Represents a join or group join clause. - /// join_clause : 'join' type? identifier 'in' expression 'on' expression 'equals' expression ; (C# grammar §12.23.1) - /// join_into_clause : 'join' type? identifier 'in' expression 'on' expression 'equals' expression 'into' identifier ; (C# grammar §12.23.1) + /// + /// join_clause ::= + /// 'join' type? identifier 'in' expression 'on' expression 'equals' expression + /// | 'join' type? identifier 'in' expression 'on' expression 'equals' expression 'into' identifier + /// + /// (C# grammar §12.23.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class QueryJoinClause : QueryClause @@ -233,7 +237,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// orderby_clause : 'orderby' orderings ; (C# grammar §12.23.1) + /// orderby_clause ::= 'orderby' ordering ( ',' ordering )* (C# grammar §12.23.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class QueryOrderClause : QueryClause @@ -252,7 +256,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// ordering : expression ordering_direction? ; (C# grammar §12.23.1) + /// ordering ::= expression ( 'ascending' | 'descending' )? (C# grammar §12.23.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class QueryOrdering : AstNode @@ -287,7 +291,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// select_clause : 'select' expression ; (C# grammar §12.23.1) + /// select_clause ::= 'select' expression (C# grammar §12.23.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class QuerySelectClause : QueryClause @@ -305,7 +309,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// group_clause : 'group' expression 'by' expression ; (C# grammar §12.23.1) + /// group_clause ::= 'group' expression 'by' expression (C# grammar §12.23.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class QueryGroupClause : QueryClause diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs index 46eb571c7..b17eb4bde 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs @@ -21,8 +21,12 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// property_pattern : type? property_subpattern simple_designation? ; (C# grammar §11.2.6) - /// positional_pattern : type? '(' subpatterns? ')' property_subpattern? simple_designation? ; (C# grammar §11.2.5) + /// + /// recursive_pattern ::= + /// type? '{' pattern* '}' variable_designation? + /// | type? '(' pattern* ')' variable_designation? + /// + /// (C# grammar §11.2.5, §11.2.6) /// [DecompilerAstNode(hasNullNode: false)] public partial class RecursivePatternExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs index 6fcc1ac94..5233ba624 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// sizeof_expression : 'sizeof' '(' unmanaged_type ')' ; (C# grammar §12.8.19) + /// sizeof_expression ::= 'sizeof' '(' type ')' (C# grammar §12.8.19) /// [DecompilerAstNode(hasNullNode: false)] public partial class SizeOfExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs index 0819b9989..61f658977 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs @@ -27,7 +27,12 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// stackalloc_expression : 'stackalloc' unmanaged_type '[' expression ']' | 'stackalloc' unmanaged_type? '[' constant_expression? ']' stackalloc_initializer ; (C# grammar §12.8.22) + /// + /// stackalloc_expression ::= + /// 'stackalloc' type '[' expression ']' + /// | 'stackalloc' type? '[' expression? ']' array_initializer + /// + /// (C# grammar §12.8.22) /// [DecompilerAstNode(hasNullNode: false)] public partial class StackAllocExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs index d5ea6ed5f..6b19340df 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs @@ -20,7 +20,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// Operator precedence is not represented in the syntax tree; required parentheses are reconstructed by . - /// switch_expression : expression 'switch' '{' switch_expression_arms? '}' ; (C# grammar §12.12) + /// switch_expression ::= expression 'switch' '{' switch_expression_arm* '}' (C# grammar §12.12) /// [DecompilerAstNode(hasNullNode: false)] public partial class SwitchExpression : Expression @@ -42,7 +42,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// switch_expression_arm : pattern case_guard? '=>' switch_expression_arm_expression ; (C# grammar §12.12) + /// switch_expression_arm ::= pattern '=>' expression (C# grammar §12.12) /// [DecompilerAstNode(hasNullNode: false)] public partial class SwitchExpressionSection : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs index 50119106e..80ee9684b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// this_access : 'this' ; (C# grammar §12.8.14) + /// this_access ::= 'this' (C# grammar §12.8.14) /// [DecompilerAstNode(hasNullNode: false)] public partial class ThisReferenceExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs index 6ffc57d49..bd5d503a6 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs @@ -19,7 +19,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// throw_expression : 'throw' null_coalescing_expression ; (C# grammar §12.19) + /// throw_expression ::= 'throw' expression (C# grammar §12.19) /// [DecompilerAstNode(hasNullNode: false)] public partial class ThrowExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs index 44880cea9..a1002b17a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs @@ -21,7 +21,7 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// tuple_literal : '(' tuple_element (',' tuple_element)+ ')' ; (C# grammar §12.8.6) + /// tuple_literal ::= '(' expression ( ',' expression )+ ')' (C# grammar §12.8.6) /// [DecompilerAstNode(hasNullNode: false)] public partial class TupleExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs index fec302578..7c5e11996 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// typeof_expression : 'typeof' '(' type ')' | 'typeof' '(' unbound_type_name ')' | 'typeof' '(' 'void' ')' ; (C# grammar §12.8.18) + /// typeof_expression ::= 'typeof' '(' type ')' (C# grammar §12.8.18) /// [DecompilerAstNode(hasNullNode: false)] public partial class TypeOfExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs index 1ac456173..173c4ebd3 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs @@ -20,7 +20,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// No C# spec grammar production: ILSpy wrapper that lets an AstType appear in expression position (e.g. the 'int' in 'int.Parse(...)'). - /// type_reference_expression : type ; + /// type_reference_expression ::= type /// [DecompilerAstNode(hasNullNode: false)] public partial class TypeReferenceExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs index 1938a92c7..de1be9cc2 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs @@ -31,9 +31,14 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// Operator precedence is not represented in the syntax tree; required parentheses are reconstructed by . - /// unary_operator_expression : unary_operator expression | expression postfix_unary_operator ; (C# grammar §12.9, §12.8.16) - /// unary_operator : '+' | '-' | '!' | '~' | '++' | '--' | '*' | '&' | '^' | 'await' ; - /// postfix_unary_operator : '++' | '--' | '!' | '?' ; + /// + /// unary_operator_expression ::= + /// unary_operator expression + /// | expression postfix_unary_operator + /// + /// (C# grammar §12.9, §12.8.16) + /// unary_operator ::= '+' | '-' | '!' | '~' | '++' | '--' | '*' | '&' | '^' | 'await' + /// postfix_unary_operator ::= '++' | '--' | '!' | '?' /// [DecompilerAstNode(hasNullNode: false)] public partial class UnaryOperatorExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs index 66fa3b61e..999226554 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// unchecked_expression : 'unchecked' '(' expression ')' ; (C# grammar §12.8.20) + /// unchecked_expression ::= 'unchecked' '(' expression ')' (C# grammar §12.8.20) /// [DecompilerAstNode(hasNullNode: false)] public partial class UncheckedExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs index 42bebeb7b..450cc0a66 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs @@ -37,7 +37,14 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// No C# spec grammar production: the undocumented compiler keywords __arglist, __refvalue, __reftype and __makeref. - /// undocumented_expression : '__arglist' | '__arglist' '(' argument_list? ')' | '__refvalue' '(' expression ',' type ')' | '__reftype' '(' expression ')' | '__makeref' '(' expression ')' ; + /// + /// undocumented_expression ::= + /// '__arglist' + /// | '__arglist' '(' expression* ')' + /// | '__refvalue' '(' expression ',' type ')' + /// | '__reftype' '(' expression ')' + /// | '__makeref' '(' expression ')' + /// /// [DecompilerAstNode(hasNullNode: false)] public partial class UndocumentedExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs index d075ff453..d5553c6ec 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs @@ -22,7 +22,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// Operator precedence is not represented in the syntax tree; required parentheses are reconstructed by . - /// with_expression : expression 'with' '{' member_initializer_list? '}' ; (C# grammar §12.10) + /// with_expression ::= expression 'with' array_initializer (C# grammar §12.10) /// [DecompilerAstNode(hasNullNode: false)] public partial class WithInitializerExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs index 9629fbb6f..e3c927e10 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// funcptr_type : 'delegate' '*' calling_convention_specifier? '<' funcptr_parameter_list funcptr_return_type '>' ; (C# grammar §24.3.3) + /// funcptr_type ::= 'delegate' '*' calling_convention_specifier? '<' funcptr_parameter_list funcptr_return_type '>' (C# grammar §24.3.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class FunctionPointerAstType : AstType diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs index 17c47d56d..41555811a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs @@ -29,7 +29,7 @@ using ICSharpCode.Decompiler.CSharp.OutputVisitor; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// attribute : attribute_name attribute_arguments? ; (C# grammar §23.3) + /// attribute ::= type ( '(' expression* ')' )? (C# grammar §23.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class Attribute : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs index 9cc1f7d69..8af3f1222 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs @@ -27,8 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// attribute_section : '[' attribute_target_specifier? attribute_list ']' ; (C# grammar §23.3) - /// global_attribute_section : '[' global_attribute_target_specifier attribute_list ']' ; (C# grammar §23.3) + /// attribute_section ::= '[' ( identifier ':' )? attribute* ']' (C# grammar §23.3) /// [DecompilerAstNode(hasNullNode: false, hasPatternPlaceholder: true)] public partial class AttributeSection : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs index cbe3ee3ea..a6c5cd9f9 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs @@ -51,7 +51,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// Comment : Single_Line_Comment | Delimited_Comment ; (C# lexical grammar §6.3.3) + /// comment ::= '//' input_character* | '/*' input_character* '*/' (C# lexical grammar §6.3.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class Comment : Trivia diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs index 2a77963bd..650991fbd 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs @@ -28,7 +28,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// new(), struct and class constraints are represented using a PrimitiveType "new", "struct" or "class". - /// type_parameter_constraints_clause : 'where' type_parameter ':' type_parameter_constraints ; (C# grammar §15.2.5) + /// type_parameter_constraints_clause ::= 'where' type ':' type+ (C# grammar §15.2.5) /// [DecompilerAstNode(hasNullNode: true)] public partial class Constraint : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs index 442611e3a..a3474f9a0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs @@ -29,7 +29,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// delegate_declaration : attributes? delegate_modifier* 'delegate' return_type delegate_header | attributes? delegate_modifier* 'delegate' ref_kind ref_return_type delegate_header ; (C# grammar §21.2) + /// delegate_declaration ::= attribute_section* modifier* 'delegate' ( 'ref' 'readonly'? )? type identifier type_parameter* '(' parameter* ')' constraint* (C# grammar §21.2) /// [DecompilerAstNode(hasNullNode: false)] public partial class DelegateDeclaration : EntityDeclaration diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs index 92c1b507a..ac68518d7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// extern_alias_directive : 'extern' 'alias' identifier ';' ; (C# grammar §14.4) + /// extern_alias_directive ::= 'extern' 'alias' identifier ';' (C# grammar §14.4) /// [DecompilerAstNode(hasNullNode: false)] public partial class ExternAliasDeclaration : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs index 4be6a153e..7fa3c1021 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs @@ -29,8 +29,12 @@ using System.Collections.Generic; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// namespace_declaration : 'namespace' qualified_identifier namespace_body ';'? ; (C# grammar §14.3) - /// file_scoped_namespace_declaration : 'namespace' qualified_identifier ';' extern_alias_directive* using_directive* type_declaration* ; (C# grammar §14.3) + /// + /// namespace_declaration ::= + /// 'namespace' type '{' namespace_member* '}' ';'? + /// | 'namespace' type ';' namespace_member* + /// + /// (C# grammar §14.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class NamespaceDeclaration : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs index 243d5b3c1..0fba9dbe8 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs @@ -47,7 +47,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// fragment PP_Line : 'line' PP_Whitespace PP_Line_Indicator ; (C# lexical grammar) + /// line_directive ::= '#' 'line' ( decimal_digit+ string_literal? | 'default' | 'hidden' ) (C# lexical grammar) /// [DecompilerAstNode(hasNullNode: false)] public partial class LinePreprocessorDirective : PreProcessorDirective @@ -72,7 +72,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// fragment PP_Pragma : 'pragma' PP_Pragma_Text? ; (C# lexical grammar) + /// pragma_warning_directive ::= '#' 'pragma' 'warning' ( 'disable' | 'restore' ) expression* (C# lexical grammar) /// [DecompilerAstNode(hasNullNode: false)] public partial class PragmaWarningPreprocessorDirective : PreProcessorDirective @@ -111,7 +111,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// PP_Directive : PP_Start PP_Kind PP_New_Line ; (C# lexical grammar §6.5.1) + /// pp_directive ::= '#' pp_kind new_line (C# lexical grammar §6.5.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class PreProcessorDirective : Trivia diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs index ed86302ae..336563f93 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs @@ -45,10 +45,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// class_declaration : attributes? class_modifier* 'partial'? class_tag identifier type_parameter_list? delimited_parameter_list? class_base? type_parameter_constraints_clause* class_body ; (C# grammar §15.2.1) - /// struct_declaration : non_record_struct_declaration | record_struct_declaration ; (C# grammar §16.2.1) - /// interface_declaration : attributes? interface_modifier* 'partial'? 'interface' identifier variant_type_parameter_list? interface_base? type_parameter_constraints_clause* interface_body ';'? ; (C# grammar §19.2.1) - /// enum_declaration : attributes? enum_modifier* 'enum' identifier enum_base? enum_body ';'? ; (C# grammar §20.2) + /// type_declaration ::= attribute_section* modifier* ( 'class' | 'struct' | 'interface' | 'enum' | 'record' 'class'? | 'record' 'struct' ) identifier type_parameter* ( '(' parameter* ')' )? ( ':' type+ )? constraint* '{' member* '}' ';'? (C# grammar §15.2.1, §16.2.1, §19.2.1, §20.2) /// [DecompilerAstNode(hasNullNode: false)] public partial class TypeDeclaration : EntityDeclaration diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs index 1f4aa62b2..e49dcdfda 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs @@ -24,8 +24,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// Represents a type parameter. /// Mirroring the C# syntax, constraints are not part of the type parameter declaration; /// they belong to the parent type or method. - /// type_parameter : identifier ; (C# grammar §8.5) - /// decorated_type_parameter : attributes? type_parameter ; (C# grammar §15.2.3) + /// type_parameter ::= attribute_section* ( 'in' | 'out' )? identifier (C# grammar §8.5, §15.2.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class TypeParameterDeclaration : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs index 2a899c249..04567a7ba 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// using_alias_directive : 'using' identifier '=' namespace_or_type_name ';' ; (C# grammar §14.6.2) + /// using_alias_directive ::= 'using' identifier '=' type ';' (C# grammar §14.6.2) /// [DecompilerAstNode(hasNullNode: false)] public partial class UsingAliasDeclaration : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs index f7a5e8906..b14d8824a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs @@ -30,8 +30,12 @@ using System.Text; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// using_namespace_directive : 'using' namespace_name ';' ; (C# grammar §14.6.3) - /// using_static_directive : 'using' 'static' type_name ';' ; (C# grammar §14.6.4) + /// + /// using_directive ::= + /// 'using' type ';' + /// | 'using' 'static' type ';' + /// + /// (C# grammar §14.6.3, §14.6.4) /// [DecompilerAstNode(hasNullNode: false)] public partial class UsingDeclaration : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs index ffd1219f2..1edfd2f5e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs @@ -29,7 +29,13 @@ using System; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// identifier : Simple_Identifier | contextual_keyword | discard_token ; (C# lexical grammar §6.4.3) + /// + /// identifier ::= + /// Simple_Identifier + /// | contextual_keyword + /// | discard_token + /// + /// (C# lexical grammar §6.4.3) /// [DecompilerAstNode(hasNullNode: true)] public partial class Identifier : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs index 655e22858..b6d615658 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs @@ -22,7 +22,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// No C# spec grammar production: ILSpy-internal type form used when a type appears applied to arguments (e.g. an attribute type written with its constructor arguments). - /// invocation_ast_type : type '(' argument_list? ')' ; + /// invocation_ast_type ::= type '(' argument_list? ')' /// [DecompilerAstNode(hasNullNode: false)] public partial class InvocationAstType : AstType diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs index b51c25f5e..71b7b35f5 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// namespace_or_type_name : identifier type_argument_list? ('.' identifier type_argument_list?)* | qualified_alias_member ('.' identifier type_argument_list?)* ; (C# grammar §7.8.1) + /// member_type ::= type ( '.' | '::' ) identifier ( '<' type ( ',' type )* '>' )? (C# grammar §7.8.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class MemberType : AstType diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs index 110178964..d755af09b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs @@ -32,8 +32,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// predefined_type : 'bool' | 'byte' | 'char' | 'decimal' | 'double' | 'float' | 'int' | 'long' | 'object' | 'sbyte' | 'short' | 'string' | 'uint' | 'ulong' | 'ushort' ; (C# grammar §12.8.7.1) - /// simple_type : numeric_type | 'bool' ; (C# grammar §8.3.1) + /// predefined_type ::= 'bool' | 'byte' | 'char' | 'decimal' | 'double' | 'float' | 'int' | 'long' | 'object' | 'sbyte' | 'short' | 'string' | 'uint' | 'ulong' | 'ushort' (C# grammar §12.8.7.1) + /// simple_type ::= numeric_type | 'bool' (C# grammar §8.3.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class PrimitiveType : AstType diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs index 34c7607fe..147ba631d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// namespace_or_type_name : identifier type_argument_list? ('.' identifier type_argument_list?)* | qualified_alias_member ('.' identifier type_argument_list?)* ; (C# grammar §7.8.1) + /// simple_type ::= identifier ( '<' type ( ',' type )* '>' )? (C# grammar §7.8.1) /// [DecompilerAstNode(hasNullNode: true)] public partial class SimpleType : AstType diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs index bbc663508..553c0c89c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// block : '{' statement_list? '}' ; (C# grammar §13.3.1) + /// block ::= '{' statement* '}' (C# grammar §13.3.1) /// [DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)] public partial class BlockStatement : Statement, IEnumerable diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs index 2890495f9..3e85f5b58 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// break_statement : 'break' ';' ; (C# grammar §13.10.2) + /// break_statement ::= 'break' ';' (C# grammar §13.10.2) /// [DecompilerAstNode(hasNullNode: false)] public partial class BreakStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs index 30f386816..0eb1d70b8 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// checked_statement : 'checked' block ; (C# grammar §13.12) + /// checked_statement ::= 'checked' block (C# grammar §13.12) /// [DecompilerAstNode(hasNullNode: false)] public partial class CheckedStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs index 51047ada5..8e26f8861 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// continue_statement : 'continue' ';' ; (C# grammar §13.10.3) + /// continue_statement ::= 'continue' ';' (C# grammar §13.10.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class ContinueStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs index 16d7cc573..b19523c62 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// do_statement : 'do' embedded_statement 'while' '(' boolean_expression ')' ';' ; (C# grammar §13.9.3) + /// do_statement ::= 'do' statement 'while' '(' expression ')' ';' (C# grammar §13.9.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class DoWhileStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs index 56a7db1ed..4d439366f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// empty_statement : ';' ; (C# grammar §13.4) + /// empty_statement ::= ';' (C# grammar §13.4) /// [DecompilerAstNode(hasNullNode: false)] public partial class EmptyStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs index ccebc838f..08816a11a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// expression_statement : statement_expression ';' ; (C# grammar §13.7) + /// expression_statement ::= expression ';' (C# grammar §13.7) /// [DecompilerAstNode(hasNullNode: false)] public partial class ExpressionStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs index 5092067f1..2fcd95125 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// fixed_statement : 'fixed' '(' pointer_type fixed_pointer_declarators ')' embedded_statement ; (C# grammar §24.7) + /// fixed_statement ::= 'fixed' '(' type variable_initializer* ')' statement (C# grammar §24.7) /// [DecompilerAstNode(hasNullNode: false)] public partial class FixedStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs index d06bd9846..12778f935 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// for_statement : 'for' '(' for_initializer? ';' for_condition? ';' for_iterator? ')' embedded_statement ; (C# grammar §13.9.4) + /// for_statement ::= 'for' '(' statement* ';' expression? ';' statement* ')' statement (C# grammar §13.9.4) /// [DecompilerAstNode(hasNullNode: false)] public partial class ForStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs index f4541652d..7dbfc4f6b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// foreach_statement : 'await'? 'foreach' '(' 'scoped'? ref_kind? local_variable_type identifier 'in' expression ')' embedded_statement ; (C# grammar §13.9.5.1) + /// foreach_statement ::= 'await'? 'foreach' '(' type variable_designation 'in' expression ')' statement (C# grammar §13.9.5.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class ForeachStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs index 1eea53bd1..4577dba4f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// goto_statement : 'goto' identifier ';' | 'goto' 'case' constant_expression ';' | 'goto' 'default' ';' ; (C# grammar §13.10.4) + /// goto_statement ::= 'goto' identifier ';' (C# grammar §13.10.4) /// [DecompilerAstNode(hasNullNode: false)] public partial class GotoStatement : Statement @@ -66,7 +66,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// goto_statement : 'goto' identifier ';' | 'goto' 'case' constant_expression ';' | 'goto' 'default' ';' ; (C# grammar §13.10.4) + /// goto_statement ::= 'goto' 'case' expression ';' (C# grammar §13.10.4) /// [DecompilerAstNode(hasNullNode: false)] public partial class GotoCaseStatement : Statement @@ -88,7 +88,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// goto_statement : 'goto' identifier ';' | 'goto' 'case' constant_expression ';' | 'goto' 'default' ';' ; (C# grammar §13.10.4) + /// goto_statement ::= 'goto' 'default' ';' (C# grammar §13.10.4) /// [DecompilerAstNode(hasNullNode: false)] public partial class GotoDefaultStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs index 854bfea0a..377c0b4bf 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// if_statement : 'if' '(' boolean_expression ')' embedded_statement | 'if' '(' boolean_expression ')' embedded_statement 'else' embedded_statement ; (C# grammar §13.8.2) + /// if_statement ::= 'if' '(' expression ')' statement ( 'else' statement )? (C# grammar §13.8.2) /// [DecompilerAstNode(hasNullNode: false)] public partial class IfElseStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs index 40aff9b49..8a0afb971 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// labeled_statement : identifier ':' statement ; (C# grammar §13.5) + /// labeled_statement ::= identifier ':' statement (C# grammar §13.5) /// [DecompilerAstNode(hasNullNode: false)] public partial class LabelStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs index 82678954c..959ceeef4 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs @@ -21,7 +21,7 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// local_function_declaration : attributes? local_function_modifier* return_type local_function_header local_function_body | attributes? ref_local_function_modifier* ref_kind ref_return_type local_function_header ref_local_function_body ; (C# grammar §13.6.4) + /// local_function_declaration ::= method_declaration (C# grammar §13.6.4) /// [DecompilerAstNode(hasNullNode: false)] public partial class LocalFunctionDeclarationStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs index 512ea6f14..eb501ae50 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// lock_statement : 'lock' '(' expression ')' embedded_statement ; (C# grammar §13.13) + /// lock_statement ::= 'lock' '(' expression ')' statement (C# grammar §13.13) /// [DecompilerAstNode(hasNullNode: false)] public partial class LockStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs index 726f3eba6..f5d0e3eb8 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// return_statement : 'return' ';' | 'return' expression ';' | 'return' 'ref' variable_reference ';' ; (C# grammar §13.10.5) + /// return_statement ::= 'return' expression? ';' (C# grammar §13.10.5) /// [DecompilerAstNode(hasNullNode: false)] public partial class ReturnStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs index 6cd872afa..4ea94dcce 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// switch_statement : 'switch' selector_expression switch_block ; (C# grammar §13.8.3) + /// switch_statement ::= 'switch' expression switch_section* (C# grammar §13.8.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class SwitchStatement : Statement @@ -49,7 +49,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// switch_section : switch_label+ statement_list ; (C# grammar §13.8.3) + /// switch_section ::= switch_label+ statement* (C# grammar §13.8.3) /// [DecompilerAstNode(hasNullNode: false, hasPatternPlaceholder: true)] public partial class SwitchSection : AstNode @@ -76,7 +76,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// switch_label : 'case' pattern case_guard? ':' | 'default' ':' ; (C# grammar §13.8.3) + /// switch_label ::= 'case' expression ':' | 'default' ':' (C# grammar §13.8.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class CaseLabel : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs index 613b95c08..135e2b9c5 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// throw_statement : 'throw' expression? ';' ; (C# grammar §13.10.6) + /// throw_statement ::= 'throw' expression? ';' (C# grammar §13.10.6) /// [DecompilerAstNode(hasNullNode: false)] public partial class ThrowStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs index b9406b18f..287dbc24b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// try_statement : 'try' block catch_clauses | 'try' block catch_clauses? finally_clause ; (C# grammar §13.11) + /// try_statement ::= 'try' block catch_clause* ( 'finally' block )? (C# grammar §13.11) /// [DecompilerAstNode(hasNullNode: false)] public partial class TryCatchStatement : Statement @@ -55,8 +55,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// specific_catch_clause : 'catch' exception_specifier exception_filter? block | 'catch' exception_filter block ; (C# grammar §13.11) - /// general_catch_clause : 'catch' block ; (C# grammar §13.11) + /// catch_clause ::= 'catch' ( '(' type identifier? ')' )? ( 'when' '(' expression ')' )? block (C# grammar §13.11) /// [DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)] public partial class CatchClause : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs index a3410eed6..35daf0ae3 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// unchecked_statement : 'unchecked' block ; (C# grammar §13.12) + /// unchecked_statement ::= 'unchecked' block (C# grammar §13.12) /// [DecompilerAstNode(hasNullNode: false)] public partial class UncheckedStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs index c5d287277..6762d508c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// unsafe_statement : 'unsafe' block ; (C# grammar §24.2) + /// unsafe_statement ::= 'unsafe' block (C# grammar §24.2) /// [DecompilerAstNode(hasNullNode: false)] public partial class UnsafeStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs index 8f78971c7..d9cd1851c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs @@ -27,8 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// using_statement : 'await'? 'using' '(' resource_acquisition ')' embedded_statement ; (C# grammar §13.14.1) - /// local_using_declaration : 'await'? 'using' non_ref_local_variable_declaration ';' statement_list? ; (C# grammar §13.14.2) + /// using_statement ::= 'await'? 'using' '(' ( local_variable_declaration | expression ) ')' statement (C# grammar §13.14.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class UsingStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs index 284609152..65cb2800e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// local_variable_declaration : implicitly_typed_local_variable_declaration | explicitly_typed_local_variable_declaration | explicitly_typed_ref_local_variable_declaration ; (C# grammar §13.6.2.1) + /// local_variable_declaration ::= type variable_initializer+ (C# grammar §13.6.2.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class VariableDeclarationStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs index f1dda74c2..a6a8a8cb1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// while_statement : 'while' '(' boolean_expression ')' embedded_statement ; (C# grammar §13.9.2) + /// while_statement ::= 'while' '(' expression ')' statement (C# grammar §13.9.2) /// [DecompilerAstNode(hasNullNode: false)] public partial class WhileStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs index babe7ce15..d02105131 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// yield_statement : 'yield' 'return' expression ';' | 'yield' 'break' ';' ; (C# grammar §13.15) + /// yield_statement ::= 'yield' 'break' ';' (C# grammar §13.15) /// [DecompilerAstNode(hasNullNode: false)] public partial class YieldBreakStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs index f13c6dc18..dba8c3728 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// yield_statement : 'yield' 'return' expression ';' | 'yield' 'break' ';' ; (C# grammar §13.15) + /// yield_statement ::= 'yield' 'return' expression ';' (C# grammar §13.15) /// [DecompilerAstNode(hasNullNode: false)] public partial class YieldReturnStatement : Statement diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs b/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs index 32c2a756c..2fabf14fb 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs @@ -31,7 +31,7 @@ using ICSharpCode.Decompiler.Util; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// compilation_unit : extern_alias_directive* using_directive* global_attributes? compilation_unit_body ; (C# grammar §14.2) + /// compilation_unit ::= extern_alias_directive* using_directive* global_attributes? compilation_unit_body (C# grammar §14.2) /// [DecompilerAstNode(hasNullNode: false)] public partial class SyntaxTree : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs index 33cf06fd9..0fc40b998 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs @@ -21,7 +21,7 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// tuple_type : '(' tuple_type_element (',' tuple_type_element)+ ')' ; (C# grammar §8.3.1) + /// tuple_type ::= '(' tuple_type_element (',' tuple_type_element)+ ')' (C# grammar §8.3.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class TupleAstType : AstType @@ -38,7 +38,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// tuple_type_element : type identifier? ; (C# grammar §8.3.1) + /// tuple_type_element ::= type identifier? (C# grammar §8.3.1) /// [DecompilerAstNode(hasNullNode: true)] public partial class TupleTypeElement : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs index 39ab4c744..2a97f974f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs @@ -29,8 +29,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// constructor_declaration : attributes? constructor_modifier* constructor_declarator constructor_body ; (C# grammar §15.11.1) - /// static_constructor_declaration : attributes? static_constructor_modifiers identifier '(' ')' static_constructor_body ; (C# grammar §15.12) + /// constructor_declaration ::= attribute_section* modifier* identifier '(' parameter* ')' constructor_initializer? ( block | ';' ) (C# grammar §15.11.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class ConstructorDeclaration : EntityDeclaration @@ -72,7 +71,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// constructor_initializer : ':' 'base' '(' argument_list? ')' | ':' 'this' '(' argument_list? ')' ; (C# grammar §15.11.1) + /// constructor_initializer ::= ':' ( 'base' | 'this' ) '(' expression* ')' (C# grammar §15.11.1) /// [DecompilerAstNode(hasNullNode: true)] public partial class ConstructorInitializer : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs index 274363f26..9af13a741 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs @@ -29,7 +29,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// finalizer_declaration : attributes? '~' identifier '(' ')' finalizer_body | attributes? 'extern' unsafe_modifier? '~' identifier '(' ')' finalizer_body | attributes? unsafe_modifier 'extern'? '~' identifier '(' ')' finalizer_body ; (C# grammar §15.13) + /// finalizer_declaration ::= attribute_section* modifier* '~' identifier '(' ')' ( block | ';' ) (C# grammar §15.13) /// [DecompilerAstNode(hasNullNode: false)] public partial class DestructorDeclaration : EntityDeclaration diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs index b846ee581..b616c77ec 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs @@ -29,7 +29,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// enum_member_declaration : attributes? identifier ('=' constant_expression)? ; (C# grammar §20.4) + /// enum_member_declaration ::= attribute_section* identifier ( '=' expression )? (C# grammar §20.4) /// [DecompilerAstNode(hasNullNode: false)] public partial class EnumMemberDeclaration : EntityDeclaration diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs index 830589a7e..c20a94444 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs @@ -32,7 +32,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// event_declaration : attributes? event_modifier* 'event' type variable_declarators ';' | attributes? event_modifier* 'event' type member_name '{' event_accessor_declarations '}' ; (C# grammar §15.8.1) + /// event_declaration ::= attribute_section* modifier* 'event' type variable_initializer* ';' (C# grammar §15.8.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class EventDeclaration : EntityDeclaration @@ -75,7 +75,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// event_declaration : attributes? event_modifier* 'event' type variable_declarators ';' | attributes? event_modifier* 'event' type member_name '{' event_accessor_declarations '}' ; (C# grammar §15.8.1) + /// custom_event_declaration ::= attribute_section* modifier* 'event' type ( type '.' )? identifier '{' accessor accessor '}' (C# grammar §15.8.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class CustomEventDeclaration : EntityDeclaration diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ExtensionDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ExtensionDeclaration.cs index 064ccc7e8..e096e00ec 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ExtensionDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ExtensionDeclaration.cs @@ -22,7 +22,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// Not present in this revision of the C# specification grammar: C# 14 extension blocks ('extension(receiver) { members }'). - /// extension_declaration : 'extension' type_parameter_list? '(' parameter_list? ')' type_parameter_constraints_clause* '{' class_member_declaration* '}' ; + /// extension_declaration ::= attribute_section* 'extension' type_parameter* '(' parameter* ')' constraint* '{' member* '}' /// [DecompilerAstNode(hasNullNode: false)] public partial class ExtensionDeclaration : EntityDeclaration diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs index ed892e824..cfeeefef7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs @@ -32,7 +32,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// field_declaration : attributes? field_modifier* type variable_declarators ';' ; (C# grammar §15.5.1) + /// field_declaration ::= attribute_section* modifier* type variable_initializer* ';' (C# grammar §15.5.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class FieldDeclaration : EntityDeclaration diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs index 97ed7fd4d..98fa11ee0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs @@ -28,7 +28,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// fixed_size_buffer_declaration : attributes? fixed_size_buffer_modifier* 'fixed' buffer_element_type fixed_size_buffer_declarators ';' ; (C# grammar §24.8.2) + /// fixed_size_buffer_declaration ::= attribute_section* modifier* 'fixed' type variable_initializer* ';' (C# grammar §24.8.2) /// [DecompilerAstNode(hasNullNode: false)] public partial class FixedFieldDeclaration : EntityDeclaration diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs index 53854d235..d0f2d314d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// fixed_size_buffer_declarator : identifier '[' constant_expression ']' ; (C# grammar §24.8.2) + /// fixed_size_buffer_declarator ::= identifier '[' expression ']' (C# grammar §24.8.2) /// [DecompilerAstNode(hasNullNode: false)] public partial class FixedVariableInitializer : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs index 7960ae626..aa45440e4 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs @@ -32,7 +32,12 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// indexer_declaration : attributes? indexer_modifier* indexer_declarator indexer_body | attributes? indexer_modifier* ref_kind indexer_declarator ref_indexer_body ; (C# grammar §15.9.1) + /// + /// indexer_declaration ::= + /// attribute_section* modifier* type ( type '.' )? 'this' '[' parameter* ']' '{' accessor* '}' + /// | attribute_section* modifier* type ( type '.' )? 'this' '[' parameter* ']' '=>' expression ';' + /// + /// (C# grammar §15.9.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class IndexerDeclaration : EntityDeclaration diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs index 78cdebe8d..9da073a73 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs @@ -29,7 +29,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// method_declaration : attributes? method_modifiers return_type method_header method_body | attributes? ref_method_modifiers ref_kind ref_return_type method_header ref_method_body ; (C# grammar §15.6.1) + /// method_declaration ::= attribute_section* modifier* type ( type '.' )? identifier type_parameter* '(' parameter* ')' constraint* ( block | ';' ) (C# grammar §15.6.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class MethodDeclaration : EntityDeclaration diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs index faa7f0ee6..84f239c0e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs @@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// operator_declaration : attributes? operator_modifier+ operator_declarator operator_body ; (C# grammar §15.10.1) + /// operator_declaration ::= attribute_section* modifier+ type ( type '.' )? 'operator' 'checked'? operator_token '(' parameter* ')' ( block | ';' ) (C# grammar §15.10.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class OperatorDeclaration : EntityDeclaration diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs index 4d8479d82..864414a5c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs @@ -31,8 +31,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// fixed_parameter : attributes? parameter_modifier? type identifier default_argument? ; (C# grammar §15.6.2.1) - /// parameter_array : attributes? 'params' array_type identifier ; (C# grammar §15.6.2.1) + /// fixed_parameter ::= attribute_section* ( 'this' | 'scoped'? ( 'ref' 'readonly'? | 'out' | 'in' ) )? type identifier ( '=' expression )? (C# grammar §15.6.2.1) + /// parameter_array ::= attribute_section* 'params' type identifier (C# grammar §15.6.2.1) /// [DecompilerAstNode(hasNullNode: false, hasPatternPlaceholder: true)] public partial class ParameterDeclaration : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs index 1f8bde92b..b44d246ee 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs @@ -29,7 +29,12 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// property_declaration : attributes? property_modifier* type member_name property_body | attributes? property_modifier* ref_kind type member_name ref_property_body ; (C# grammar §15.7.1) + /// + /// property_declaration ::= + /// attribute_section* modifier* type ( type '.' )? identifier '{' accessor* '}' ( '=' expression ';' )? + /// | attribute_section* modifier* type ( type '.' )? identifier '=>' expression ';' + /// + /// (C# grammar §15.7.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class PropertyDeclaration : EntityDeclaration diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs index b8c8ba775..01a86cfdf 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// variable_declarator : identifier ('=' variable_initializer)? ; (C# grammar §15.5.1) + /// variable_declarator ::= identifier ( '=' expression )? (C# grammar §15.5.1) /// [DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)] public partial class VariableInitializer : AstNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs b/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs index 2ad32edd1..26b35c8cb 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// single_variable_designation : identifier ; (C# grammar §11.2.2) + /// single_variable_designation ::= identifier (C# grammar §11.2.2) /// [DecompilerAstNode(hasNullNode: false)] public partial class SingleVariableDesignation : VariableDesignation @@ -47,7 +47,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// tuple_designation : '(' designations? ')' ; (C# grammar §11.2.4) + /// tuple_designation ::= '(' designations? ')' (C# grammar §11.2.4) /// [DecompilerAstNode(hasNullNode: false)] public partial class ParenthesizedVariableDesignation : VariableDesignation