if (!f.getSort().isConstructor())
{
PARSER_STATE->parseError(
- "Bad syntax for test (_ is X), X must be a constructor.");
+ "Bad syntax for (_ is X), X must be a constructor.");
}
// get the datatype that f belongs to
api::Sort sf = f.getSort().getConstructorCodomainSort();
if (!f.getSort().isSelector())
{
PARSER_STATE->parseError(
- "Bad syntax for test (_ update X), X must be a selector.");
+ "Bad syntax for (_ update X), X must be a selector.");
}
std::string sname = f.toString();
// get the datatype that f belongs to
// get the updater term
p.d_expr = ds.getUpdaterTerm();
}
- | TUPLE_SEL_TOK m=INTEGER_LITERAL
- {
- // we adopt a special syntax (_ tupSel n)
- p.d_kind = api::APPLY_SELECTOR;
- // put m in expr so that the caller can deal with this case
- p.d_expr = SOLVER->mkInteger(AntlrInput::tokenToUnsigned($m));
- }
| TUPLE_PROJECT_TOK nonemptyNumeralList[numerals]
{
// we adopt a special syntax (_ tuple_project i_1 ... i_n) where
{
std::string opName = AntlrInput::tokenText($sym);
api::Kind k = PARSER_STATE->getIndexedOpKind(opName);
- if (k == api::APPLY_UPDATER)
+ if (k == api::APPLY_SELECTOR || k == api::APPLY_UPDATER)
{
- // we adopt a special syntax (_ tuple_update n) for tuple updaters
+ // we adopt a special syntax (_ tuple_select n) and (_ tuple_update n)
+ // for tuple selectors and updaters
if (numerals.size() != 1)
{
PARSER_STATE->parseError(
CHAR_TOK : { PARSER_STATE->isTheoryEnabled(theory::THEORY_STRINGS) }? 'char';
TUPLE_CONST_TOK: { PARSER_STATE->isTheoryEnabled(theory::THEORY_DATATYPES) }? 'tuple';
-TUPLE_SEL_TOK: { PARSER_STATE->isTheoryEnabled(theory::THEORY_DATATYPES) }? 'tuple_select';
TUPLE_PROJECT_TOK: { PARSER_STATE->isTheoryEnabled(theory::THEORY_DATATYPES) }? 'tuple_project';
HO_ARROW_TOK : { PARSER_STATE->isHoEnabled() }? '->';
{
Parser::addOperator(api::APPLY_UPDATER);
addOperator(api::DT_SIZE, "dt.size");
+ // Notice that tuple operators, we use the generic APPLY_SELECTOR and
+ // APPLY_UPDATER kinds. These are processed based on the context
+ // in which they are parsed, e.g. when parsing identifiers.
+ addIndexedOperator(
+ api::APPLY_SELECTOR, api::APPLY_SELECTOR, "tuple_select");
addIndexedOperator(api::APPLY_UPDATER, api::APPLY_UPDATER, "tuple_update");
}
}
Debug("parser") << "Smt2::addOperator( " << kind << ", " << name << " )"
<< std::endl;
Parser::addOperator(kind);
- operatorKindMap[name] = kind;
+ d_operatorKindMap[name] = kind;
}
void Smt2::addIndexedOperator(api::Kind tKind,
api::Kind Smt2::getOperatorKind(const std::string& name) const
{
// precondition: isOperatorEnabled(name)
- return operatorKindMap.find(name)->second;
+ return d_operatorKindMap.find(name)->second;
}
bool Smt2::isOperatorEnabled(const std::string& name) const {
- return operatorKindMap.find(name) != operatorKindMap.end();
+ return d_operatorKindMap.find(name) != d_operatorKindMap.end();
}
bool Smt2::isTheoryEnabled(theory::TheoryId theory) const
d_logicSet = false;
d_seenSetLogic = false;
d_logic = LogicInfo();
- operatorKindMap.clear();
+ d_operatorKindMap.clear();
d_lastNamedTerm = std::pair<api::Term, std::string>();
}