Updated README

pull/21/head
yhirose 8 years ago
parent 7b78a1c00f
commit fd150264a5
  1. 33
      README.md

@ -349,39 +349,6 @@ The following are available operators:
| tok | Token boundary |
| ign | Ignore semantic value |
| cap | Capture character |
| usr | User defined parser |
Adjust definitions
------------------
It's possible to add/override definitions.
```cpp
auto syntax = R"(
ROOT <- _ 'Hello' _ NAME '!' _
)";
Rules additional_rules = {
{
"NAME", usr([](const char* s, size_t n, SemanticValues& sv, any& dt) -> size_t {
static vector<string> names = { "PEG", "BNF" };
for (const auto& name: names) {
if (name.size() <= n && !name.compare(0, name.size(), s, name.size())) {
return name.size(); // processed length
}
}
return -1; // parse error
})
},
{
"~_", zom(cls(" \t\r\n"))
}
};
auto g = parser(syntax, additional_rules);
assert(g.parse(" Hello BNF! "));
```
Unicode support
---------------

Loading…
Cancel
Save