mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 11:55:30 +00:00
Added more information about the ignore operator.
This commit is contained in:
parent
38ba5e1a5e
commit
36e58a6c7b
16
README.md
16
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
|
||||
----------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user