Skip to content

Commit e409507

Browse files
committed
Updated README to reflect the recent change to peg::any
1 parent 666b364 commit e409507

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ int main(void) {
6363
parser["Additive"] = [](const SemanticValues& sv) {
6464
switch (sv.choice()) {
6565
case 0: // "Multitive '+' Additive"
66-
return sv[0].get<int>() + sv[1].get<int>();
66+
return any_cast<int>(sv[0]) + any_cast<int>(sv[1]);
6767
default: // "Multitive"
68-
return sv[0].get<int>();
68+
return any_cast<int>(sv[0]);
6969
}
7070
};
7171

7272
parser["Multitive"] = [](const SemanticValues& sv) {
7373
switch (sv.choice()) {
7474
case 0: // "Primary '*' Multitive"
75-
return sv[0].get<int>() * sv[1].get<int>();
75+
return any_cast<int>(sv[0]) + any_cast<int>(sv[1]);
7676
default: // "Primary"
77-
return sv[0].get<int>();
77+
return any_cast<int>(sv[0]);
7878
}
7979
};
8080

@@ -110,9 +110,9 @@ There are four semantic actions available:
110110

111111
`any& dt` is a 'read-write' context data which can be used for whatever purposes. The initial context data is set in `peg::parser::parse` method.
112112

113-
`peg::any` is a simpler implementatin of [boost::any](http://www.boost.org/doc/libs/1_57_0/doc/html/any.html). It can wrap arbitrary data type.
114-
If the compiler in use supports C++17, by default `peg::any` is defined as an alias to `std::any`.
115-
To force using the simpler `any` implementation that comes with `cpp-peglib`, define `PEGLIB_USE_STD_ANY` as 0 before including `peglib.h`:
113+
`peg::any` is a simpler implementatin of std::any. If the compiler in use supports C++17, by default `peg::any` is defined as an alias to `std::any`.
114+
115+
To force using the simpler `any` implementation that comes with `cpp-peglib`, define `PEGLIB_USE_STD_ANY` as 0 before including `peglib.h`:
116116
```cpp
117117
#define PEGLIB_USE_STD_ANY 0
118118
#include <peglib.h>

0 commit comments

Comments
 (0)