diff options
author | Dale Wijnand <dale.wijnand@gmail.com> | 2016-12-10 14:05:30 +0000 |
---|---|---|
committer | Dale Wijnand <dale.wijnand@gmail.com> | 2016-12-11 00:04:04 +0000 |
commit | 7966edd724b1e1019d3f8466318bc5f4b341abab (patch) | |
tree | ba7ba89dbbfabe91193e2a3e3d800008ebe2c57c /src/compiler/scala/tools | |
parent | 3de1c0c56ee530f4e75533fc9e1909fe0cde31b5 (diff) | |
download | scala-7966edd724b1e1019d3f8466318bc5f4b341abab.tar.gz scala-7966edd724b1e1019d3f8466318bc5f4b341abab.tar.bz2 scala-7966edd724b1e1019d3f8466318bc5f4b341abab.zip |
SI-4986 SIP-27 Trailing Comma (multi-line only) support
Diffstat (limited to 'src/compiler/scala/tools')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Scanners.scala | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala index a8cc7f91c2..9862340c04 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala @@ -386,6 +386,14 @@ trait Scanners extends ScannersCommon { next copyFrom this this copyFrom prev } + } else if (token == COMMA) { + // SIP-27 Trailing Comma (multi-line only) support + // If a comma is followed by a new line & then a closing paren, bracket or brace + // then it is a trailing comma and is ignored + val saved = new ScannerData {} copyFrom this + fetchToken() + if (token != RPAREN && token != RBRACKET && token != RBRACE || !afterLineEnd()) + this copyFrom saved } // print("["+this+"]") |