summaryrefslogtreecommitdiff
path: root/08-expressions.md
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2014-03-12 16:24:33 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2014-03-12 16:24:33 -0700
commit5135bae5a7c2d156dd55dfc0aabf8b41d393f4a2 (patch)
tree4252110425faa4046b4705330ff4c575cf867f70 /08-expressions.md
parent32e0943c02a3bdf9e57e87b6e0c0ee55da9194e2 (diff)
downloadscala-5135bae5a7c2d156dd55dfc0aabf8b41d393f4a2.tar.gz
scala-5135bae5a7c2d156dd55dfc0aabf8b41d393f4a2.tar.bz2
scala-5135bae5a7c2d156dd55dfc0aabf8b41d393f4a2.zip
SI-5086 clean up EBNF
- sequences of block statements were wrong (btw, note that BlockStat matches the empty sequence of tokens) - lexical syntax was pretty messy: clarified, removed extraneous backslashes
Diffstat (limited to '08-expressions.md')
-rw-r--r--08-expressions.md85
1 files changed, 43 insertions, 42 deletions
diff --git a/08-expressions.md b/08-expressions.md
index 6ab149cfc1..1eed192cc8 100644
--- a/08-expressions.md
+++ b/08-expressions.md
@@ -1,44 +1,44 @@
# Expressions
```
- 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
- | PostfixExpr
- | PostfixExpr Ascription
- | PostfixExpr `match' `{' CaseClauses `}'
- PostfixExpr ::= InfixExpr [id [nl]]
- InfixExpr ::= PrefixExpr
- | InfixExpr id [nl] InfixExpr
- PrefixExpr ::= [`-' | `+' | `~' | `!'] SimpleExpr
- SimpleExpr ::= `new' (ClassTemplate | TemplateBody)
- | BlockExpr
- | SimpleExpr1 [`_']
- SimpleExpr1 ::= Literal
- | Path
- | `_'
- | `(' [Exprs] `)'
- | SimpleExpr `.' id s
- | SimpleExpr TypeArgs
- | SimpleExpr1 ArgumentExprs
- | XmlExpr
- Exprs ::= Expr {`,' Expr}
- BlockExpr ::= `{' CaseClauses `}'
- | `{' Block `}'
- Block ::= {BlockStat semi} [ResultExpr]
- ResultExpr ::= Expr1
- | (Bindings | ([`implicit'] id | `_') `:' CompoundType) `=>' Block
- Ascription ::= `:' InfixType
- | `:' Annotation {Annotation}
- | `:' `_' `*'
+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
+ | PostfixExpr
+ | PostfixExpr Ascription
+ | PostfixExpr `match' `{' CaseClauses `}'
+PostfixExpr ::= InfixExpr [id [nl]]
+InfixExpr ::= PrefixExpr
+ | InfixExpr id [nl] InfixExpr
+PrefixExpr ::= [`-' | `+' | `~' | `!'] SimpleExpr
+SimpleExpr ::= `new' (ClassTemplate | TemplateBody)
+ | BlockExpr
+ | SimpleExpr1 [`_']
+SimpleExpr1 ::= Literal
+ | Path
+ | `_'
+ | `(' [Exprs] `)'
+ | SimpleExpr `.' id s
+ | SimpleExpr TypeArgs
+ | SimpleExpr1 ArgumentExprs
+ | XmlExpr
+Exprs ::= Expr {`,' Expr}
+BlockExpr ::= ‘{’ CaseClauses ‘}’
+ | ‘{’ Block ‘}’
+Block ::= BlockStat {semi BlockStat} [ResultExpr]
+ResultExpr ::= Expr1
+ | (Bindings | ([`implicit'] id | `_') `:' CompoundType) `=>' Block
+Ascription ::= `:' InfixType
+ | `:' Annotation {Annotation}
+ | `:' `_' `*'
```
Expressions are composed of operators and operands. Expression forms are
@@ -558,8 +558,9 @@ where `anon\$X` is some freshly created name.
## Blocks
```
-BlockExpr ::= `{' Block `}'
-Block ::= {BlockStat semi} [ResultExpr]
+BlockExpr ::= ‘{’ CaseClauses ‘}’
+ | ‘{’ Block ‘}’
+Block ::= BlockStat {semi BlockStat} [ResultExpr]
```
A block expression `{$s_1$; $\ldots$; $s_n$; $e\,$}` is
@@ -1319,10 +1320,10 @@ include at least the expressions of the following forms:
```
BlockStat ::= Import
- | {Annotation} [`implicit'] Def
+ | {Annotation} [‘implicit’ | ‘lazy’] Def
| {Annotation} {LocalModifier} TmplDef
| Expr1
- |
+ |
TemplateStat ::= Import
| {Annotation} {Modifier} Def
| {Annotation} {Modifier} Dcl