/** Parses the input concrete S-expression syntax to produce a command instance */ public static /*@Nullable*/ C_what parse(Parser p) throws IOException, ParserException { if (!p.smt().relax) { error(p.smt(), "Invalid SMT-LIB command: " + commandName, p.commandName.pos()); return null; } List<IIdentifier> ids = new LinkedList<IIdentifier>(); while (!p.isRP()) { if (p.isEOD()) { p.smt() .log .logError( p.smt() .responseFactory .error( "Unexpected end of data while parsing a what command", p.savedlp == null ? null : p.pos(p.savedlp.pos().charStart(), p.currentPos()))); // Note: actually p.savedlp should not ever be null - a bit defensive here return null; } IIdentifier id = p.parseIdentifier(); if (id == null) return null; ids.add(id); } return new C_what(ids); }
/** Parses the arguments of the command, producing a new command instance */ public static /*@Nullable*/ C_declare_const parse(Parser p) throws ParserException { /*@Nullable*/ ISymbol symbol = p.parseSymbol(); if (symbol == null) return null; /*@Nullable*/ ISort result = p.parseSort(null); if (result == null) return null; String v = symbol.value(); if (v.length() > 0 && (v.charAt(0) == '@' || v.charAt(0) == '.')) { error(p.smt(), "User-defined symbols may not begin with . or @", symbol.pos()); return null; } return new C_declare_const(symbol, result); }