This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Starts all workers at once and executes the given afterFinish | |
* callback when all workers have completed. Workers are expected | |
* to signal when they are finished. | |
* | |
* @example | |
* | |
* WorkerGroup( | |
* [ function(whenDone) { $.ajax({url: 'http://jquery.com/a/', error: whenDone, success: whenDone}); } | |
* , function(whenDone) { $.ajax({url: 'http://jquery.com/b/', error: whenDone, success: whenDone}); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Unfold { | |
/** | |
* Builds a list by recursively applying `f`, until `f` returns None | |
* | |
* @param seed the initial value passed to `f` | |
* @param f returns Some(Pair(element, nextSeed)) where `element` is added | |
* to the list and `nextSeed` is passed to `f` on the next invocation. | |
*/ | |
def buildList[T, R](seed: T)(f: T => Option[Pair[R, T]]): List[R] = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait SqlParser extends scala.util.parsing.combinator.RegexParsers { | |
// ignore ordinary whitespace, line comments, and inline comments between combinators | |
override val whiteSpace = "(?sm)(\\s*(?:--.*?$|/\\*((?!\\*/).)*\\*/)\\s*|\\s+)+".r | |
def sqlStatement: Parser[Statement] = | |
opt(whiteSpace) ~> positioned( procedureCallStatement | |
| insertStatementCustom | |
| insertStatement | |
| updateStatement |
NewerOlder