Skip to content
This repository has been archived by the owner on Mar 23, 2018. It is now read-only.
/ scala-commas Public archive

A compiler plugin to add support for trailing commas in Scala 2.11

License

Notifications You must be signed in to change notification settings

47degrees/scala-commas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Commas

A Scala compiler plugin that adds support for trailing commas.

Usage

Currently only a snapshot is available.

resolvers += Opts.resolver.sonatypeSnapshots
addCompilerPlugin("fail.sauce" %% "commas" % "0.1.1-SNAPSHOT")

Now you can leave trailing commas in your import selectors and argument lists.

import scala.collection.immutable.{ Seq, Set, List, }

val foo = List(
  "A",
  "B",
  "C",
)

Why?

This is currently a proof of concept, for fun.

How?

The plugin hijacks the parser phase and replaces it with a customized parser that allows trailing commas in some scenarios. The hijacking is done with a mixture of reflection and carefully overridden fields. Paul Phillips' fork of Scala provided the basis for the parser changes.

License

See COPYING and also:

About

A compiler plugin to add support for trailing commas in Scala 2.11

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages