diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/05-classes-and-objects.md | 64 | ||||
-rw-r--r-- | spec/06-expressions.md | 105 | ||||
-rw-r--r-- | spec/08-pattern-matching.md | 24 | ||||
-rw-r--r-- | spec/10-xml-expressions-and-patterns.md | 4 | ||||
-rw-r--r-- | spec/13-syntax-summary.md | 26 | ||||
-rw-r--r-- | spec/README.md | 2 | ||||
-rw-r--r-- | spec/_config.yml | 2 | ||||
-rw-r--r-- | spec/_layouts/default.yml | 2 | ||||
-rw-r--r-- | spec/_layouts/toc.yml | 4 | ||||
-rw-r--r-- | spec/id_dsa_travis.enc | 83 |
10 files changed, 185 insertions, 131 deletions
diff --git a/spec/05-classes-and-objects.md b/spec/05-classes-and-objects.md index d1a1a8739d..739fd28eb1 100644 --- a/spec/05-classes-and-objects.md +++ b/spec/05-classes-and-objects.md @@ -7,9 +7,9 @@ chapter: 5 # Classes and Objects ```ebnf -TmplDef ::= [`case'] `class' ClassDef - | [`case'] `object' ObjectDef - | `trait' TraitDef +TmplDef ::= [‘case’] ‘class’ ClassDef + | [‘case’] ‘object’ ObjectDef + | ‘trait’ TraitDef ``` [Classes](#class-definitions) and [objects](#object-definitions) @@ -20,11 +20,11 @@ are both defined in terms of _templates_. ```ebnf ClassTemplate ::= [EarlyDefs] ClassParents [TemplateBody] TraitTemplate ::= [EarlyDefs] TraitParents [TemplateBody] -ClassParents ::= Constr {`with' AnnotType} -TraitParents ::= AnnotType {`with' AnnotType} -TemplateBody ::= [nl] `{' [SelfType] TemplateStat {semi TemplateStat} `}' -SelfType ::= id [`:' Type] `=>' - | this `:' Type `=>' +ClassParents ::= Constr {‘with’ AnnotType} +TraitParents ::= AnnotType {‘with’ AnnotType} +TemplateBody ::= [nl] ‘{’ [SelfType] TemplateStat {semi TemplateStat} ‘}’ +SelfType ::= id [‘:’ Type] ‘=>’ + | this ‘:’ Type ‘=>’ ``` A _template_ defines the type signature, behavior and initial state of a @@ -145,7 +145,7 @@ def delayedInit(body: => Unit) ### Constructor Invocations ```ebnf -Constr ::= AnnotType {`(' [Exprs] `)'} +Constr ::= AnnotType {‘(’ [Exprs] ‘)’} ``` Constructor invocations define the type, members, and initial state of @@ -410,7 +410,7 @@ necessary to make subtyping decidable[^kennedy]). ### Early Definitions ```ebnf -EarlyDefs ::= `{' [EarlyDef {semi EarlyDef}] `}' `with' +EarlyDefs ::= ‘{’ [EarlyDef {semi EarlyDef}] ‘}’ ‘with’ EarlyDef ::= {Annotation} {Modifier} PatVarDef ``` @@ -478,14 +478,14 @@ body, it would be initialized after the constructor of ```ebnf Modifier ::= LocalModifier | AccessModifier - | `override' -LocalModifier ::= `abstract' - | `final' - | `sealed' - | `implicit' - | `lazy' -AccessModifier ::= (`private' | `protected') [AccessQualifier] -AccessQualifier ::= `[' (id | `this') `]' + | ‘override’ +LocalModifier ::= ‘abstract’ + | ‘final’ + | ‘sealed’ + | ‘implicit’ + | ‘lazy’ +AccessModifier ::= (‘private’ | ‘protected’) [AccessQualifier] +AccessQualifier ::= ‘[’ (id | ‘this’) ‘]’ ``` Member definitions may be preceded by modifiers which affect the @@ -668,16 +668,16 @@ constructor `private` ([example](#example-private-constructor)). ## Class Definitions ```ebnf -TmplDef ::= `class' ClassDef +TmplDef ::= ‘class’ ClassDef ClassDef ::= id [TypeParamClause] {Annotation} [AccessModifier] ClassParamClauses ClassTemplateOpt ClassParamClauses ::= {ClassParamClause} - [[nl] `(' implicit ClassParams `)'] -ClassParamClause ::= [nl] `(' [ClassParams] ')' -ClassParams ::= ClassParam {`,' ClassParam} -ClassParam ::= {Annotation} {Modifier} [(`val' | `var')] - id [`:' ParamType] [`=' Expr] -ClassTemplateOpt ::= `extends' ClassTemplate | [[`extends'] TemplateBody] + [[nl] ‘(’ implicit ClassParams ‘)’] +ClassParamClause ::= [nl] ‘(’ [ClassParams] ‘)’ +ClassParams ::= ClassParam {‘,’ ClassParam} +ClassParam ::= {Annotation} {Modifier} [(‘val’ | ‘var’)] + id [‘:’ ParamType] [‘=’ Expr] +ClassTemplateOpt ::= ‘extends’ ClassTemplate | [[‘extends’] TemplateBody] ``` The most general form of class definition is @@ -768,12 +768,12 @@ class Sensitive private () { ### Constructor Definitions ```ebnf -FunDef ::= `this' ParamClause ParamClauses - (`=' ConstrExpr | [nl] ConstrBlock) +FunDef ::= ‘this’ ParamClause ParamClauses + (‘=’ ConstrExpr | [nl] ConstrBlock) ConstrExpr ::= SelfInvocation | ConstrBlock -ConstrBlock ::= `{' SelfInvocation {semi BlockStat} `}' -SelfInvocation ::= `this' ArgumentExprs {ArgumentExprs} +ConstrBlock ::= ‘{’ SelfInvocation {semi BlockStat} ‘}’ +SelfInvocation ::= ‘this’ ArgumentExprs {ArgumentExprs} ``` A class may have additional constructors besides the primary @@ -836,7 +836,7 @@ third one constructs a list with a given head and tail. ### Case Classes ```ebnf -TmplDef ::= `case' `class' ClassDef +TmplDef ::= ‘case’ ‘class’ ClassDef ``` If a class definition is prefixed with `case`, the class is said @@ -967,9 +967,9 @@ directly extend `Expr` must be in the same source file as ## Traits ```ebnf -TmplDef ::= `trait' TraitDef +TmplDef ::= ‘trait’ TraitDef TraitDef ::= id [TypeParamClause] TraitTemplateOpt -TraitTemplateOpt ::= `extends' TraitTemplate | [[`extends'] TemplateBody] +TraitTemplateOpt ::= ‘extends’ TraitTemplate | [[‘extends’] TemplateBody] ``` A _trait_ is a class that is meant to be added to some other class diff --git a/spec/06-expressions.md b/spec/06-expressions.md index 2b238d149a..30fd94c1a8 100644 --- a/spec/06-expressions.md +++ b/spec/06-expressions.md @@ -7,44 +7,44 @@ chapter: 6 # Expressions ```ebnf -Expr ::= (Bindings | id | `_') `=>' Expr +Expr ::= (Bindings | id | ‘_’) ‘=>’ Expr | Expr1 -Expr1 ::= `if' `(' Expr `)' {nl} Expr [[semi] `else' Expr] - | `while' `(' Expr `)' {nl} Expr - | `try' (`{' Block `}' | Expr) [`catch' `{' CaseClauses `}'] [`finally' Expr] - | `do' Expr [semi] `while' `(' Expr ')' - | `for' (`(' Enumerators `)' | `{' Enumerators `}') {nl} [`yield'] Expr - | `throw' Expr - | `return' [Expr] - | [SimpleExpr `.'] id `=' Expr - | SimpleExpr1 ArgumentExprs `=' Expr +Expr1 ::= ‘if’ ‘(’ Expr ‘)’ {nl} Expr [[semi] ‘else’ Expr] + | ‘while’ ‘(’ Expr ‘)’ {nl} Expr + | ‘try’ (‘{’ Block ‘}’ | Expr) [‘catch’ ‘{’ CaseClauses ‘}’] [‘finally’ Expr] + | ‘do’ Expr [semi] ‘while’ ‘(’ Expr ‘)’ + | ‘for’ (‘(’ Enumerators ‘)’ | ‘{’ Enumerators ‘}’) {nl} [‘yield’] Expr + | ‘throw’ Expr + | ‘return’ [Expr] + | [SimpleExpr ‘.’] id ‘=’ Expr + | SimpleExpr1 ArgumentExprs ‘=’ Expr | PostfixExpr | PostfixExpr Ascription - | PostfixExpr `match' `{' CaseClauses `}' + | PostfixExpr ‘match’ ‘{’ CaseClauses ‘}’ PostfixExpr ::= InfixExpr [id [nl]] InfixExpr ::= PrefixExpr | InfixExpr id [nl] InfixExpr -PrefixExpr ::= [`-' | `+' | `~' | `!'] SimpleExpr -SimpleExpr ::= `new' (ClassTemplate | TemplateBody) +PrefixExpr ::= [‘-’ | ‘+’ | ‘~’ | ‘!’] SimpleExpr +SimpleExpr ::= ‘new’ (ClassTemplate | TemplateBody) | BlockExpr - | SimpleExpr1 [`_'] + | SimpleExpr1 [‘_’] SimpleExpr1 ::= Literal | Path - | `_' - | `(' [Exprs] `)' - | SimpleExpr `.' id s + | ‘_’ + | ‘(’ [Exprs] ‘)’ + | SimpleExpr ‘.’ id s | SimpleExpr TypeArgs | SimpleExpr1 ArgumentExprs | XmlExpr -Exprs ::= Expr {`,' Expr} +Exprs ::= Expr {‘,’ Expr} BlockExpr ::= ‘{’ CaseClauses ‘}’ | ‘{’ Block ‘}’ Block ::= BlockStat {semi BlockStat} [ResultExpr] ResultExpr ::= Expr1 - | (Bindings | ([`implicit'] id | `_') `:' CompoundType) `=>' Block -Ascription ::= `:' InfixType - | `:' Annotation {Annotation} - | `:' `_' `*' + | (Bindings | ([‘implicit’] id | ‘_’) ‘:’ CompoundType) ‘=>’ Block +Ascription ::= ‘:’ InfixType + | ‘:’ Annotation {Annotation} + | ‘:’ ‘_’ ‘*’ ``` Expressions are composed of operators and operands. Expression forms are @@ -100,7 +100,7 @@ A reference to any other member of the "null" object causes a ```ebnf SimpleExpr ::= Path - | SimpleExpr `.' id + | SimpleExpr ‘.’ id ``` A designator refers to a named term. It can be a _simple name_ or @@ -151,8 +151,8 @@ by a definition overriding $m$. ## This and Super ```ebnf -SimpleExpr ::= [id `.'] `this' - | [id '.'] `super' [ClassQualifier] `.' id +SimpleExpr ::= [id ‘.’] ‘this’ + | [id ‘.’] ‘super’ [ClassQualifier] ‘.’ id ``` The expression `this` can appear in the statement part of a @@ -234,10 +234,10 @@ depending on whether `B` is mixed in with class `Root` or `A`. ```ebnf SimpleExpr ::= SimpleExpr1 ArgumentExprs -ArgumentExprs ::= `(' [Exprs] `)' - | `(' [Exprs `,'] PostfixExpr `:' `_' `*' ')' +ArgumentExprs ::= ‘(’ [Exprs] ‘)’ + | ‘(’ [Exprs ‘,’] PostfixExpr ‘:’ ‘_’ ‘*’ ‘)’ | [nl] BlockExpr -Exprs ::= Expr {`,' Expr} +Exprs ::= Expr {‘,’ Expr} ``` An application `$f(e_1 , \ldots , e_m)$` applies the function `$f$` to the argument expressions `$e_1, \ldots , e_m$`. For this expression to be well-typed, the function must be *applicable* to its arguments, which is defined next by case analysis on $f$'s type. @@ -406,7 +406,7 @@ On the Java platform version 7 and later, the methods `invoke` and `invokeExact` ## Method Values ```ebnf -SimpleExpr ::= SimpleExpr1 `_' +SimpleExpr ::= SimpleExpr1 ‘_’ ``` The expression `$e$ _` is well-formed if $e$ is of method @@ -461,7 +461,7 @@ and the expected result type. ## Tuples ```ebnf -SimpleExpr ::= `(' [Exprs] `)' +SimpleExpr ::= ‘(’ [Exprs] ‘)’ ``` A _tuple expression_ `($e_1 , \ldots , e_n$)` is an alias @@ -473,7 +473,7 @@ The empty tuple ## Instance Creation Expressions ```ebnf -SimpleExpr ::= `new' (ClassTemplate | TemplateBody) +SimpleExpr ::= ‘new’ (ClassTemplate | TemplateBody) ``` A _simple instance creation expression_ is of the form @@ -605,7 +605,7 @@ the existentially quantified type PostfixExpr ::= InfixExpr [id [nl]] InfixExpr ::= PrefixExpr | InfixExpr id [nl] InfixExpr -PrefixExpr ::= [`-' | `+' | `!' | `~'] SimpleExpr +PrefixExpr ::= [‘-’ | ‘+’ | ‘!’ | ‘~’] SimpleExpr ``` Expressions can be constructed from operands and operators. @@ -735,7 +735,7 @@ The re-interpretation occurs if the following two conditions are fulfilled. ## Typed Expressions ```ebnf -Expr1 ::= PostfixExpr `:' CompoundType +Expr1 ::= PostfixExpr ‘:’ CompoundType ``` The _typed expression_ $e: T$ has type $T$. The type of @@ -754,7 +754,7 @@ Here are examples of well-typed and ill-typed expressions. ## Annotated Expressions ```ebnf -Expr1 ::= PostfixExpr `:' Annotation {Annotation} +Expr1 ::= PostfixExpr ‘:’ Annotation {Annotation} ``` An _annotated expression_ `$e$: @$a_1$ $\ldots$ @$a_n$` @@ -764,8 +764,8 @@ expression $e$. ## Assignments ```ebnf -Expr1 ::= [SimpleExpr `.'] id `=' Expr - | SimpleExpr1 ArgumentExprs `=' Expr +Expr1 ::= [SimpleExpr ‘.’] id ‘=’ Expr + | SimpleExpr1 ArgumentExprs ‘=’ Expr ``` The interpretation of an assignment to a simple variable `$x$ = $e$` @@ -849,7 +849,7 @@ def matmul(xss: Array[Array[Double]], yss: Array[Array[Double]]) = { ## Conditional Expressions ```ebnf -Expr1 ::= `if' `(' Expr `)' {nl} Expr [[semi] `else' Expr] +Expr1 ::= ‘if’ ‘(’ Expr ‘)’ {nl} Expr [[semi] ‘else’ Expr] ``` The _conditional expression_ `if ($e_1$) $e_2$ else $e_3$` chooses @@ -875,7 +875,7 @@ evaluated as if it was `if ($e_1$) $e_2$ else ()`. ## While Loop Expressions ```ebnf -Expr1 ::= `while' `(' Expr ')' {nl} Expr +Expr1 ::= ‘while’ ‘(’ Expr ‘)’ {nl} Expr ``` The _while loop expression_ `while ($e_1$) $e_2$` is typed and @@ -890,7 +890,7 @@ def whileLoop(cond: => Boolean)(body: => Unit): Unit = ## Do Loop Expressions ```ebnf -Expr1 ::= `do' Expr [semi] `while' `(' Expr ')' +Expr1 ::= ‘do’ Expr [semi] ‘while’ ‘(’ Expr ‘)’ ``` The _do loop expression_ `do $e_1$ while ($e_2$)` is typed and @@ -900,11 +900,11 @@ A semicolon preceding the `while` symbol of a do loop expression is ignored. ## For Comprehensions and For Loops ```ebnf -Expr1 ::= `for' (`(' Enumerators `)' | `{' Enumerators `}') - {nl} [`yield'] Expr +Expr1 ::= ‘for’ (‘(’ Enumerators ‘)’ | ‘{’ Enumerators ‘}’) + {nl} [‘yield’] Expr Enumerators ::= Generator {semi Generator} -Generator ::= Pattern1 `<-' Expr {[semi] Guard | semi Pattern1 `=' Expr} -Guard ::= `if' PostfixExpr +Generator ::= Pattern1 ‘<-’ Expr {[semi] Guard | semi Pattern1 ‘=’ Expr} +Guard ::= ‘if’ PostfixExpr ``` A _for loop_ `for ($\mathit{enums}\,$) $e$` executes expression $e$ @@ -1048,7 +1048,7 @@ The code above makes use of the fact that `map`, `flatMap`, ## Return Expressions ```ebnf -Expr1 ::= `return' [Expr] +Expr1 ::= ‘return’ [Expr] ``` A _return expression_ `return $e$` must occur inside the body of some @@ -1085,7 +1085,7 @@ and will propagate up the call stack. ## Throw Expressions ```ebnf -Expr1 ::= `throw' Expr +Expr1 ::= ‘throw’ Expr ``` A _throw expression_ `throw $e$` evaluates the expression @@ -1102,8 +1102,8 @@ is `scala.Nothing`. ## Try Expressions ```ebnf -Expr1 ::= `try' (`{' Block `}' | Expr) [`catch' `{' CaseClauses `}'] - [`finally' Expr] +Expr1 ::= ‘try’ (‘{’ Block ‘}’ | Expr) [‘catch’ ‘{’ CaseClauses ‘}’] + [‘finally’ Expr] ``` A _try expression_ is of the form `try { $b$ } catch $h$` @@ -1154,10 +1154,10 @@ for `try { try { $b$ } catch $e_1$ } finally $e_2$`. ## Anonymous Functions ```ebnf -Expr ::= (Bindings | [`implicit'] id | `_') `=>' Expr -ResultExpr ::= (Bindings | ([`implicit'] id | `_') `:' CompoundType) `=>' Block -Bindings ::= `(' Binding {`,' Binding} `)' -Binding ::= (id | `_') [`:' Type] +Expr ::= (Bindings | [‘implicit’] id | ‘_’) ‘=>’ Expr +ResultExpr ::= (Bindings | ([‘implicit’] id | ‘_’) ‘:’ CompoundType) ‘=>’ Block +Bindings ::= ‘(’ Binding {‘,’ Binding} ‘)’ +Binding ::= (id | ‘_’) [‘:’ Type] ``` The anonymous function of arity $n$, `($x_1$: $T_1 , \ldots , x_n$: $T_n$) => e` maps parameters $x_i$ of types $T_i$ to a result given by expression $e$. The scope of each formal parameter $x_i$ is $e$. Formal parameters must have pairwise distinct names. @@ -1215,7 +1215,7 @@ _ => 5 // The function that ignores its argument ### Placeholder Syntax for Anonymous Functions ```ebnf -SimpleExpr1 ::= `_' +SimpleExpr1 ::= ‘_’ ``` An expression (of syntactic category `Expr`) @@ -1361,6 +1361,7 @@ Note that a function literal that targets a SAM is not necessarily compiled to t It follows that: - if class `C` defines a constructor, it must be accessible and must define exactly one, empty, argument list; + - class `C` cannot be `final` or `sealed` (for simplicity we ignore the possibility of SAM conversion in the same compilation unit as the sealed class); - `m` cannot be polymorphic; - it must be possible to derive a fully-defined type `U` from `S` by inferring any unknown type parameters of `C`. diff --git a/spec/08-pattern-matching.md b/spec/08-pattern-matching.md index 00f9099bea..38eabf29c5 100644 --- a/spec/08-pattern-matching.md +++ b/spec/08-pattern-matching.md @@ -56,7 +56,7 @@ patterns. ### Variable Patterns ```ebnf - SimplePattern ::= `_' + SimplePattern ::= ‘_’ | varid ``` @@ -69,8 +69,8 @@ which is treated as if it was a fresh variable on each occurrence. ### Typed Patterns ```ebnf - Pattern1 ::= varid `:' TypePat - | `_' `:' TypePat + Pattern1 ::= varid ‘:’ TypePat + | ‘_’ ‘:’ TypePat ``` A _typed pattern_ $x: T$ consists of a pattern variable $x$ and a @@ -83,7 +83,7 @@ that value. ### Pattern Binders ```ebnf - Pattern2 ::= varid `@' Pattern3 + Pattern2 ::= varid ‘@’ Pattern3 ``` A _pattern binder_ `$x$@$p$` consists of a pattern variable $x$ and a @@ -144,7 +144,7 @@ argument of `f` are equal. ### Constructor Patterns ```ebnf -SimplePattern ::= StableId `(' [Patterns] `) +SimplePattern ::= StableId ‘(’ [Patterns] ‘)’ ``` A _constructor pattern_ is of the form $c(p_1 , \ldots , p_n)$ where $n @@ -170,7 +170,7 @@ repeated parameter. This is further discussed [here](#pattern-sequences). ### Tuple Patterns ```ebnf - SimplePattern ::= `(' [Patterns] `)' + SimplePattern ::= ‘(’ [Patterns] ‘)’ ``` A _tuple pattern_ `($p_1 , \ldots , p_n$)` is an alias @@ -181,7 +181,7 @@ where $n \geq 2$. The empty tuple ### Extractor Patterns ```ebnf - SimplePattern ::= StableId `(' [Patterns] `)' + SimplePattern ::= StableId ‘(’ [Patterns] ‘)’ ``` An _extractor pattern_ $x(p_1 , \ldots , p_n)$ where $n \geq 0$ is of @@ -241,7 +241,7 @@ val y = x match { ### Pattern Sequences ```ebnf -SimplePattern ::= StableId `(' [Patterns `,'] [varid `@'] `_' `*' `)' +SimplePattern ::= StableId ‘(’ [Patterns ‘,’] [varid ‘@’] ‘_’ ‘*’ ‘)’ ``` A _pattern sequence_ $p_1 , \ldots , p_n$ appears in two contexts. @@ -277,7 +277,7 @@ shorthand for the constructor or extractor pattern $\mathit{op}(p, q_1 ### Pattern Alternatives ```ebnf - Pattern ::= Pattern1 { `|' Pattern1 } + Pattern ::= Pattern1 { ‘|’ Pattern1 } ``` A _pattern alternative_ `$p_1$ | $\ldots$ | $p_n$` @@ -521,9 +521,9 @@ function's declared result type, `Number`. ## Pattern Matching Expressions ```ebnf - Expr ::= PostfixExpr `match' `{' CaseClauses `}' + Expr ::= PostfixExpr ‘match’ ‘{’ CaseClauses ‘}’ CaseClauses ::= CaseClause {CaseClause} - CaseClause ::= `case' Pattern [Guard] `=>' Block + CaseClause ::= ‘case’ Pattern [Guard] ‘=>’ Block ``` A _pattern matching expression_ @@ -638,7 +638,7 @@ conforms to its expected type, `T`. ## Pattern Matching Anonymous Functions ```ebnf - BlockExpr ::= `{' CaseClauses `}' + BlockExpr ::= ‘{’ CaseClauses ‘}’ ``` An anonymous function can be defined by a sequence of cases diff --git a/spec/10-xml-expressions-and-patterns.md b/spec/10-xml-expressions-and-patterns.md index b70fb86471..ea93cc8d8e 100644 --- a/spec/10-xml-expressions-and-patterns.md +++ b/spec/10-xml-expressions-and-patterns.md @@ -76,8 +76,8 @@ AttValue ::= ‘"’ {CharQ | CharRef} ‘"’ ScalaExpr ::= Block -CharData ::= { CharNoRef } $\textit{ without}$ {CharNoRef}`{'CharB {CharNoRef} - $\textit{ and without}$ {CharNoRef}`]]>'{CharNoRef} +CharData ::= { CharNoRef } $\textit{ without}$ {CharNoRef}‘{’CharB {CharNoRef} + $\textit{ and without}$ {CharNoRef}‘]]>’{CharNoRef} ``` <!-- {% raw %} stupid liquid borks on the double brace below; brace yourself, liquid! --> diff --git a/spec/13-syntax-summary.md b/spec/13-syntax-summary.md index 44c481f9f6..dd042824f4 100644 --- a/spec/13-syntax-summary.md +++ b/spec/13-syntax-summary.md @@ -11,7 +11,7 @@ The following descriptions of Scala tokens uses literal characters `‘c’` whe _Unicode escapes_ are used to represent the Unicode character with the given hexadecimal code: ```ebnf -UnicodeEscape ::= ‘\‘ ‘u‘ {‘u‘} hexDigit hexDigit hexDigit hexDigit +UnicodeEscape ::= ‘\’ ‘u’ {‘u’} hexDigit hexDigit hexDigit hexDigit hexDigit ::= ‘0’ | … | ‘9’ | ‘A’ | … | ‘F’ | ‘a’ | … | ‘f’ ``` @@ -30,7 +30,7 @@ delim ::= ‘`’ | ‘'’ | ‘"’ | ‘.’ | ‘;’ | ‘,’ opchar ::= // printableChar not matched by (whiteSpace | upper | lower | // letter | digit | paren | delim | opchar | Unicode_Sm | Unicode_So) printableChar ::= // all characters in [\u0020, \u007F] inclusive -charEscapeSeq ::= ‘\‘ (‘b‘ | ‘t‘ | ‘n‘ | ‘f‘ | ‘r‘ | ‘"‘ | ‘'‘ | ‘\‘) +charEscapeSeq ::= ‘\’ (‘b’ | ‘t’ | ‘n’ | ‘f’ | ‘r’ | ‘"’ | ‘'’ | ‘\’) op ::= opchar {opchar} varid ::= lower idrest @@ -129,18 +129,18 @@ grammar: Expr ::= (Bindings | [‘implicit’] id | ‘_’) ‘=>’ Expr | Expr1 - Expr1 ::= `if' `(' Expr `)' {nl} Expr [[semi] `else' Expr] - | `while' `(' Expr `)' {nl} Expr - | `try' (`{' Block `}' | Expr) [`catch' `{' CaseClauses `}'] [`finally' Expr] - | `do' Expr [semi] `while' `(' Expr `)' - | `for' (`(' Enumerators `)' | `{' Enumerators `}') {nl} [`yield'] Expr - | `throw' Expr - | `return' [Expr] - | [SimpleExpr `.'] id `=' Expr - | SimpleExpr1 ArgumentExprs `=' Expr + Expr1 ::= ‘if’ ‘(’ Expr ‘)’ {nl} Expr [[semi] ‘else’ Expr] + | ‘while’ ‘(’ Expr ‘)’ {nl} Expr + | ‘try’ (‘{’ Block ‘}’ | Expr) [‘catch’ ‘{’ CaseClauses ‘}’] [‘finally’ Expr] + | ‘do’ Expr [semi] ‘while’ ‘(’ Expr ‘)’ + | ‘for’ (‘(’ Enumerators ‘)’ | ‘{’ Enumerators ‘}’) {nl} [‘yield’] Expr + | ‘throw’ Expr + | ‘return’ [Expr] + | [SimpleExpr ‘.’] id ‘=’ Expr + | SimpleExpr1 ArgumentExprs ‘=’ Expr | PostfixExpr | PostfixExpr Ascription - | PostfixExpr `match' `{' CaseClauses `}' + | PostfixExpr ‘match’ ‘{’ CaseClauses ‘}’ PostfixExpr ::= InfixExpr [id [nl]] InfixExpr ::= PrefixExpr | InfixExpr id [nl] InfixExpr @@ -213,7 +213,7 @@ grammar: [[nl] ‘(’ ‘implicit’ ClassParams ‘)’] ClassParamClause ::= [nl] ‘(’ [ClassParams] ‘)’ ClassParams ::= ClassParam {‘,’ ClassParam} - ClassParam ::= {Annotation} {Modifier} [(`val' | `var')] + ClassParam ::= {Annotation} {Modifier} [(‘val’ | ‘var’)] id ‘:’ ParamType [‘=’ Expr] Bindings ::= ‘(’ Binding {‘,’ Binding} ‘)’ Binding ::= (id | ‘_’) [‘:’ Type] diff --git a/spec/README.md b/spec/README.md index 1a201fc97c..9fd7c9f6ae 100644 --- a/spec/README.md +++ b/spec/README.md @@ -12,7 +12,7 @@ We use Jekyll 2 and [Redcarpet](https://github.com/vmg/redcarpet) to generate th ## Building -Travis CI builds the spec automatically on every commit to master and publishes to http://www.scala-lang.org/files/archive/spec/2.11/. +Travis CI builds the spec automatically after every merged pull release and publishes to http://www.scala-lang.org/files/archive/spec/2.12/. To preview locally, run `bundle exec jekyll serve -d build/spec/ -s spec/ -w --baseurl=""` (in the root of your checkout of scala/scala), and open http://0.0.0.0:4000/. Jekyll will rebuild as you edit the markdown, but make sure to restart it when you change `_config.yml`. diff --git a/spec/_config.yml b/spec/_config.yml index 74ec602f8f..60e80ee05c 100644 --- a/spec/_config.yml +++ b/spec/_config.yml @@ -1,4 +1,4 @@ -baseurl: /files/archive/spec/2.11 +baseurl: /files/archive/spec/2.12 safe: true lsi: false highlighter: null diff --git a/spec/_layouts/default.yml b/spec/_layouts/default.yml index 7e205f8835..06d8c1c118 100644 --- a/spec/_layouts/default.yml +++ b/spec/_layouts/default.yml @@ -31,7 +31,7 @@ <body> <header> - <nav id="chapters"><a id="github" href="https://github.com/scala/scala/tree/2.11.x/spec"><img src="public/images/github-logo@2x.png" alt="Edit at Github"></a>{% assign sorted_pages = site.pages | sort:"name" %}{% for post in sorted_pages %}{% if post.chapter >= 0 %}<a href="{{site.baseurl}}{{ post.url }}">{{post.chapter}} {{ post.title }}</a>{% endif %}{% endfor %}</nav> + <nav id="chapters"><a id="github" href="https://github.com/scala/scala/tree/2.12.x/spec"><img src="public/images/github-logo@2x.png" alt="Edit at GitHub"></a>{% assign sorted_pages = site.pages | sort:"name" %}{% for post in sorted_pages %}{% if post.chapter >= 0 %}<a href="{{site.baseurl}}{{ post.url }}">{{post.chapter}} {{ post.title }}</a>{% endif %}{% endfor %}</nav> </header> <aside class="left"><nav id="toc"></nav></aside> diff --git a/spec/_layouts/toc.yml b/spec/_layouts/toc.yml index 4da7d41bea..dfd92eb114 100644 --- a/spec/_layouts/toc.yml +++ b/spec/_layouts/toc.yml @@ -19,9 +19,9 @@ <div id="header-main"> <img id="scala-logo" src="public/images/scala-spiral-white.png" /> <span id="title">Scala Language Specification</span> - <a id="github" href="https://github.com/scala/scala/tree/2.11.x/spec"><img src="public/images/github-logo@2x.png" alt="Edit at Github"></a> + <a id="github" href="https://github.com/scala/scala/tree/2.12.x/spec"><img src="public/images/github-logo@2x.png" alt="Edit at GitHub"></a> </div> - <div id="header-sub">Version 2.11</div> + <div id="header-sub">Version 2.12</div> </header> <main> {{ content }} diff --git a/spec/id_dsa_travis.enc b/spec/id_dsa_travis.enc index a9a4036807..16bbd569dc 100644 --- a/spec/id_dsa_travis.enc +++ b/spec/id_dsa_travis.enc @@ -1,15 +1,68 @@ -U2FsdGVkX1/RKhLZeL93vFQikKRRkoa3rqt6Kbs7cJStmcTI+DohoRUidRaeSULa -+xXQCwaSDs4+l1HdW2R4ZV62AVGhvIeKEZxc449c6qT9+wUd2PKkDghuJCy1dLTo -2OdFLDeop0X32bsauzPQGWwrpb/Llck4KeKffJq2257Hu6T/HnzSfDnvXbjAsVeH -ZLeXURAyDAdK9vFmFzFiEEztLkW8E3ZVyrk7Qa3GPNpmATiBdhVM8d0JJptKVgwQ -mZfhbItLrj490sPd5zpUFKAxJjPoKIa75n/+u4butn+ON97vr7xOy6ElX7HSJUgr -FJdVJgcO7lki0j+lfJVAP0zLnH80CgOkOJSq0Sso/ofs+lQIobo8fQqIdmoqV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