mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 20:05:31 +00:00
Removed 'typedef Definition rule'.
This commit is contained in:
parent
ab3d8b0d0e
commit
682417b410
@ -44,7 +44,7 @@ int main(int argc, const char** argv)
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
rule EXPRESSION, TERM, FACTOR, TERM_OPERATOR, FACTOR_OPERATOR, NUMBER;
|
Definition EXPRESSION, TERM, FACTOR, TERM_OPERATOR, FACTOR_OPERATOR, NUMBER;
|
||||||
|
|
||||||
EXPRESSION <= seq(TERM, zom(seq(TERM_OPERATOR, TERM))), reduce;
|
EXPRESSION <= seq(TERM, zom(seq(TERM_OPERATOR, TERM))), reduce;
|
||||||
TERM <= seq(FACTOR, zom(seq(FACTOR_OPERATOR, FACTOR))), reduce;
|
TERM <= seq(FACTOR, zom(seq(FACTOR_OPERATOR, FACTOR))), reduce;
|
||||||
|
2
peglib.h
2
peglib.h
@ -1221,8 +1221,6 @@ private:
|
|||||||
std::shared_ptr<Holder> holder_;
|
std::shared_ptr<Holder> holder_;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Definition rule;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Implementations
|
* Implementations
|
||||||
*/
|
*/
|
||||||
|
12
test/test.cc
12
test/test.cc
@ -70,7 +70,7 @@ TEST_CASE("String capture test2", "[general]")
|
|||||||
{
|
{
|
||||||
vector<string> tags;
|
vector<string> tags;
|
||||||
|
|
||||||
rule ROOT, TAG, TAG_NAME, WS;
|
Definition ROOT, TAG, TAG_NAME, WS;
|
||||||
ROOT <= seq(WS, zom(TAG));
|
ROOT <= seq(WS, zom(TAG));
|
||||||
TAG <= seq(chr('['), TAG_NAME, chr(']'), WS);
|
TAG <= seq(chr('['), TAG_NAME, chr(']'), WS);
|
||||||
TAG_NAME <= oom(seq(npd(chr(']')), dot())), [&](const char* s, size_t n) { tags.push_back(string(s, n)); };
|
TAG_NAME <= oom(seq(npd(chr(']')), dot())), [&](const char* s, size_t n) { tags.push_back(string(s, n)); };
|
||||||
@ -131,7 +131,7 @@ TEST_CASE("Named capture test", "[general]")
|
|||||||
|
|
||||||
TEST_CASE("String capture test with embedded match action", "[general]")
|
TEST_CASE("String capture test with embedded match action", "[general]")
|
||||||
{
|
{
|
||||||
rule ROOT, TAG, TAG_NAME, WS;
|
Definition ROOT, TAG, TAG_NAME, WS;
|
||||||
|
|
||||||
vector<string> tags;
|
vector<string> tags;
|
||||||
|
|
||||||
@ -156,8 +156,8 @@ TEST_CASE("String capture test with embedded match action", "[general]")
|
|||||||
|
|
||||||
TEST_CASE("Cyclic grammer test", "[general]")
|
TEST_CASE("Cyclic grammer test", "[general]")
|
||||||
{
|
{
|
||||||
rule PARENT;
|
Definition PARENT;
|
||||||
rule CHILD;
|
Definition CHILD;
|
||||||
|
|
||||||
PARENT <= seq(CHILD);
|
PARENT <= seq(CHILD);
|
||||||
CHILD <= seq(PARENT);
|
CHILD <= seq(PARENT);
|
||||||
@ -165,7 +165,7 @@ TEST_CASE("Cyclic grammer test", "[general]")
|
|||||||
|
|
||||||
TEST_CASE("Visit test", "[general]")
|
TEST_CASE("Visit test", "[general]")
|
||||||
{
|
{
|
||||||
rule ROOT, TAG, TAG_NAME, WS;
|
Definition ROOT, TAG, TAG_NAME, WS;
|
||||||
|
|
||||||
ROOT <= seq(WS, zom(TAG));
|
ROOT <= seq(WS, zom(TAG));
|
||||||
TAG <= seq(chr('['), TAG_NAME, chr(']'), WS);
|
TAG <= seq(chr('['), TAG_NAME, chr(']'), WS);
|
||||||
@ -296,7 +296,7 @@ TEST_CASE("Simple calculator test", "[general]")
|
|||||||
TEST_CASE("Calculator test", "[general]")
|
TEST_CASE("Calculator test", "[general]")
|
||||||
{
|
{
|
||||||
// Construct grammer
|
// Construct grammer
|
||||||
rule EXPRESSION, TERM, FACTOR, TERM_OPERATOR, FACTOR_OPERATOR, NUMBER;
|
Definition EXPRESSION, TERM, FACTOR, TERM_OPERATOR, FACTOR_OPERATOR, NUMBER;
|
||||||
|
|
||||||
EXPRESSION <= seq(TERM, zom(seq(TERM_OPERATOR, TERM)));
|
EXPRESSION <= seq(TERM, zom(seq(TERM_OPERATOR, TERM)));
|
||||||
TERM <= seq(FACTOR, zom(seq(FACTOR_OPERATOR, FACTOR)));
|
TERM <= seq(FACTOR, zom(seq(FACTOR_OPERATOR, FACTOR)));
|
||||||
|
Loading…
Reference in New Issue
Block a user