@@ -106,13 +106,12 @@ TEST_CASE("String capture test2", "[general]")
106
106
107
107
TEST_CASE (" String capture test3" , " [general]" )
108
108
{
109
- auto syntax =
110
- " ROOT <- _ TOKEN* "
111
- " TOKEN <- '[' < (!']' .)+ > ']' _ "
112
- " _ <- [ \t\r\n ]* "
113
- ;
109
+ parser pg ( R"(
110
+ ROOT <- _ TOKEN*
111
+ TOKEN <- '[' < (!']' .)+ > ']' _
112
+ _ <- [ \t\r\n]*
113
+ )" ) ;
114
114
115
- parser pg (syntax);
116
115
117
116
std::vector<std::string> tags;
118
117
@@ -450,14 +449,12 @@ TEST_CASE("mutable lambda test", "[general]")
450
449
451
450
TEST_CASE (" Simple calculator test" , " [general]" )
452
451
{
453
- auto syntax = R"(
452
+ parser parser ( R"(
454
453
Additive <- Multitive '+' Additive / Multitive
455
454
Multitive <- Primary '*' Multitive / Primary
456
455
Primary <- '(' Additive ')' / Number
457
456
Number <- [0-9]+
458
- )" ;
459
-
460
- parser parser (syntax);
457
+ )" );
461
458
462
459
parser[" Additive" ] = [](const SemanticValues& sv) {
463
460
switch (sv.choice ()) {
@@ -816,9 +813,9 @@ TEST_CASE("Semantic values test", "[general]")
816
813
817
814
TEST_CASE (" Ordered choice count" , " [general]" )
818
815
{
819
- auto syntax = R"( S <- 'a' / 'b' )" ;
820
-
821
- parser parser (syntax );
816
+ parser parser ( R"(
817
+ S <- 'a' / 'b'
818
+ )" );
822
819
823
820
parser[" S" ] = [](const SemanticValues& sv) {
824
821
REQUIRE (sv.choice () == 1 );
@@ -830,9 +827,9 @@ TEST_CASE("Ordered choice count", "[general]")
830
827
831
828
TEST_CASE (" Ordered choice count 2" , " [general]" )
832
829
{
833
- auto syntax = R"( S <- ('a' / 'b')* )" ;
834
-
835
- parser parser (syntax );
830
+ parser parser ( R"(
831
+ S <- ('a' / 'b')*
832
+ )" );
836
833
837
834
parser[" S" ] = [](const SemanticValues& sv) {
838
835
REQUIRE (sv.choice () == 0 );
0 commit comments