Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 35 additions & 46 deletions standard/grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
// Source: §6.3.2 Line terminators
New_Line
: New_Line_Character
| '\u000D\u000A' // carriage return, line feed
| '\u000D\u000A' // carriage return, line feed
;

// Source: §6.3.3 Comments
Expand All @@ -58,19 +58,19 @@
// anything but New_Line_Character
: ~('\u000D' | '\u000A' | '\u0085' | '\u2028' | '\u2029')
;

fragment New_Line_Character
: '\u000D' // carriage return
| '\u000A' // line feed
| '\u0085' // next line
| '\u2028' // line separator
| '\u2029' // paragraph separator
;

fragment Delimited_Comment
: '/*' Delimited_Comment_Section* ASTERISK+ '/'
;

fragment Delimited_Comment_Section
: SLASH
| ASTERISK* Not_Slash_Or_Asterisk
Expand Down Expand Up @@ -125,7 +125,7 @@
fragment Escaped_Identifier
// Includes keywords and contextual keywords prefixed by '@'.
// See note below.
: '@' Basic_Identifier
: '@' Basic_Identifier
;

fragment Basic_Identifier
Expand Down Expand Up @@ -246,36 +246,36 @@
fragment Decorated_Decimal_Digit
: '_'* Decimal_Digit
;

fragment Decimal_Digit
: '0'..'9'
;

fragment Integer_Type_Suffix
: 'U' | 'u' | 'L' | 'l' |
'UL' | 'Ul' | 'uL' | 'ul' | 'LU' | 'Lu' | 'lU' | 'lu'
;

fragment Hexadecimal_Integer_Literal
: ('0x' | '0X') Decorated_Hex_Digit+ Integer_Type_Suffix?
;

fragment Decorated_Hex_Digit
: '_'* Hex_Digit
;

fragment Hex_Digit
: '0'..'9' | 'A'..'F' | 'a'..'f'
;

fragment Binary_Integer_Literal
: ('0b' | '0B') Decorated_Binary_Digit+ Integer_Type_Suffix?
;

fragment Decorated_Binary_Digit
: '_'* Binary_Digit
;

fragment Binary_Digit
: '0' | '1'
;
Expand Down Expand Up @@ -305,24 +305,24 @@
Character_Literal
: '\'' Character '\''
;

fragment Character
: Single_Character
| Simple_Escape_Sequence
| Hexadecimal_Escape_Sequence
| Unicode_Escape_Sequence
;

fragment Single_Character
// anything but ', \, and New_Line_Character
: ~['\\\u000D\u000A\u0085\u2028\u2029]
;

fragment Simple_Escape_Sequence
: '\\\'' | '\\"' | '\\\\' | '\\0' | '\\a' | '\\b' |
'\\f' | '\\n' | '\\r' | '\\t' | '\\v'
;

fragment Hexadecimal_Escape_Sequence
: '\\x' Hex_Digit Hex_Digit? Hex_Digit? Hex_Digit?
;
Expand All @@ -332,11 +332,11 @@
: Regular_String_Literal
| Verbatim_String_Literal
;

fragment Regular_String_Literal
: '"' Regular_String_Literal_Character* '"'
;

fragment Regular_String_Literal_Character
: Single_Regular_String_Literal_Character
| Simple_Escape_Sequence
Expand All @@ -352,16 +352,16 @@
fragment Verbatim_String_Literal
: '@"' Verbatim_String_Literal_Character* '"'
;

fragment Verbatim_String_Literal_Character
: Single_Verbatim_String_Literal_Character
| Quote_Escape_Sequence
;

fragment Single_Verbatim_String_Literal_Character
: ~["] // anything but quotation mark (U+0022)
;

fragment Quote_Escape_Sequence
: '""'
;
Expand Down Expand Up @@ -431,11 +431,11 @@
fragment PP_Expression
: PP_Whitespace? PP_Or_Expression PP_Whitespace?
;

fragment PP_Or_Expression
: PP_And_Expression (PP_Whitespace? '||' PP_Whitespace? PP_And_Expression)*
;

fragment PP_And_Expression
: PP_Equality_Expression (PP_Whitespace? '&&' PP_Whitespace?
PP_Equality_Expression)*
Expand All @@ -445,12 +445,12 @@
: PP_Unary_Expression (PP_Whitespace? ('==' | '!=') PP_Whitespace?
PP_Unary_Expression)*
;

fragment PP_Unary_Expression
: PP_Primary_Expression
| '!' PP_Whitespace? PP_Unary_Expression
;

fragment PP_Primary_Expression
: TRUE
| FALSE
Expand All @@ -475,15 +475,15 @@
fragment PP_If_Section
: 'if' PP_Whitespace PP_Expression
;

fragment PP_Elif_Section
: 'elif' PP_Whitespace PP_Expression
;

fragment PP_Else_Section
: 'else'
;

fragment PP_Endif
: 'endif'
;
Expand Down Expand Up @@ -523,11 +523,11 @@
| DEFAULT
| 'hidden'
;

fragment PP_Compilation_Unit_Name
: '"' PP_Compilation_Unit_Name_Character* '"'
;

fragment PP_Compilation_Unit_Name_Character
// Any Input_Character except "
: ~('\u000D' | '\u000A' | '\u0085' | '\u2028' | '\u2029' | '"')
Expand Down Expand Up @@ -1004,8 +1004,8 @@
: primary_expression '(' argument_list? ')'
;

// Source: §12.8.11 Null Conditional Invocation Expression

Check warning on line 1007 in standard/grammar.md

View workflow job for this annotation

GitHub Actions / Markdown to Word Converter

standard/grammar.md#L1007

MDC032::Line length 84 > maximum 81
null_conditional_invocation_expression

Check warning on line 1008 in standard/grammar.md

View workflow job for this annotation

GitHub Actions / Markdown to Word Converter

standard/grammar.md#L1008

MDC032::Line length 85 > maximum 81
: null_conditional_member_access null_forgiving_operator? '(' argument_list? ')'
| null_conditional_element_access null_forgiving_operator? '(' argument_list? ')'
;
Expand Down Expand Up @@ -1092,8 +1092,7 @@
;

expression_list
: expression
| expression_list ',' expression
: expression (',' expression)*
;

// Source: §12.8.17.3 Anonymous object creation expressions
Expand Down Expand Up @@ -1182,7 +1181,7 @@
;

// Source: §12.8.22 Stack allocation
stackalloc_expression

Check warning on line 1184 in standard/grammar.md

View workflow job for this annotation

GitHub Actions / Markdown to Word Converter

standard/grammar.md#L1184

MDC032::Line length 86 > maximum 81
: 'stackalloc' unmanaged_type '[' expression ']'
| 'stackalloc' unmanaged_type? '[' constant_expression? ']' stackalloc_initializer
;
Expand Down Expand Up @@ -1410,12 +1409,7 @@
;

query_body
: query_body_clauses? select_or_group_clause query_continuation?
;

query_body_clauses
: query_body_clause
| query_body_clauses query_body_clause
: query_body_clause* select_or_group_clause query_continuation?
;

query_body_clause
Expand Down Expand Up @@ -1948,12 +1942,11 @@

// Source: §15.2.3 Type parameters
type_parameter_list
: '<' type_parameters '>'
: '<' decorated_type_parameter (',' decorated_type_parameter)* '>'
;

type_parameters
decorated_type_parameter
: attributes? type_parameter
| type_parameters ',' attributes? type_parameter
;

// Source: §15.2.4.1 General
Expand All @@ -1976,7 +1969,7 @@
type_parameter_constraints_clause
: 'where' type_parameter ':' type_parameter_constraints
;

Check warning on line 1972 in standard/grammar.md

View workflow job for this annotation

GitHub Actions / Markdown to Word Converter

standard/grammar.md#L1972

MDC032::Line length 83 > maximum 81
type_parameter_constraints
: primary_constraint (',' secondary_constraints)? (',' constructor_constraint)?
| secondary_constraints (',' constructor_constraint)?
Expand Down Expand Up @@ -2339,7 +2332,7 @@
logical_negation_operator
: '!'
;

Check warning on line 2335 in standard/grammar.md

View workflow job for this annotation

GitHub Actions / Markdown to Word Converter

standard/grammar.md#L2335

MDC032::Line length 82 > maximum 81
overloadable_unary_operator
: '+' | '-' | logical_negation_operator | '~' | '++' | '--' | 'true' | 'false'
;
Expand Down Expand Up @@ -2508,17 +2501,13 @@

// Source: §18.2.3.1 General
variant_type_parameter_list
: '<' variant_type_parameters '>'
: '<' variant_type_parameter (',' variant_type_parameter)* '>'
;

// Source: §18.2.3.1 General
variant_type_parameters
variant_type_parameter
: attributes? variance_annotation? type_parameter
| variant_type_parameters ',' attributes? variance_annotation?
type_parameter
;

// Source: §18.2.3.1 General
variance_annotation
: 'in'
| 'out'
Expand Down
Loading