From 36e58a6c7bd73b84a3640dff90d3698a04e590d0 Mon Sep 17 00:00:00 2001 From: yhirose Date: Sat, 13 Jun 2015 01:27:49 -0400 Subject: [PATCH] Added more information about the ignore operator. --- README.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 232b7c2..6b3969a 100644 --- a/README.md +++ b/README.md @@ -144,9 +144,9 @@ We can ignore unnecessary semantic values from the list by using `~` operator. ```c++ peglib::peg parser( - " ROOT <- _ ITEM (',' _ ITEM _)* " - " ITEM <- ([a-z])+ " - " ~_ <- [ \t]* " + " ROOT <- _ ITEM (',' _ ITEM _)* " + " ITEM <- ([a-z])+ " + " ~_ <- [ \t]* " ); parser["ROOT"] = [&](const SemanticValues& sv) { @@ -156,6 +156,16 @@ parser["ROOT"] = [&](const SemanticValues& sv) { auto ret = parser.parse(" item1, item2 "); ``` +The following grammar is same as the above. + +```c++ +peglib::peg parser( + " ROOT <- ~_ ITEM (',' ~_ ITEM ~_)* " + " ITEM <- ([a-z])+ " + " _ <- [ \t]* " +); +``` + Simple interface ----------------