/** Retrieve the text associated with a token. */
inline static std::string tokenText(pANTLR3_COMMON_TOKEN token);
-
+ /** Retrieve an Integer from the text of a token */
+ inline static Integer tokenToInteger( pANTLR3_COMMON_TOKEN token );
+ /** Retrieve a Rational from the text of a token */
+ inline static Rational tokenToRational(pANTLR3_COMMON_TOKEN token);
protected:
/** Create an input. This input takes ownership of the given input stream,
return txt;
}
+Integer Input::tokenToInteger(pANTLR3_COMMON_TOKEN token) {
+ Integer i( tokenText(token) );
+ return i;
+}
+
+Rational Input::tokenToRational(pANTLR3_COMMON_TOKEN token) {
+ Rational r( tokenText(token) );
+ return r;
+}
+
}/* CVC4::parser namespace */
}/* CVC4 namespace */
| TRUE_TOK { expr = MK_CONST(true); }
| FALSE_TOK { expr = MK_CONST(false); }
| NUMERAL_TOK
- { Integer num( Input::tokenText($NUMERAL_TOK) );
- expr = MK_CONST(num); }
+ { expr = MK_CONST( Input::tokenToInteger($NUMERAL_TOK) ); }
| RATIONAL_TOK
{ // FIXME: This doesn't work because an SMT rational is not a valid GMP rational string
- Rational rat( Input::tokenText($RATIONAL_TOK) );
- expr = MK_CONST(rat); }
+ expr = MK_CONST( Input::tokenToRational($RATIONAL_TOK) ); }
// NOTE: Theory constants go here
- /* TODO: let, flet, quantifiers, arithmetic constants */
+ /* TODO: quantifiers, arithmetic constants */
;
/**
Unhandled(name);
}
}
+
}
{ cmd = new SetBenchmarkStatusCommand(b_status); }
| /* sort declaration */
DECLARE_SORT_TOK identifier[name,CHECK_UNDECLARED,SYM_SORT] n=NUMERAL_TOK
- // FIXME: What does the numeral argument mean?
- { Debug("parser") << "declare sort: '" << name << "' " << n << std::endl;
+ { Debug("parser") << "declare sort: '" << name << "' arity=" << n << std::endl;
+ if( Input::tokenToInteger(n) > 0 ) {
+ Unimplemented("Parameterized user sorts.");
+ }
PARSER_STATE->mkSort(name);
$cmd = new DeclarationCommand(name,EXPR_MANAGER->kindType()); }
| /* function declaration */
| TRUE_TOK { expr = MK_CONST(true); }
| FALSE_TOK { expr = MK_CONST(false); }
| NUMERAL_TOK
- { Integer num( Input::tokenText($NUMERAL_TOK) );
- expr = MK_CONST(num); }
+ { expr = MK_CONST( Input::tokenToInteger($NUMERAL_TOK) ); }
| RATIONAL_TOK
{ // FIXME: This doesn't work because an SMT rational is not a valid GMP rational string
- Rational rat( Input::tokenText($RATIONAL_TOK) );
- expr = MK_CONST(rat); }
+ expr = MK_CONST( Input::tokenToRational($RATIONAL_TOK) ); }
// NOTE: Theory constants go here
;