From f33a77e22895942a9dc39dddc6591c249f70b34d Mon Sep 17 00:00:00 2001
From: Per <Per Lindgren>
Date: Thu, 15 Mar 2018 15:29:43 +0100
Subject: [PATCH] parens works

---
 examples/ex1.rs | 7 +++++--
 src/lib.rs      | 5 ++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/examples/ex1.rs b/examples/ex1.rs
index cb65f1f..77e285f 100644
--- a/examples/ex1.rs
+++ b/examples/ex1.rs
@@ -15,6 +15,9 @@ fn main() {
     let v = mylitp!((99));
     println!("v {}", v);
 
-    // let v = mylitp!(9o9);
-    // println!("v {}", v);
+    let v = mylitp!(99);
+    println!("v {}", v);
+
+    let v = mylitp!((9o9));
+    println!("v {}", v);
 }
diff --git a/src/lib.rs b/src/lib.rs
index 0594a34..b858620 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -47,8 +47,11 @@ struct MyLitP {
 }
 
 impl Synom for MyLitP {
+    // named!(parse -> Self, do_parse!(
+    //     val: call!(LitInt::parse) >> (MyLitP { val })
+    // ));
     named!(parse -> Self, do_parse!(
-        val: call!(LitInt::parse) >> (MyLitP { val })
+        val: parens!(call!(LitInt::parse)) >> (MyLitP { val: val.1 })
     ));
 }
 
-- 
GitLab