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