Package org.erlide.engine.services.parsing

Examples of org.erlide.engine.services.parsing.ScannerException


        OtpErlangObject r1 = null;
        try {
            r1 = backend.call("erlide_scanner", "light_scan_string", "ba", string,
                    ENCODING);
        } catch (final Exception e) {
            throw new ScannerException("Could not parse string \"" + string + "\": "
                    + e.getMessage());
        }
        if (r1 == null) {
            return null;
        }

        if (!(r1 instanceof OtpErlangTuple)) {
            throw new ScannerException("Could not parse string \"" + string
                    + "\": weird return value " + r1);
        }
        final OtpErlangTuple t1 = (OtpErlangTuple) r1;

        List<ErlToken> toks = null;
        if (Util.isOk(t1)) {
            if (t1.elementAt(1) instanceof OtpErlangBinary) {
                final OtpErlangBinary b = (OtpErlangBinary) t1.elementAt(1);
                final byte[] bytes = b.binaryValue();
                toks = new ArrayList<ErlToken>(bytes.length / 10);
                for (int i = 0; i < bytes.length; i += 10) {
                    final ErlToken tk = new ErlToken(bytes, i, offset);
                    toks.add(tk);
                }
                return toks;
            }
            throw new ScannerException("unexpected token format");
        }
        throw new ScannerException("Could not parse string \"" + string + "\": "
                + t1.toString());
    }
View Full Code Here

TOP

Related Classes of org.erlide.engine.services.parsing.ScannerException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.