public int readOct() throws IOException { int val = Character.digit(last_char, 8); val += Character.digit(read(), 8); if (val < 0) throw new ParseError("octal must have 3 octdigits."); val += Character.digit(read(), 8); if (val < 0) throw new ParseError("octal must have 3 octdigits"); return val; }
@Test public void testParseError() { try { _factory.parse("f(\""); } catch (final ParseError e) { if (!e.getMessage().startsWith("Unterminated quoted function symbol")) throw e; } }
@Override public ATerm parse(final String trm) { try { final ATermReader reader = new ATermReader(new StringReader(trm), trm.length()); reader.readSkippingWS(); final ATerm result = parseFromReader(reader); return result; } catch (final IOException e) { throw new ParseError("premature end of string", e); } }
throw new ParseError("Unterminated quoted function symbol: " + str);
throw new ParseError("malformed int", e); throw new ParseError("malformed long", e); reader.read(); if (!Character.isDigit(reader.getLastChar())) throw new ParseError("digit expected"); do str.append((char) reader.getLastChar()); throw new ParseError("digit expected!"); do str.append((char) reader.getLastChar()); throw new ParseError("malformed real", e);
public ATerm readFromBinaryFile(final boolean headerAlreadyRead) throws ParseError, IOException { if (!headerAlreadyRead && !isBinaryATerm(_reader)) throw new ParseError("Input is not a BAF file"); final int val = _reader.readInt(); if (val != BAF_VERSION) throw new ParseError("Wrong BAF version (wanted " + BAF_VERSION + ", got " + val + "), giving up"); _nrUniqueSymbols = _reader.readInt(); final int nrUniqueTerms = _reader.readInt(); if (isDebugging()) { debug("" + _nrUniqueSymbols + " unique symbols"); debug("" + nrUniqueTerms + " unique terms"); } _symbols = new SymEntry[_nrUniqueSymbols]; readAllSymbols(); final int i = _reader.readInt(); return readTerm(_symbols[i]); }
throw new ParseError("premature EOF encountered."); c = reader.readSkippingWS(); if (c == -1) throw new ParseError("premature EOF encountered."); throw new ParseError("expected ']' but got '" + (char) reader.getLastChar() + "'"); c = reader.readSkippingWS(); throw new ParseError("expected '>' but got '" + (char) reader.getLastChar() + "'"); throw new ParseError("premature EOF encountered."); if (reader.getLastChar() == ')') result = makeAppl(makeAFun(funname, 0, true)); throw new ParseError("_expected ')' but got '" + reader.getLastChar() + "'"); result = makeAppl(makeAFun(funname, list.length, true), list); c = reader.readSkippingWS(); if (c == -1) throw new ParseError("premature EOF encountered."); if (reader.getLastChar() == ')') result = makeAppl(makeAFun("", 0, false)); throw new ParseError("_expected ')' but got '" + (char) reader.getLastChar() + "'"); result = makeAppl(makeAFun("", list.length, false), list); throw new ParseError("premature EOF encountered."); if (reader.getLastChar() == ')')
throw new ParseError("Cannot be null");