Parse != as !(==) and !~ as !(=~), for simplicity's sake.
This commit is contained in:
parent
4e64364d3a
commit
ccedf7d57f
4 changed files with 9 additions and 13 deletions
12
src/op.cc
12
src/op.cc
|
|
@ -117,8 +117,6 @@ value_t expr_t::op_t::calc(scope_t& scope)
|
|||
break;
|
||||
}
|
||||
|
||||
case O_NEQ:
|
||||
return left()->calc(scope) != right()->calc(scope);
|
||||
case O_EQ:
|
||||
return left()->calc(scope) == right()->calc(scope);
|
||||
case O_LT:
|
||||
|
|
@ -260,15 +258,6 @@ bool expr_t::op_t::print(std::ostream& out, print_context_t& context) const
|
|||
out << ")";
|
||||
break;
|
||||
|
||||
case O_NEQ:
|
||||
out << "(";
|
||||
if (left() && left()->print(out, context))
|
||||
found = true;
|
||||
out << " != ";
|
||||
if (right() && right()->print(out, context))
|
||||
found = true;
|
||||
out << ")";
|
||||
break;
|
||||
case O_EQ:
|
||||
out << "(";
|
||||
if (left() && left()->print(out, context))
|
||||
|
|
@ -415,7 +404,6 @@ void expr_t::op_t::dump(std::ostream& out, const int depth) const
|
|||
case O_MUL: out << "O_MUL"; break;
|
||||
case O_DIV: out << "O_DIV"; break;
|
||||
|
||||
case O_NEQ: out << "O_NEQ"; break;
|
||||
case O_EQ: out << "O_EQ"; break;
|
||||
case O_LT: out << "O_LT"; break;
|
||||
case O_LTE: out << "O_LTE"; break;
|
||||
|
|
|
|||
1
src/op.h
1
src/op.h
|
|
@ -78,7 +78,6 @@ public:
|
|||
UNARY_OPERATORS,
|
||||
|
||||
O_EQ,
|
||||
O_NEQ,
|
||||
O_LT,
|
||||
O_LTE,
|
||||
O_GT,
|
||||
|
|
|
|||
|
|
@ -172,6 +172,14 @@ void expr_t::token_t::next(std::istream& in, const uint_least8_t pflags)
|
|||
length = 2;
|
||||
break;
|
||||
}
|
||||
else if (c == '~') {
|
||||
in.get(c);
|
||||
symbol[1] = c;
|
||||
symbol[2] = '\0';
|
||||
kind = NMATCH;
|
||||
length = 2;
|
||||
break;
|
||||
}
|
||||
kind = EXCLAM;
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ struct expr_t::token_t : public noncopyable
|
|||
|
||||
ASSIGN, // =
|
||||
MATCH, // =~
|
||||
NMATCH, // !~
|
||||
MINUS, // -
|
||||
PLUS, // +
|
||||
STAR, // *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue