Skip to content

Instantly share code, notes, and snippets.

@gszeliga
Created May 22, 2014 21:48
Show Gist options
  • Save gszeliga/584c07065e1c58ae0820 to your computer and use it in GitHub Desktop.
Save gszeliga/584c07065e1c58ae0820 to your computer and use it in GitHub Desktop.
def list: Parser[BList] = {
delimitedBy(LIST_BEGIN, LIST_END) {
rep(string | int | list | dict)
} ^^ (BList(_)) named ("list")
}
def dict: Parser[BDict] = {
delimitedBy(DICT_BEGIN, DICT_END) {
rep(string ~ (string | int | list | dict))
} ^^ (_.map { case key ~ value => key -> value }) ^^ (l => BDict(l.toMap)) named ("dict")
}
def root = string | int | list | dict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment