Created
May 25, 2019 06:49
-
-
Save karthik20522/853fab15bee528a4c554365da27a2acb to your computer and use it in GitHub Desktop.
select age from users where age>30
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
def where: Parser[Where] = "where" ~> rep(predicate) ^^ (Where(_: _*)) | |
def predicate = ( | |
ident ~ "=" ~ wholeNumber ^^ { case f ~ "=" ~ i => NumberEquals(f, i.toInt) } | |
| ident ~ "<" ~ wholeNumber ^^ { case f ~ "<" ~ i => LessThan(f, i.toInt) } | |
| ident ~ ">" ~ wholeNumber ^^ { case f ~ ">" ~ i => GreaterThan(f, i.toInt) }) | |
//output: GreaterThan("age", 30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment