diff --git a/docs/_docs/reference/changed-features/imports.md b/docs/_docs/reference/changed-features/imports.md index df9657115822..7d364ce68b92 100644 --- a/docs/_docs/reference/changed-features/imports.md +++ b/docs/_docs/reference/changed-features/imports.md @@ -46,14 +46,14 @@ are offered under settings `-source 3.1-migration -rewrite`. ### Syntax -```ebnf -Import ::= ‘import’ ImportExpr {‘,’ ImportExpr} ; -ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec ; +``` +Import ::= ‘import’ ImportExpr {‘,’ ImportExpr} +ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec ImportSpec ::= NamedSelector | WildcardSelector - | ‘{’ ImportSelectors) ‘}’ ; -NamedSelector ::= id [‘as’ (id | ‘_’)] ; -WildCardSelector ::= ‘*' | ‘given’ [InfixType] ; + | ‘{’ ImportSelectors) ‘}’ +NamedSelector ::= id [‘as’ (id | ‘_’)] +WildCardSelector ::= ‘*' | ‘given’ [InfixType] ImportSelectors ::= NamedSelector [‘,’ ImportSelectors] - | WildCardSelector {‘,’ WildCardSelector} ; + | WildCardSelector {‘,’ WildCardSelector} ``` diff --git a/docs/_docs/reference/changed-features/match-syntax.md b/docs/_docs/reference/changed-features/match-syntax.md index bd39fc39b033..cff77262611b 100644 --- a/docs/_docs/reference/changed-features/match-syntax.md +++ b/docs/_docs/reference/changed-features/match-syntax.md @@ -47,10 +47,10 @@ The syntactical precedence of match expressions has been changed. The new syntax of match expressions is as follows. -```ebnf +``` InfixExpr ::= ... - | InfixExpr MatchClause ; + | InfixExpr MatchClause SimpleExpr ::= ... - | SimpleExpr ‘.’ MatchClause ; -MatchClause ::= ‘match’ ‘{’ CaseClauses ‘}’ ; + | SimpleExpr ‘.’ MatchClause +MatchClause ::= ‘match’ ‘{’ CaseClauses ‘}’ ``` diff --git a/docs/_docs/reference/changed-features/pattern-bindings.md b/docs/_docs/reference/changed-features/pattern-bindings.md index 7d84f97cc4c3..2c8d1c10ceae 100644 --- a/docs/_docs/reference/changed-features/pattern-bindings.md +++ b/docs/_docs/reference/changed-features/pattern-bindings.md @@ -50,8 +50,8 @@ for case (x, y) <- elems yield (y, x) // returns List((2, 1), (4, 3)) ## Syntax Changes Generators in for expressions may be prefixed with `case`. -```ebnf -Generator ::= [‘case’] Pattern1 ‘<-’ Expr ; +``` +Generator ::= [‘case’] Pattern1 ‘<-’ Expr ``` ## Migration diff --git a/docs/_docs/reference/changed-features/structural-types-spec.md b/docs/_docs/reference/changed-features/structural-types-spec.md index 63cf258888fa..290189a67eda 100644 --- a/docs/_docs/reference/changed-features/structural-types-spec.md +++ b/docs/_docs/reference/changed-features/structural-types-spec.md @@ -6,11 +6,11 @@ movedTo: https://docs.scala-lang.org/scala3/reference/changed-features/structura ## Syntax -```ebnf -SimpleType ::= ... | Refinement ; -Refinement ::= ‘{’ RefineStatSeq ‘}’ ; -RefineStatSeq ::= RefineStat {semi RefineStat} ; -RefineStat ::= ‘val’ VarDcl | ‘def’ DefDcl | ‘type’ {nl} TypeDcl ; +``` +SimpleType ::= ... | Refinement +Refinement ::= ‘{’ RefineStatSeq ‘}’ +RefineStatSeq ::= RefineStat {semi RefineStat} +RefineStat ::= ‘val’ VarDcl | ‘def’ DefDcl | ‘type’ {nl} TypeDcl ``` ## Implementation of Structural Types diff --git a/docs/_docs/reference/changed-features/vararg-splices.md b/docs/_docs/reference/changed-features/vararg-splices.md index d74962cec3ff..1d8b61408176 100644 --- a/docs/_docs/reference/changed-features/vararg-splices.md +++ b/docs/_docs/reference/changed-features/vararg-splices.md @@ -24,12 +24,12 @@ The old syntax for splice arguments will be phased out. ## Syntax -```ebnf +``` ArgumentPatterns ::= ‘(’ [Patterns] ‘)’ - | ‘(’ [Patterns ‘,’] Pattern2 ‘*’ ‘)’ ; + | ‘(’ [Patterns ‘,’] Pattern2 ‘*’ ‘)’ ParArgumentExprs ::= ‘(’ [‘using’] ExprsInParens ‘)’ - | ‘(’ [ExprsInParens ‘,’] PostfixExpr ‘*’ ‘)’ ; + | ‘(’ [ExprsInParens ‘,’] PostfixExpr ‘*’ ‘)’ ``` ## Compatibility considerations diff --git a/docs/_docs/reference/contextual/context-bounds.md b/docs/_docs/reference/contextual/context-bounds.md index 756f0c3a36bf..e336f00cc463 100644 --- a/docs/_docs/reference/contextual/context-bounds.md +++ b/docs/_docs/reference/contextual/context-bounds.md @@ -40,7 +40,7 @@ done automatically under `-rewrite`. ## Syntax -```ebnf -TypeParamBounds ::= [SubtypeBounds] {ContextBound} ; -ContextBound ::= ‘:’ Type ; +``` +TypeParamBounds ::= [SubtypeBounds] {ContextBound} +ContextBound ::= ‘:’ Type ``` diff --git a/docs/_docs/reference/contextual/context-functions-spec.md b/docs/_docs/reference/contextual/context-functions-spec.md index 1a5b43691b63..3c61e0e0c6ca 100644 --- a/docs/_docs/reference/contextual/context-functions-spec.md +++ b/docs/_docs/reference/contextual/context-functions-spec.md @@ -6,11 +6,11 @@ movedTo: https://docs.scala-lang.org/scala3/reference/contextual/context-functio ## Syntax -```ebnf +``` Type ::= ... - | FunArgTypes ‘?=>’ Type ; + | FunArgTypes ‘?=>’ Type Expr ::= ... - | FunParams ‘?=>’ Expr ; + | FunParams ‘?=>’ Expr ``` Context function types associate to the right, e.g. diff --git a/docs/_docs/reference/contextual/derivation.md b/docs/_docs/reference/contextual/derivation.md index df1bcddcf80c..972ac945a22d 100644 --- a/docs/_docs/reference/contextual/derivation.md +++ b/docs/_docs/reference/contextual/derivation.md @@ -354,12 +354,12 @@ hand side of this definition in the same way as an instance defined in ADT compa ### Syntax -```ebnf -Template ::= InheritClauses [TemplateBody] ; -EnumDef ::= id ClassConstr InheritClauses EnumBody ; -InheritClauses ::= [‘extends’ ConstrApps] [‘derives’ QualId {‘,’ QualId}] ; +``` +Template ::= InheritClauses [TemplateBody] +EnumDef ::= id ClassConstr InheritClauses EnumBody +InheritClauses ::= [‘extends’ ConstrApps] [‘derives’ QualId {‘,’ QualId}] ConstrApps ::= ConstrApp {‘with’ ConstrApp} - | ConstrApp {‘,’ ConstrApp} ; + | ConstrApp {‘,’ ConstrApp} ``` **Note:** To align `extends` clauses and `derives` clauses, Scala 3 also allows multiple diff --git a/docs/_docs/reference/contextual/extension-methods.md b/docs/_docs/reference/contextual/extension-methods.md index 3d2dc4109ca5..c2a12081cf99 100644 --- a/docs/_docs/reference/contextual/extension-methods.md +++ b/docs/_docs/reference/contextual/extension-methods.md @@ -285,20 +285,20 @@ def position(s: String)(ch: Char, n: Int): Int = Here are the syntax changes for extension methods and collective extensions relative to the [current syntax](../syntax.md). -```ebnf -BlockStat ::= ... | Extension ; -TemplateStat ::= ... | Extension ; -TopStat ::= ... | Extension ; +``` +BlockStat ::= ... | Extension +TemplateStat ::= ... | Extension +TopStat ::= ... | Extension Extension ::= ‘extension’ [DefTypeParamClause] {UsingParamClause} - ‘(’ DefParam ‘)’ {UsingParamClause} ExtMethods ; -ExtMethods ::= ExtMethod | [nl] <<< ExtMethod {semi ExtMethod} >>> ; -ExtMethod ::= {Annotation [nl]} {Modifier} ‘def’ DefDef ; + ‘(’ DefParam ‘)’ {UsingParamClause} ExtMethods +ExtMethods ::= ExtMethod | [nl] <<< ExtMethod {semi ExtMethod} >>> +ExtMethod ::= {Annotation [nl]} {Modifier} ‘def’ DefDef ``` In the above the notation `<<< ts >>>` in the production rule `ExtMethods` is defined as follows : -```ebnf -<<< ts >>> ::= ‘{’ ts ‘}’ | indent ts outdent ; +``` +<<< ts >>> ::= ‘{’ ts ‘}’ | indent ts outdent ``` `extension` is a soft keyword. It is recognized as a keyword only if it appears diff --git a/docs/_docs/reference/contextual/given-imports.md b/docs/_docs/reference/contextual/given-imports.md index cd49eda49d1b..3e3bc3d275cc 100644 --- a/docs/_docs/reference/contextual/given-imports.md +++ b/docs/_docs/reference/contextual/given-imports.md @@ -103,15 +103,15 @@ given instances once their user base has migrated. ### Syntax -```ebnf -Import ::= ‘import’ ImportExpr {‘,’ ImportExpr} ; -Export ::= ‘export’ ImportExpr {‘,’ ImportExpr} ; -ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec ; +``` +Import ::= ‘import’ ImportExpr {‘,’ ImportExpr} +Export ::= ‘export’ ImportExpr {‘,’ ImportExpr} +ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec ImportSpec ::= NamedSelector | WildcardSelector - | ‘{’ ImportSelectors) ‘}’ ; -NamedSelector ::= id [‘as’ (id | ‘_’)] ; -WildCardSelector ::= ‘*' | ‘given’ [InfixType] ; + | ‘{’ ImportSelectors) ‘}’ +NamedSelector ::= id [‘as’ (id | ‘_’)] +WildCardSelector ::= ‘*' | ‘given’ [InfixType] ImportSelectors ::= NamedSelector [‘,’ ImportSelectors] - | WildCardSelector {‘,’ WildCardSelector} ; + | WildCardSelector {‘,’ WildCardSelector} ``` diff --git a/docs/_docs/reference/contextual/givens.md b/docs/_docs/reference/contextual/givens.md index 9c440d56ca1e..1d0baae9e257 100644 --- a/docs/_docs/reference/contextual/givens.md +++ b/docs/_docs/reference/contextual/givens.md @@ -173,14 +173,14 @@ is created for each reference. Here is the syntax for given instances: -```ebnf +``` TmplDef ::= ... - | ‘given’ GivenDef ; + | ‘given’ GivenDef GivenDef ::= [GivenSig] StructuralInstance | [GivenSig] AnnotType ‘=’ Expr - | [GivenSig] AnnotType ; -GivenSig ::= [id] [DefTypeParamClause] {UsingParamClause} ‘:’ ; -StructuralInstance ::= ConstrApp {‘with’ ConstrApp} ‘with’ TemplateBody ; + | [GivenSig] AnnotType +GivenSig ::= [id] [DefTypeParamClause] {UsingParamClause} ‘:’ +StructuralInstance ::= ConstrApp {‘with’ ConstrApp} ‘with’ TemplateBody ``` A given instance starts with the reserved word `given` and an optional _signature_. The signature diff --git a/docs/_docs/reference/contextual/using-clauses.md b/docs/_docs/reference/contextual/using-clauses.md index 31caf9dbd1d1..8c522d82c402 100644 --- a/docs/_docs/reference/contextual/using-clauses.md +++ b/docs/_docs/reference/contextual/using-clauses.md @@ -144,10 +144,10 @@ def summon[T](using x: T): x.type = x Here is the new syntax of parameters and arguments seen as a delta from the [standard context free syntax of Scala 3](../syntax.md). `using` is a soft keyword, recognized only at the start of a parameter or argument list. It can be used as a normal identifier everywhere else. -```ebnf -ClsParamClause ::= ... | UsingClsParamClause ; -DefParamClauses ::= ... | UsingParamClause ; -UsingClsParamClause ::= ‘(’ ‘using’ (ClsParams | Types) ‘)’ ; -UsingParamClause ::= ‘(’ ‘using’ (DefParams | Types) ‘)’ ; -ParArgumentExprs ::= ... | ‘(’ ‘using’ ExprsInParens ‘)’ ; +``` +ClsParamClause ::= ... | UsingClsParamClause +DefParamClauses ::= ... | UsingParamClause +UsingClsParamClause ::= ‘(’ ‘using’ (ClsParams | Types) ‘)’ +UsingParamClause ::= ‘(’ ‘using’ (DefParams | Types) ‘)’ +ParArgumentExprs ::= ... | ‘(’ ‘using’ ExprsInParens ‘)’ ``` diff --git a/docs/_docs/reference/enums/adts.md b/docs/_docs/reference/enums/adts.md index fa2aa2ebd113..6fc5be78d7b8 100644 --- a/docs/_docs/reference/enums/adts.md +++ b/docs/_docs/reference/enums/adts.md @@ -154,18 +154,18 @@ The changes are specified below as deltas with respect to the Scala syntax given 1. Enum definitions are defined as follows: - ```ebnf - TmplDef ::= `enum' EnumDef ; - EnumDef ::= id ClassConstr [`extends' [ConstrApps]] EnumBody ; - EnumBody ::= [nl] ‘{’ [SelfType] EnumStat {semi EnumStat} ‘}’ ; + ``` + TmplDef ::= `enum' EnumDef + EnumDef ::= id ClassConstr [`extends' [ConstrApps]] EnumBody + EnumBody ::= [nl] ‘{’ [SelfType] EnumStat {semi EnumStat} ‘}’ EnumStat ::= TemplateStat - | {Annotation [nl]} {Modifier} EnumCase ; + | {Annotation [nl]} {Modifier} EnumCase ``` 2. Cases of enums are defined as follows: - ```ebnf - EnumCase ::= `case' (id ClassConstr [`extends' ConstrApps]] | ids) ; + ``` + EnumCase ::= `case' (id ClassConstr [`extends' ConstrApps]] | ids) ``` ### Reference diff --git a/docs/_docs/reference/experimental/named-typeargs-spec.md b/docs/_docs/reference/experimental/named-typeargs-spec.md index 9ec9fd200ed2..7bf5c2f43ccf 100644 --- a/docs/_docs/reference/experimental/named-typeargs-spec.md +++ b/docs/_docs/reference/experimental/named-typeargs-spec.md @@ -10,11 +10,11 @@ In this section we give more details about the [named type arguments](named-type The addition to the grammar is: -```ebnf +``` SimpleExpr1 ::= ... - | SimpleExpr (TypeArgs | NamedTypeArgs) ; -NamedTypeArgs ::= ‘[’ NamedTypeArg {‘,’ NamedTypeArg} ‘]’ ; -NamedTypeArg ::= id ‘=’ Type ; + | SimpleExpr (TypeArgs | NamedTypeArgs) +NamedTypeArgs ::= ‘[’ NamedTypeArg {‘,’ NamedTypeArg} ‘]’ +NamedTypeArg ::= id ‘=’ Type ``` Note in particular that named arguments cannot be passed to type constructors: diff --git a/docs/_docs/reference/metaprogramming/macros-spec.md b/docs/_docs/reference/metaprogramming/macros-spec.md index 91cd36173ede..d152377e6d62 100644 --- a/docs/_docs/reference/metaprogramming/macros-spec.md +++ b/docs/_docs/reference/metaprogramming/macros-spec.md @@ -10,13 +10,13 @@ movedTo: https://docs.scala-lang.org/scala3/reference/metaprogramming/macros-spe Compared to the [Scala 3 reference grammar](../syntax.md) there are the following syntax changes: -```ebnf +``` SimpleExpr ::= ... | ‘'’ ‘{’ Block ‘}’ | ‘'’ ‘[’ Type ‘]’ - | ‘$’ ‘{’ Block ‘}’ ; + | ‘$’ ‘{’ Block ‘}’ SimpleType ::= ... - | ‘$’ ‘{’ Block ‘}’ ; + | ‘$’ ‘{’ Block ‘}’ ``` In addition, an identifier `$x` starting with a `$` that appears inside a quoted expression or type is treated as a splice `${x}` and a quoted identifier @@ -57,36 +57,36 @@ extends simply-typed lambda calculus with quotes and splices. ### Syntax The syntax of terms, values, and types is given as follows: -```ebnf +``` Terms t ::= x variable (x: T) => t lambda t t application 't quote - $t splice ; + $t splice Values v ::= (x: T) => t lambda - 'u quote ; + 'u quote -Simple terms u ::= x | (x: T) => u | u u | 't ; +Simple terms u ::= x | (x: T) => u | u u | 't Types T ::= A base type T -> T function type - expr T quoted ; + expr T quoted ``` Typing rules are formulated using a stack of environments `Es`. Individual environments `E` consist as usual of variable bindings `x: T`. Environments can be combined using the two combinators `'` and `$`. -```ebnf +``` Environment E ::= () empty - E, x: T ; + E, x: T Env. stack Es ::= () empty E simple - Es * Es combined ; + Es * Es combined Separator * ::= ' - $ ; + $ ``` The two environment combinators are both associative with left and right identity `()`. @@ -108,9 +108,9 @@ rule says that splice and quotes cancel each other out. The third rule is a context rule; it says that reduction is allowed in the hole `[ ]` position of an evaluation context. Evaluation contexts `e` and splice evaluation context `e_s` are defined syntactically as follows: -```ebnf -Eval context e ::= [ ] | e t | v e | 'e_s[${e}] ; -Splice context e_s ::= [ ] | (x: T) => e_s | e_s t | u e_s ; +``` +Eval context e ::= [ ] | e t | v e | 'e_s[${e}] +Splice context e_s ::= [ ] | (x: T) => e_s | e_s t | u e_s ``` ### Typing rules diff --git a/docs/_docs/reference/metaprogramming/simple-smp.md b/docs/_docs/reference/metaprogramming/simple-smp.md index 89529bac1480..78277987c874 100644 --- a/docs/_docs/reference/metaprogramming/simple-smp.md +++ b/docs/_docs/reference/metaprogramming/simple-smp.md @@ -23,21 +23,21 @@ replace evaluation contexts with contextual typing rules. While this is more verbose, it makes it easier to set up the meta theory. ## Syntax -```ebnf +``` Terms t ::= x variable (x: T) => t lambda t t application ’t quote - ~t splice ; + ~t splice -Simple terms u ::= x | (x: T) => u | u u ; +Simple terms u ::= x | (x: T) => u | u u Values v ::= (x: T) => t lambda - ’u quoted value ; + ’u quoted value Types T ::= A base type T -> T function type - ’T quoted type ; + ’T quoted type ``` ## Operational semantics diff --git a/docs/_docs/reference/new-types/dependent-function-types-spec.md b/docs/_docs/reference/new-types/dependent-function-types-spec.md index 8fb0d03dc13c..c3915ba9b8ac 100644 --- a/docs/_docs/reference/new-types/dependent-function-types-spec.md +++ b/docs/_docs/reference/new-types/dependent-function-types-spec.md @@ -8,11 +8,11 @@ Initial implementation in [PR #3464](https://github.com/lampepfl/dotty/pull/3464 ## Syntax -```ebnf +``` FunArgTypes ::= InfixType | ‘(’ [ FunArgType {',' FunArgType } ] ‘)’ - | ‘(’ TypedFunParam {',' TypedFunParam } ‘)’ ; -TypedFunParam ::= id ‘:’ Type ; + | ‘(’ TypedFunParam {',' TypedFunParam } ‘)’ +TypedFunParam ::= id ‘:’ Type ``` Dependent function types associate to the right, e.g. diff --git a/docs/_docs/reference/new-types/intersection-types-spec.md b/docs/_docs/reference/new-types/intersection-types-spec.md index 6a6e579f4bae..8ed9305e1486 100644 --- a/docs/_docs/reference/new-types/intersection-types-spec.md +++ b/docs/_docs/reference/new-types/intersection-types-spec.md @@ -12,9 +12,9 @@ with the usual precedence and subject to usual resolving rules. Unless shadowed by another definition, it resolves to the type `scala.&`, which acts as a type alias to an internal representation of intersection types. -```ebnf -Type ::= ...| InfixType ; -InfixType ::= RefinedType {id [nl] RefinedType} ; +``` +Type ::= ...| InfixType +InfixType ::= RefinedType {id [nl] RefinedType} ``` ## Subtyping Rules diff --git a/docs/_docs/reference/new-types/type-lambdas-spec.md b/docs/_docs/reference/new-types/type-lambdas-spec.md index 5f52956a4d4e..5c791ba40272 100644 --- a/docs/_docs/reference/new-types/type-lambdas-spec.md +++ b/docs/_docs/reference/new-types/type-lambdas-spec.md @@ -6,11 +6,11 @@ movedTo: https://docs.scala-lang.org/scala3/reference/new-types/type-lambdas-spe ## Syntax -```ebnf -Type ::= ... | TypeParamClause ‘=>>’ Type ; -TypeParamClause ::= ‘[’ TypeParam {‘,’ TypeParam} ‘]’ ; -TypeParam ::= {Annotation} (id [HkTypeParamClause] | ‘_’) TypeBounds ; -TypeBounds ::= [‘>:’ Type] [‘<:’ Type] ; +``` +Type ::= ... | TypeParamClause ‘=>>’ Type +TypeParamClause ::= ‘[’ TypeParam {‘,’ TypeParam} ‘]’ +TypeParam ::= {Annotation} (id [HkTypeParamClause] | ‘_’) TypeBounds +TypeBounds ::= [‘>:’ Type] [‘<:’ Type] ``` ### Type Checking diff --git a/docs/_docs/reference/other-new-features/export.md b/docs/_docs/reference/other-new-features/export.md index 89e054605bb7..85f03de4104e 100644 --- a/docs/_docs/reference/other-new-features/export.md +++ b/docs/_docs/reference/other-new-features/export.md @@ -134,20 +134,20 @@ more flexible way. ## Syntax changes: -```ebnf +``` TemplateStat ::= ... - | Export ; + | Export TopStat ::= ... - | Export ; -Export ::= ‘export’ ImportExpr {‘,’ ImportExpr} ; -ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec ; + | Export +Export ::= ‘export’ ImportExpr {‘,’ ImportExpr} +ImportExpr ::= SimpleRef {‘.’ id} ‘.’ ImportSpec ImportSpec ::= NamedSelector | WildcardSelector - | ‘{’ ImportSelectors) ‘}’ ; -NamedSelector ::= id [‘as’ (id | ‘_’)] ; -WildCardSelector ::= ‘*’ | ‘given’ [InfixType] ; + | ‘{’ ImportSelectors) ‘}’ +NamedSelector ::= id [‘as’ (id | ‘_’)] +WildCardSelector ::= ‘*’ | ‘given’ [InfixType] ImportSelectors ::= NamedSelector [‘,’ ImportSelectors] - | WildCardSelector {‘,’ WildCardSelector} ; + | WildCardSelector {‘,’ WildCardSelector} ``` ## Elaboration of Export Clauses diff --git a/docs/_docs/reference/other-new-features/indentation-experimental.md b/docs/_docs/reference/other-new-features/indentation-experimental.md index 073c10e2f92c..cbdd41eeaf12 100644 --- a/docs/_docs/reference/other-new-features/indentation-experimental.md +++ b/docs/_docs/reference/other-new-features/indentation-experimental.md @@ -62,13 +62,13 @@ Braces can be omitted if the lambda starts with a parameter list and `=>` or `=> ## Syntax Changes -```ebnf +``` SimpleExpr ::= ... | SimpleExpr `:` IndentedArgument - | SimpleExpr FunParams (‘=>’ | ‘?=>’) IndentedArgument ; + | SimpleExpr FunParams (‘=>’ | ‘?=>’) IndentedArgument InfixExpr ::= ... - | InfixExpr id `:` IndentedArgument ; -IndentedArgument ::= indent (CaseClauses | Block) outdent ; + | InfixExpr id `:` IndentedArgument +IndentedArgument ::= indent (CaseClauses | Block) outdent ``` Note that a lambda argument must have the `=>` at the end of a line for braces diff --git a/docs/_docs/reference/other-new-features/indentation.md b/docs/_docs/reference/other-new-features/indentation.md index e886cb916757..46bc21e2597d 100644 --- a/docs/_docs/reference/other-new-features/indentation.md +++ b/docs/_docs/reference/other-new-features/indentation.md @@ -170,11 +170,11 @@ In each case, the `:` at the end of line can be replaced without change of meani The syntax changes allowing this are as follows: -```ebnf -Template ::= InheritClauses [colonEol] [TemplateBody] ; -EnumDef ::= id ClassConstr InheritClauses [colonEol] EnumBody ; -Packaging ::= ‘package’ QualId [nl | colonEol] ‘{’ TopStatSeq ‘}’ ; -SimpleExpr ::= ‘new’ ConstrApp {‘with’ ConstrApp} [[colonEol] TemplateBody] ; +``` +Template ::= InheritClauses [colonEol] [TemplateBody] +EnumDef ::= id ClassConstr InheritClauses [colonEol] EnumBody +Packaging ::= ‘package’ QualId [nl | colonEol] ‘{’ TopStatSeq ‘}’ +SimpleExpr ::= ‘new’ ConstrApp {‘with’ ConstrApp} [[colonEol] TemplateBody] ``` Here, `colonEol` stands for ": at end of line", as described above. @@ -372,13 +372,13 @@ If none of these criteria apply, it's often better to not use an end marker sinc #### Syntax -```ebnf -EndMarker ::= ‘end’ EndMarkerTag -- when followed by EOL ; +``` +EndMarker ::= ‘end’ EndMarkerTag -- when followed by EOL EndMarkerTag ::= id | ‘if’ | ‘while’ | ‘for’ | ‘match’ | ‘try’ - | ‘new’ | ‘this’ | ‘given’ | ‘extension’ | ‘val’ ; -BlockStat ::= ... | EndMarker ; -TemplateStat ::= ... | EndMarker ; -TopStat ::= ... | EndMarker ; + | ‘new’ | ‘this’ | ‘given’ | ‘extension’ | ‘val’ +BlockStat ::= ... | EndMarker +TemplateStat ::= ... | EndMarker +TopStat ::= ... | EndMarker ``` ### Example diff --git a/docs/_docs/reference/other-new-features/opaques-details.md b/docs/_docs/reference/other-new-features/opaques-details.md index 9508f517710c..83608ca78dd3 100644 --- a/docs/_docs/reference/other-new-features/opaques-details.md +++ b/docs/_docs/reference/other-new-features/opaques-details.md @@ -6,9 +6,9 @@ movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features/opaques ## Syntax -```ebnf +``` Modifier ::= ... - | ‘opaque’ ; + | ‘opaque’ ``` `opaque` is a [soft modifier](../soft-modifier.md). It can still be used as a normal identifier when it is not in front of a definition keyword.