diff options
Diffstat (limited to 'spec/13-syntax-summary.md')
-rw-r--r-- | spec/13-syntax-summary.md | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/spec/13-syntax-summary.md b/spec/13-syntax-summary.md index 7f73e107de..be5cc1324e 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 @@ -38,7 +38,7 @@ plainid ::= upper idrest | varid | op id ::= plainid - | ‘`’ stringLiteral ‘`’ + | ‘`’ { charNoBackQuoteOrNewline | UnicodeEscape | charEscapeSeq } ‘`’ idrest ::= {letter | digit} [‘_’ op] integerLiteral ::= (decimalNumeral | hexNumeral) [‘L’ | ‘l’] @@ -57,11 +57,12 @@ floatType ::= ‘F’ | ‘f’ | ‘D’ | ‘d’ booleanLiteral ::= ‘true’ | ‘false’ -characterLiteral ::= ‘'’ (printableChar | charEscapeSeq) ‘'’ +characterLiteral ::= ‘'’ (charNoQuoteOrNewline | UnicodeEscape | charEscapeSeq) ‘'’ stringLiteral ::= ‘"’ {stringElement} ‘"’ | ‘"""’ multiLineChars ‘"""’ -stringElement ::= (printableChar except ‘"’) +stringElement ::= charNoDoubleQuoteOrNewline + | UnicodeEscape | charEscapeSeq multiLineChars ::= {[‘"’] [‘"’] charNoDoubleQuote} {‘"’} @@ -128,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 @@ -189,12 +190,12 @@ grammar: | varid | Literal | StableId - | StableId ‘(’ [Patterns ‘)’ + | StableId ‘(’ [Patterns] ‘)’ | StableId ‘(’ [Patterns ‘,’] [varid ‘@’] ‘_’ ‘*’ ‘)’ | ‘(’ [Patterns] ‘)’ | XmlPattern Patterns ::= Pattern [‘,’ Patterns] - | ‘_’ * + | ‘_’ ‘*’ TypeParamClause ::= ‘[’ VariantTypeParam {‘,’ VariantTypeParam} ‘]’ FunTypeParamClause::= ‘[’ TypeParam {‘,’ TypeParam} ‘]’ @@ -212,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] |