From 140040b6c9a5bde8fd357cf7065a3ae4b2c83e5f Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 14 Jun 2026 19:36:06 +0200 Subject: [PATCH] Annotate AST node classes with their C# grammar productions Each concrete syntax node now carries, in an XML-doc block, the matching production from the C# language specification grammar (ECMA/Microsoft, ANTLR notation), quoted verbatim. Aggregate nodes (e.g. BinaryOperatorExpression, ComposedType, TypeDeclaration) list every production they span; lexical/trivia nodes (Comment, the preprocessor directives, Identifier) cite the lexical rule. Nodes with no spec production -- ErrorExpression, UndocumentedExpression, InvocationAstType, TypeReferenceExpression, NamedExpression, DocumentationReference, and the C# 14 ExtensionDeclaration -- carry a hand-written EBNF plus a note explaining why no official production exists. Assisted-by: Claude:claude-opus-4-8:Claude Code --- .../CSharp/Syntax/ComposedType.cs | 8 +++- .../CSharp/Syntax/DocumentationReference.cs | 3 +- .../Expressions/AnonymousMethodExpression.cs | 2 +- .../AnonymousTypeCreateExpression.cs | 2 +- .../Expressions/ArrayCreateExpression.cs | 2 +- .../Expressions/ArrayInitializerExpression.cs | 2 +- .../CSharp/Syntax/Expressions/AsExpression.cs | 3 +- .../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 | 3 +- .../Expressions/DeclarationExpression.cs | 2 +- .../Expressions/DefaultValueExpression.cs | 2 +- .../Syntax/Expressions/DirectionExpression.cs | 2 +- .../Syntax/Expressions/ErrorExpression.cs | 4 ++ .../Expressions/IdentifierExpression.cs | 3 ++ .../Syntax/Expressions/IndexerExpression.cs | 2 +- .../InterpolatedStringExpression.cs | 8 +++- .../Expressions/InvocationExpression.cs | 2 +- .../CSharp/Syntax/Expressions/IsExpression.cs | 3 +- .../Syntax/Expressions/LambdaExpression.cs | 2 +- .../Expressions/MemberReferenceExpression.cs | 2 +- .../Expressions/NamedArgumentExpression.cs | 2 +- .../Syntax/Expressions/NamedExpression.cs | 5 +- .../Expressions/NullReferenceExpression.cs | 2 +- .../Expressions/ObjectCreateExpression.cs | 2 +- .../OutVarDeclarationExpression.cs | 2 +- .../Expressions/ParenthesizedExpression.cs | 2 +- .../Expressions/PointerReferenceExpression.cs | 2 +- .../Syntax/Expressions/PrimitiveExpression.cs | 1 + .../Syntax/Expressions/QueryExpression.cs | 46 ++++++++++++------- .../Expressions/RecursivePatternExpression.cs | 4 ++ .../Syntax/Expressions/SizeOfExpression.cs | 2 +- .../Expressions/StackAllocExpression.cs | 2 +- .../Syntax/Expressions/SwitchExpression.cs | 5 +- .../Expressions/ThisReferenceExpression.cs | 2 +- .../Syntax/Expressions/ThrowExpression.cs | 2 +- .../Syntax/Expressions/TupleExpression.cs | 3 ++ .../Syntax/Expressions/TypeOfExpression.cs | 2 +- .../Expressions/TypeReferenceExpression.cs | 4 +- .../Expressions/UnaryOperatorExpression.cs | 5 +- .../Syntax/Expressions/UncheckedExpression.cs | 2 +- .../Expressions/UndocumentedExpression.cs | 3 +- .../Expressions/WithInitializerExpression.cs | 3 +- .../CSharp/Syntax/FunctionPointerAstType.cs | 3 ++ .../CSharp/Syntax/GeneralScope/Attribute.cs | 2 +- .../Syntax/GeneralScope/AttributeSection.cs | 3 +- .../CSharp/Syntax/GeneralScope/Comment.cs | 3 ++ .../CSharp/Syntax/GeneralScope/Constraint.cs | 6 +-- .../GeneralScope/DelegateDeclaration.cs | 2 +- .../GeneralScope/ExternAliasDeclaration.cs | 2 +- .../GeneralScope/NamespaceDeclaration.cs | 3 +- .../GeneralScope/PreProcessorDirective.cs | 9 ++++ .../Syntax/GeneralScope/TypeDeclaration.cs | 5 +- .../GeneralScope/TypeParameterDeclaration.cs | 8 ++-- .../GeneralScope/UsingAliasDeclaration.cs | 2 +- .../Syntax/GeneralScope/UsingDeclaration.cs | 3 +- .../CSharp/Syntax/Identifier.cs | 3 ++ .../CSharp/Syntax/InvocationAstType.cs | 3 +- .../CSharp/Syntax/MemberType.cs | 3 ++ .../CSharp/Syntax/PrimitiveType.cs | 4 ++ .../CSharp/Syntax/SimpleType.cs | 3 ++ .../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 | 3 ++ .../CSharp/Syntax/Statements/LockStatement.cs | 2 +- .../Syntax/Statements/ReturnStatement.cs | 2 +- .../Syntax/Statements/SwitchStatement.cs | 8 +++- .../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 | 3 ++ .../Syntax/Statements/WhileStatement.cs | 2 +- .../Syntax/Statements/YieldBreakStatement.cs | 2 +- .../Syntax/Statements/YieldReturnStatement.cs | 2 +- .../CSharp/Syntax/SyntaxTree.cs | 3 ++ .../CSharp/Syntax/TupleAstType.cs | 6 +++ .../TypeMembers/ConstructorDeclaration.cs | 7 +++ .../TypeMembers/DestructorDeclaration.cs | 3 ++ .../TypeMembers/EnumMemberDeclaration.cs | 3 ++ .../Syntax/TypeMembers/EventDeclaration.cs | 6 +++ .../TypeMembers/ExtensionDeclaration.cs | 4 ++ .../Syntax/TypeMembers/FieldDeclaration.cs | 3 ++ .../TypeMembers/FixedFieldDeclaration.cs | 3 ++ .../TypeMembers/FixedVariableInitializer.cs | 2 +- .../Syntax/TypeMembers/IndexerDeclaration.cs | 3 ++ .../Syntax/TypeMembers/MethodDeclaration.cs | 3 ++ .../Syntax/TypeMembers/OperatorDeclaration.cs | 3 ++ .../TypeMembers/ParameterDeclaration.cs | 4 ++ .../Syntax/TypeMembers/PropertyDeclaration.cs | 3 ++ .../Syntax/TypeMembers/VariableInitializer.cs | 3 ++ .../CSharp/Syntax/VariableDesignation.cs | 4 +- 107 files changed, 265 insertions(+), 107 deletions(-) diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs index dc9745761..8da3e13e3 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs @@ -32,6 +32,12 @@ 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) + /// [DecompilerAstNode(hasNullNode: false)] public partial class ComposedType : AstType { @@ -144,7 +150,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// [,,,] + /// 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 0ce2dc7a1..6d1c91b54 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs @@ -21,7 +21,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// Represents a 'cref' reference in XML documentation. + /// 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 ; /// [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 fce3d5252..c30d6a580 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 { /// - /// [async] delegate(Parameters) {Body} + /// anonymous_method_expression : anonymous_function_modifier? 'delegate' explicit_anonymous_function_signature? 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 6beab6626..f066ea765 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 { /// - /// new { [ExpressionList] } + /// anonymous_object_creation_expression : 'new' anonymous_object_initializer ; (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 f4c87ea59..97a38ab68 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 { /// - /// new Type[Dimensions] + /// 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) /// [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 543ba09cf..ce3869a72 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 { /// - /// { Elements } + /// array_initializer : '{' variable_initializer_list? '}' | '{' variable_initializer_list ',' '}' ; (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 9357a0905..dbc6f784b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs @@ -26,7 +26,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// Expression as TypeReference + /// Operator precedence is not represented in the syntax tree; required parentheses are reconstructed by . + /// 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 138a35de0..97f4dd17b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs @@ -30,7 +30,9 @@ using System.Linq.Expressions; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// Left Operator= Right + /// 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 : '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '<<=' | '>>=' | '>>>=' | '&=' | '|=' | '^=' ; /// [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 6a57dabec..c1c4cac98 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 + /// base_access : 'base' '.' identifier type_argument_list? | 'base' '[' argument_list ']' ; (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 96103f676..a0c6441ec 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs @@ -30,7 +30,9 @@ using System.Linq.Expressions; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// Left Operator Right + /// 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 : '*' | '/' | '%' | '+' | '-' | '<<' | '>>' | '>>>' | '<' | '>' | '<=' | '>=' | '==' | '!=' | '&' | '^' | '|' | '&&' | '||' | '??' | '..' ; /// [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 792791258..93d57ebdf 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 { /// - /// (CastTo)Expression + /// cast_expression : '(' type ')' unary_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 eaf4fde5b..c94bd01e4 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 : '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 7da6e166a..5d18d1b4a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs @@ -26,7 +26,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// Condition ? TrueExpression : FalseExpression + /// Operator precedence is not represented in the syntax tree; required parentheses are reconstructed by . + /// 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 fd1455eb7..6f41ef0a1 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 { /// - /// TypeName VariableDesignation + /// declaration_expression : 'scoped'? local_variable_type identifier ; (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 fe0ced210..32e947e75 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(Type) + /// default_value_expression : explicitly_typed_default | default_literal ; (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 1d722740c..9a4f1ab5d 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 } /// - /// ref Expression + /// argument_value : expression | 'in' 'scoped'? variable_reference | 'ref' 'scoped'? variable_reference | 'out' 'scoped'? variable_reference ; (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 3de35f336..3794ae74d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs @@ -25,6 +25,10 @@ // THE SOFTWARE. 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 */ ; + /// [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 a6e4e0392..1f3cc1b81 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs @@ -26,6 +26,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { + /// + /// simple_name : identifier type_argument_list? ; (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 fac5f58b8..a45e62055 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 { /// - /// Target[Arguments] + /// element_access : primary_expression '[' argument_list ']' ; (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 af8273fba..489fd12bd 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs @@ -4,6 +4,9 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; 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) + /// [DecompilerAstNode(hasNullNode: false)] public partial class InterpolatedStringExpression : Expression { @@ -39,7 +42,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// { Expression , Alignment : Suffix } + /// regular_interpolation : expression (',' interpolation_minimum_width)? Regular_Interpolation_Format? ; (C# grammar §12.8.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class Interpolation : InterpolatedStringContent @@ -73,6 +76,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } + /// + /// Interpolated_Regular_String_Mid : Interpolated_Regular_String_Element+ ; (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 237db989b..2b13d60a7 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 { /// - /// Target(Arguments) + /// invocation_expression : primary_expression '(' argument_list? ')' ; (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 e70dea7d6..3286d838b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs @@ -27,7 +27,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// Expression is Type + /// 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) /// [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 2ae304af9..3b9efb943 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 { /// - /// [async] Parameters => Body + /// lambda_expression : attributes? anonymous_function_modifier? (return_type | ref_kind ref_return_type)? anonymous_function_signature '=>' anonymous_function_body ; (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 e8f6cd87f..240c39baf 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 { /// - /// Target.MemberName + /// 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) /// [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 9fd396f35..91f21210b 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. - /// name: expression + /// argument : argument_name? argument_value ; (C# grammar §12.6.2.1) /// [DecompilerAstNode(hasNullNode: false)] public partial class NamedArgumentExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs index 9d7671aa1..d6ce03291 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs @@ -27,9 +27,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// name = expression - /// This isn't the same as 'assign' even though it has the same syntax. - /// This expression is used in object initializers and for named attribute arguments [Attr(FieldName = value)]. + /// No standalone expression production: 'name = value' as used in object initializers (member_initializer), anonymous-object members (member_declarator), and named attribute arguments. + /// named_expression : identifier '=' expression ; /// [DecompilerAstNode(hasNullNode: false)] public partial class NamedExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs index 4795aa54e..a652eb5f6 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 { /// - /// null + /// 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 NullReferenceExpression : Expression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs index 8598f4247..7e9548d6a 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 { /// - /// new Type(Arguments) { Initializer } + /// 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) /// [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 a39874215..e1dd2787a 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 { /// - /// out type expression + /// declaration_expression : 'scoped'? local_variable_type identifier ; (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 c798d5a4a..2def108b2 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 { /// - /// ( Expression ) + /// 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 fc87eede2..a92cabf11 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 { /// - /// Target->MemberName + /// pointer_member_access : primary_expression '->' identifier type_argument_list? ; (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 f78199c5f..488fb3833 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs @@ -45,6 +45,7 @@ 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) /// [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 8553528ac..71b038c43 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs @@ -18,6 +18,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { + /// + /// query_expression : from_clause query_body ; (C# grammar §12.23.1) + /// [DecompilerAstNode(hasNullNode: true)] public partial class QueryExpression : Expression { @@ -41,22 +44,10 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// Represents a query continuation. - /// "(from .. select ..) into Identifier" or "(from .. group .. by ..) into Identifier" - /// Note that "join .. into .." is not a query continuation! - /// - /// This is always the first(!!) clause in a query expression. - /// The tree for "from a in b select c into d select e" looks like this: - /// new QueryExpression { - /// new QueryContinuationClause { - /// PrecedingQuery = new QueryExpression { - /// new QueryFromClause(a in b), - /// new QuerySelectClause(c) - /// }, - /// Identifier = d - /// }, - /// new QuerySelectClause(e) - /// } + /// 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) /// [DecompilerAstNode(hasNullNode: false)] public partial class QueryContinuationClause : QueryClause @@ -86,6 +77,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } + /// + /// from_clause : 'from' type? identifier 'in' expression ; (C# grammar §12.23.1) + /// [DecompilerAstNode(hasNullNode: false)] public partial class QueryFromClause : QueryClause { @@ -118,6 +112,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } + /// + /// let_clause : 'let' identifier '=' expression ; (C# grammar §12.23.1) + /// [DecompilerAstNode(hasNullNode: false)] public partial class QueryLetClause : QueryClause { @@ -146,6 +143,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } + /// + /// where_clause : 'where' boolean_expression ; (C# grammar §12.23.1) + /// [DecompilerAstNode(hasNullNode: false)] public partial class QueryWhereClause : QueryClause { @@ -163,6 +163,8 @@ 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) /// [DecompilerAstNode(hasNullNode: false)] public partial class QueryJoinClause : QueryClause @@ -230,6 +232,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } + /// + /// orderby_clause : 'orderby' orderings ; (C# grammar §12.23.1) + /// [DecompilerAstNode(hasNullNode: false)] public partial class QueryOrderClause : QueryClause { @@ -246,6 +251,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } + /// + /// ordering : expression ordering_direction? ; (C# grammar §12.23.1) + /// [DecompilerAstNode(hasNullNode: false)] public partial class QueryOrdering : AstNode { @@ -278,6 +286,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax Descending } + /// + /// select_clause : 'select' expression ; (C# grammar §12.23.1) + /// [DecompilerAstNode(hasNullNode: false)] public partial class QuerySelectClause : QueryClause { @@ -293,6 +304,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } + /// + /// 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 3f6ca3fe4..46eb571c7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs @@ -20,6 +20,10 @@ 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) + /// [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 5e09d0275..6fcc1ac94 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(Type) + /// sizeof_expression : 'sizeof' '(' unmanaged_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 35c949998..0819b9989 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// stackalloc Type[Count] + /// stackalloc_expression : 'stackalloc' unmanaged_type '[' expression ']' | 'stackalloc' unmanaged_type? '[' constant_expression? ']' stackalloc_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 ce4c57b7b..d5ea6ed5f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs @@ -19,7 +19,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// Expression switch { SwitchSections } + /// 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) /// [DecompilerAstNode(hasNullNode: false)] public partial class SwitchExpression : Expression @@ -41,7 +42,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// Pattern => Expression + /// switch_expression_arm : pattern case_guard? '=>' switch_expression_arm_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 9317b55c4..50119106e 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 + /// 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 da8275a9a..6ffc57d49 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_expression : 'throw' null_coalescing_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 574d612d1..44880cea9 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs @@ -20,6 +20,9 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { + /// + /// tuple_literal : '(' tuple_element (',' tuple_element)+ ')' ; (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 cd422128d..fec302578 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(Type) + /// typeof_expression : 'typeof' '(' type ')' | 'typeof' '(' unbound_type_name ')' | 'typeof' '(' 'void' ')' ; (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 5c39900f7..1ac456173 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs @@ -19,8 +19,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// Represents an AstType as an expression. - /// This is used when calling a method on a primitive type: "int.Parse()" + /// 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 ; /// [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 a5d489ce9..1938a92c7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs @@ -30,7 +30,10 @@ using System.Linq.Expressions; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// Operator Expression + /// 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 : '++' | '--' | '!' | '?' ; /// [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 6b0d52b23..66fa3b61e 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 : '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 f777fc07a..42bebeb7b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs @@ -36,7 +36,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// Represents undocumented expressions. + /// 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 ')' ; /// [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 952f0de20..d075ff453 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs @@ -21,7 +21,8 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// Expression with Initializer + /// 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) /// [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 55b140224..9629fbb6f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs @@ -26,6 +26,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { + /// + /// 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 f20f764e3..17c47d56d 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(Arguments) + /// attribute : attribute_name attribute_arguments? ; (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 a4e3be190..9cc1f7d69 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs @@ -27,7 +27,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// [AttributeTarget: Attributes] + /// attribute_section : '[' attribute_target_specifier? attribute_list ']' ; (C# grammar §23.3) + /// global_attribute_section : '[' global_attribute_target_specifier attribute_list ']' ; (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 df9d131be..cbe3ee3ea 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs @@ -50,6 +50,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax MultiLineDocumentation } + /// + /// Comment : Single_Line_Comment | Delimited_Comment ; (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 1549f8d20..2a77963bd 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs @@ -27,11 +27,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// where TypeParameter : BaseTypes + /// 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) /// - /// - /// new(), struct and class constraints are represented using a PrimitiveType "new", "struct" or "class" - /// [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 09466030b..442611e3a 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 ReturnType Name<TypeParameters>(Parameters) where Constraints; + /// 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) /// [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 03c6f564d..92c1b507a 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 IDENTIFIER; + /// 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 0e2dbc0f0..4be6a153e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs @@ -29,7 +29,8 @@ using System.Collections.Generic; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// namespace Name { Members } + /// 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) /// [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 8fe031cce..243d5b3c1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs @@ -46,6 +46,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax Line = 12 } + /// + /// fragment PP_Line : 'line' PP_Whitespace PP_Line_Indicator ; (C# lexical grammar) + /// [DecompilerAstNode(hasNullNode: false)] public partial class LinePreprocessorDirective : PreProcessorDirective { @@ -68,6 +71,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } + /// + /// fragment PP_Pragma : 'pragma' PP_Pragma_Text? ; (C# lexical grammar) + /// [DecompilerAstNode(hasNullNode: false)] public partial class PragmaWarningPreprocessorDirective : PreProcessorDirective { @@ -104,6 +110,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } + /// + /// PP_Directive : PP_Start PP_Kind PP_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 e1ff3aca1..ed86302ae 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs @@ -45,7 +45,10 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// class Name<TypeParameters> : BaseTypes where Constraints; + /// 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) /// [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 1cba6ba91..1f4aa62b2 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs @@ -21,11 +21,11 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// [in|out] Name - /// /// Represents a type parameter. - /// Note: mirroring the C# syntax, constraints are not part of the type parameter declaration, but belong - /// to the parent type or method. + /// 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) /// [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 86ff1e352..2a899c249 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 = Import; + /// using_alias_directive : 'using' identifier '=' namespace_or_type_name ';' ; (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 e51b08c7e..f7a5e8906 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs @@ -30,7 +30,8 @@ using System.Text; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// using Import; + /// using_namespace_directive : 'using' namespace_name ';' ; (C# grammar §14.6.3) + /// using_static_directive : 'using' 'static' type_name ';' ; (C# grammar §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 6f6d02e90..ffd1219f2 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs @@ -28,6 +28,9 @@ using System; namespace ICSharpCode.Decompiler.CSharp.Syntax { + /// + /// 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 1d8c1e1d6..655e22858 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs @@ -21,7 +21,8 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// BaseType "(" Argument { "," Argument } ")" + /// 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? ')' ; /// [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 6432a62af..b51c25f5e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs @@ -28,6 +28,9 @@ 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) + /// [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 d468e02b3..110178964 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs @@ -31,6 +31,10 @@ 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) + /// [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 a0d323a46..34c7607fe 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs @@ -28,6 +28,9 @@ 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) + /// [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 218e4ae94..bbc663508 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 { /// - /// { Statements } + /// block : '{' statement_list? '}' ; (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 d865ae1cf..2890495f9 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; + /// 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 d39a5b6f8..30f386816 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 BodyBlock + /// 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 68b3f0fa6..51047ada5 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; + /// 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 ffc0f3e3e..16d7cc573 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 EmbeddedStatement while(Condition);" + /// do_statement : 'do' embedded_statement 'while' '(' boolean_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 02d7ec15f..56a7db1ed 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) /// [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 f7f53ef3a..ccebc838f 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; + /// expression_statement : 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 8b85c3060..5092067f1 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 (Type Variables) EmbeddedStatement + /// fixed_statement : 'fixed' '(' pointer_type fixed_pointer_declarators ')' embedded_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 30de85a36..d06bd9846 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 (Initializers; Condition; Iterators) EmbeddedStatement + /// for_statement : 'for' '(' for_initializer? ';' for_condition? ';' for_iterator? ')' embedded_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 44ec50f8e..f4541652d 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 (Type VariableName in InExpression) EmbeddedStatement + /// foreach_statement : 'await'? 'foreach' '(' 'scoped'? ref_kind? local_variable_type identifier 'in' expression ')' embedded_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 aac9944a9..1eea53bd1 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 Label;" + /// goto_statement : 'goto' identifier ';' | 'goto' 'case' constant_expression ';' | 'goto' 'default' ';' ; (C# grammar §13.10.4) /// [DecompilerAstNode(hasNullNode: false)] public partial class GotoStatement : Statement @@ -66,7 +66,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// or "goto case LabelExpression;" + /// goto_statement : 'goto' identifier ';' | 'goto' 'case' constant_expression ';' | 'goto' 'default' ';' ; (C# grammar §13.10.4) /// [DecompilerAstNode(hasNullNode: false)] public partial class GotoCaseStatement : Statement @@ -88,7 +88,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// or "goto default;" + /// goto_statement : 'goto' identifier ';' | 'goto' 'case' constant_expression ';' | '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 c1b140491..854bfea0a 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 (Condition) TrueStatement else FalseStatement + /// if_statement : 'if' '(' boolean_expression ')' embedded_statement | 'if' '(' boolean_expression ')' embedded_statement 'else' embedded_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 019c39bdc..40aff9b49 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 { /// - /// Label: + /// 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 df360dd5a..82678954c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs @@ -20,6 +20,9 @@ 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) + /// [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 bfcb9c414..512ea6f14 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 (Expression) EmbeddedStatement; + /// lock_statement : 'lock' '(' expression ')' embedded_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 d44c4427c..726f3eba6 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 Expression; + /// return_statement : 'return' ';' | 'return' expression ';' | 'return' 'ref' variable_reference ';' ; (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 c445cd4d2..6cd872afa 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 (Expression) { SwitchSections } + /// switch_statement : 'switch' selector_expression switch_block ; (C# grammar §13.8.3) /// [DecompilerAstNode(hasNullNode: false)] public partial class SwitchStatement : Statement @@ -48,6 +48,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } + /// + /// switch_section : switch_label+ statement_list ; (C# grammar §13.8.3) + /// [DecompilerAstNode(hasNullNode: false, hasPatternPlaceholder: true)] public partial class SwitchSection : AstNode { @@ -72,6 +75,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } + /// + /// switch_label : 'case' pattern case_guard? ':' | '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 8a6ac82d4..613b95c08 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 Expression; + /// 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 a4ef9bbfe..b9406b18f 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 TryBlock CatchClauses finally FinallyBlock + /// try_statement : 'try' block catch_clauses | 'try' block catch_clauses? finally_clause ; (C# grammar §13.11) /// [DecompilerAstNode(hasNullNode: false)] public partial class TryCatchStatement : Statement @@ -55,7 +55,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// catch (Type VariableName) { Body } + /// 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) /// [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 3a17afc64..a3410eed6 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 BodyBlock + /// 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 0edce84ab..c5d287277 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 { Body } + /// 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 d44a3f3de..8f78971c7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs @@ -27,7 +27,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { /// - /// [ await ] using (ResourceAcquisition) EmbeddedStatement + /// 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) /// [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 5058d064e..284609152 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs @@ -26,6 +26,9 @@ 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) + /// [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 95e54c8bd..f1dda74c2 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 (Condition) EmbeddedStatement" + /// while_statement : 'while' '(' boolean_expression ')' embedded_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 a4d315467..babe7ce15 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 break; + /// yield_statement : 'yield' 'return' expression ';' | '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 50f28b1d4..f13c6dc18 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 return Expression; + /// yield_statement : 'yield' 'return' expression ';' | 'yield' 'break' ';' ; (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 9ba286657..32c2a756c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs @@ -30,6 +30,9 @@ 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) + /// [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 700337339..33cf06fd9 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs @@ -20,6 +20,9 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { + /// + /// tuple_type : '(' tuple_type_element (',' tuple_type_element)+ ')' ; (C# grammar §8.3.1) + /// [DecompilerAstNode(hasNullNode: false)] public partial class TupleAstType : AstType { @@ -34,6 +37,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } + /// + /// 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 7f296c992..39ab4c744 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs @@ -28,6 +28,10 @@ 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) + /// [DecompilerAstNode(hasNullNode: false)] public partial class ConstructorDeclaration : EntityDeclaration { @@ -67,6 +71,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax This } + /// + /// constructor_initializer : ':' 'base' '(' argument_list? ')' | ':' 'this' '(' argument_list? ')' ; (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 e8028ee9a..274363f26 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs @@ -28,6 +28,9 @@ 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) + /// [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 d8c207ece..b846ee581 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs @@ -28,6 +28,9 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { + /// + /// enum_member_declaration : attributes? identifier ('=' constant_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 39208fee3..830589a7e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs @@ -31,6 +31,9 @@ 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) + /// [DecompilerAstNode(hasNullNode: false)] public partial class EventDeclaration : EntityDeclaration { @@ -71,6 +74,9 @@ 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) + /// [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 44b4ee054..064ccc7e8 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ExtensionDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ExtensionDeclaration.cs @@ -20,6 +20,10 @@ using ICSharpCode.Decompiler.TypeSystem; 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* '}' ; + /// [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 093be3662..ed892e824 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs @@ -31,6 +31,9 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { + /// + /// field_declaration : attributes? field_modifier* type variable_declarators ';' ; (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 5ab1feabb..97ed7fd4d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs @@ -27,6 +27,9 @@ 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) + /// [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 6f861889d..53854d235 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 { /// - /// Name [ CountExpression ] + /// fixed_size_buffer_declarator : identifier '[' constant_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 bd9ebb027..7960ae626 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs @@ -31,6 +31,9 @@ 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) + /// [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 ee5db39a0..78cdebe8d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs @@ -28,6 +28,9 @@ 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) + /// [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 b59cd1908..faa7f0ee6 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs @@ -76,6 +76,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax CheckedExplicit } + /// + /// operator_declaration : attributes? operator_modifier+ operator_declarator operator_body ; (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 a15c3b2bf..4d8479d82 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs @@ -30,6 +30,10 @@ 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) + /// [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 52e778903..1f8bde92b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs @@ -28,6 +28,9 @@ 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) + /// [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 edf6a8be5..b8c8ba775 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs @@ -26,6 +26,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { + /// + /// variable_declarator : identifier ('=' variable_initializer)? ; (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 1aa14c19b..2ad32edd1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } /// - /// Identifier + /// 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 } /// - /// ( VariableDesignation (, VariableDesignation)* ) + /// tuple_designation : '(' designations? ')' ; (C# grammar §11.2.4) /// [DecompilerAstNode(hasNullNode: false)] public partial class ParenthesizedVariableDesignation : VariableDesignation