Code blocks need a =>

This commit is contained in:
Niko Matsakis 2015-06-13 22:15:05 -04:00
parent 3ab3bee0e1
commit 2186eed80b
2 changed files with 10 additions and 2 deletions

View File

@ -55,6 +55,9 @@ rusty_peg! {
action: a
};
ACTION: String =
("=>", <c:CODE_BLOCK>) => c;
// Symbol items
SYMBOL_ARG: SymbolArg =
@ -177,9 +180,9 @@ rusty_peg! {
// Custom symbols.
struct ACTION;
struct CODE_BLOCK;
impl<'input> rusty_peg::Symbol<'input,Parser<'input>> for ACTION {
impl<'input> rusty_peg::Symbol<'input,Parser<'input>> for CODE_BLOCK {
type Output = String;
fn pretty_print(&self) -> String {

View File

@ -46,3 +46,8 @@ fn token_expr() {
assert!(parse_grammar(r#"grammar Foo { token Expr where { "foo" => "bar"; } }"#).is_ok());
}
#[test]
fn map() {
assert!(parse_grammar(r#"grammar Foo { Expr = <n:Alt+> => { { foo } }; }"#).is_ok());
}