diff options
author | Som Snytt <som.snytt@gmail.com> | 2016-03-15 13:24:55 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2016-05-20 16:38:04 -0700 |
commit | 1e565d879360709758950332c19a77fffee073d1 (patch) | |
tree | 8378eabb74d56ff5148a01141b8269785bd64848 /src/compiler/scala/tools/nsc/ast/parser | |
parent | 2eb1cc2e3df1627cde35afa1237cb10f508fe2f2 (diff) | |
download | scala-1e565d879360709758950332c19a77fffee073d1.tar.gz scala-1e565d879360709758950332c19a77fffee073d1.tar.bz2 scala-1e565d879360709758950332c19a77fffee073d1.zip |
SI-8044 Allow any id in explicit pattern binding
Allows arbitrary identifier in `X @ pat`, including
non-varids. This goes to regularity.
Users of this syntax are not likely to be confused
by the "backquoted var id is stable" rule.
Also for sequence pattern, `X @ _*`.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 1e239f91a6..abfb6ae679 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -1922,10 +1922,9 @@ self => } /** {{{ - * Pattern2 ::= boundvarid [ @ Pattern3 ] + * Pattern2 ::= id @ Pattern3 + * | `_' @ Pattern3 * | Pattern3 - * SeqPattern2 ::= boundvarid [ @ SeqPattern3 ] - * | SeqPattern3 * }}} */ def pattern2(): Tree = { @@ -1936,7 +1935,7 @@ self => case Ident(nme.WILDCARD) => in.nextToken() pattern3() - case Ident(name) if nme.isVariableName(name) => + case Ident(name) => in.nextToken() atPos(p.pos.start) { Bind(name, pattern3()) } case _ => p |