Created
February 4, 2014 18:11
-
-
Save paulp/8809154 to your computer and use it in GitHub Desktop.
This file contains 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
"compute FIRST for binary alternatives" in check { (left: String, right: String) => | |
import com.codecommit.util._ | |
val leftFirst = if (left.length == 0) Set[Char]() else Set(left charAt 0) | |
val rightFirst = if (right.length == 0) Set[Char]() else Set(right charAt 0) | |
if (leftFirst.size == 0 || rightFirst.size == 0) | |
(left | right).first eq UniversalCharSet | |
else | |
(left | right).first == (leftFirst ++ rightFirst) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment