parser: handle implicit 'and not'
This commit is contained in:
@ -239,10 +239,13 @@ factor_2 (Mux::Tokens& tokens, Node::Type& op, ProcPtr proc,
|
|||||||
tokens.pop_front();
|
tokens.pop_front();
|
||||||
op = Node::Type::OpAnd;
|
op = Node::Type::OpAnd;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case Token::Type::Open:
|
case Token::Type::Open:
|
||||||
case Token::Type::Data:
|
case Token::Type::Data:
|
||||||
|
case Token::Type::Not:
|
||||||
op = Node::Type::OpAnd; // implicit AND
|
op = Node::Type::OpAnd; // implicit AND
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return empty();
|
return empty();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,8 +84,9 @@ test_complex ()
|
|||||||
{ "foo and bar or cuux",
|
{ "foo and bar or cuux",
|
||||||
R"#((or(and(value "" "foo")(value "" "bar")))#" +
|
R"#((or(and(value "" "foo")(value "" "bar")))#" +
|
||||||
std::string(R"#((value "" "cuux")))#") },
|
std::string(R"#((value "" "cuux")))#") },
|
||||||
|
|
||||||
{ "a and not b",
|
{ "a and not b",
|
||||||
R"#((andnot(value "" "a")(value "" "b")))#"
|
R"#((and(value "" "a")(not(value "" "b"))))#"
|
||||||
},
|
},
|
||||||
{ "a and b and c",
|
{ "a and b and c",
|
||||||
R"#((and(value "" "a")(and(value "" "b")(value "" "c"))))#"
|
R"#((and(value "" "a")(and(value "" "b")(value "" "c"))))#"
|
||||||
@ -97,7 +98,7 @@ test_complex ()
|
|||||||
R"#((and(value "" "a")(value "" "b")))#"
|
R"#((and(value "" "a")(value "" "b")))#"
|
||||||
},
|
},
|
||||||
{ "a not b", // implicit and not
|
{ "a not b", // implicit and not
|
||||||
R"#((andnot(value "" "a")(value "" "b")))#"
|
R"#((and(value "" "a")(not(value "" "b"))))#"
|
||||||
},
|
},
|
||||||
{ "not b", // implicit and not
|
{ "not b", // implicit and not
|
||||||
R"#((not(value "" "b")))#"
|
R"#((not(value "" "b")))#"
|
||||||
|
|||||||
Reference in New Issue
Block a user