Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangObject$Hash


    }

    public static void removeCacheFiles(final IOtpRpc backend,
            final String scannerModuleName, final String stateDir) {
        try {
            final OtpErlangObject res = backend.call(20000, ERLIDE_NOPARSE,
                    "remove_cache_files", "as", scannerModuleName, stateDir);
            if (!Util.isOk(res)) {
                ErlLogger.error("remove_cache_files %s %s", scannerModuleName,
                        res.toString());
            }
        } catch (final RpcException e) {
            ErlLogger.error(e);
        }
    }
View Full Code Here


        }
    }

    @SuppressWarnings("boxing")
    public ErlToken getTokenAt(final String module, final int offset) {
        OtpErlangObject r1 = null;
        try {
            r1 = backend.call(ERLIDE_SCANNER, "get_token_at", "ai", module, offset);
        } catch (final Exception e) {
            return null;
        }
        if (!(r1 instanceof OtpErlangTuple)) {
            return null;
        }
        final OtpErlangTuple t1 = (OtpErlangTuple) r1;
        if (Util.isOk(t1)) {
            final OtpErlangObject ot = t1.elementAt(1);
            if (ot instanceof OtpErlangTuple) {
                final OtpErlangTuple tt = (OtpErlangTuple) ot;
                return new ErlToken(tt);
            }
        }
View Full Code Here

    @SuppressWarnings("boxing")
    public void replaceText(final String module, final int offset,
            final int removeLength, final String newText) {
        assertThat(newText, is(not(nullValue())));
        try {
            final OtpErlangObject r = backend.call(ERLIDE_SCANNER, "replace_text",
                    "aiis", module, offset, removeLength, newText);
            if (r instanceof OtpErlangTuple) {
                ErlLogger.error("replace_text %s @ %d GOT:: %s", module, offset,
                        r.toString());
            }
        } catch (final RpcTimeoutException e) {
            ErlLogger.debug(e);
        } catch (final RpcException e) {
            ErlLogger.debug(e);
View Full Code Here

    }

    @Override
    public List<ErlToken> lightScanString(final String string, final int offset)
            throws 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 + "\": "
View Full Code Here

            final boolean getTokens) {
        if (module == null) {
            return null;
        }
        try {
            final OtpErlangObject o = backend.call(ERLIDE_SCANNER, "check_all", "aso",
                    module, text, getTokens);
            return o;
        } catch (final RpcException e) {
            ErlLogger.warn(e);
        }
View Full Code Here

    @Override
    public List<OtpErlangObject> parse(final String s) {
        final RpcResult res = backend.call_noexception("erlide_parse", "consult", "b", s);
        if (res.isOk()) {
            final OtpErlangObject val = res.getValue();
            if (val instanceof OtpErlangList) {
                return Lists.newArrayList(((OtpErlangList) val).elements());
            }
        }
        return Lists.newArrayList();
View Full Code Here

            module.setComments(moduleComments);
        }
        attachFunctionComments(module);
        String cached = "reparsed";
        if (res != null && res.arity() > 2) {
            final OtpErlangObject res2 = res.elementAt(2);
            if (res2 instanceof OtpErlangAtom) {
                final OtpErlangAtom atom = (OtpErlangAtom) res2;
                cached = atom.atomValue();
            }
        }
View Full Code Here

     *            token record from noparse
     * @return IErlComment
     */
    private IErlComment createComment(final IErlModule module, final OtpErlangTuple c) {
        final OtpErlangLong lineL = (OtpErlangLong) c.elementAt(LINE);
        final OtpErlangObject s = c.elementAt(TEXT);

        int line;
        int lastLine;
        try {
            line = lineL.intValue();
View Full Code Here

            final ErlParserProblem e = ErlParserProblem.newError(module, msg);
            setPos(e, er.elementAt(0));
            return e;
        } else if ("tree".equals(typeS)) {
            final OtpErlangTuple atr = (OtpErlangTuple) el.elementAt(3);
            final OtpErlangObject pos = ((OtpErlangTuple) el.elementAt(2)).elementAt(1);
            final OtpErlangTuple name = (OtpErlangTuple) atr.elementAt(1);
            final OtpErlangAtom n = (OtpErlangAtom) concreteTerm(name);
            final OtpErlangObject val = atr.elementAt(2);
            final OtpErlangObject extra = el.arity() > 4 ? el.elementAt(4) : null;
            return addAttribute(module, pos, n, val, extra, null);
        } else if ("attribute".equals(typeS)) {
            final OtpErlangObject pos = el.elementAt(1);
            final OtpErlangAtom name = (OtpErlangAtom) el.elementAt(2);
            final OtpErlangObject val = el.elementAt(3);
            final OtpErlangObject extra = el.arity() > 4 ? el.elementAt(4) : null;
            final OtpErlangObject arity = el.arity() > 5 ? el.elementAt(5) : null;
            return addAttribute(module, pos, name, val, extra, arity);
        } else if ("function".equals(typeS)) {
            final ErlFunction f = makeErlFunction(module, el);
            final OtpErlangList clauses = (OtpErlangList) el.elementAt(6);
            final List<ErlFunctionClause> cls = Lists.newArrayListWithCapacity(clauses
View Full Code Here

    private ErlFunction makeErlFunction(final IErlModule module, final OtpErlangTuple el) {
        final OtpErlangTuple pos = (OtpErlangTuple) el.elementAt(1);
        final OtpErlangAtom name = (OtpErlangAtom) el.elementAt(2);
        final OtpErlangLong arity = (OtpErlangLong) el.elementAt(3);
        final OtpErlangList parameters = (OtpErlangList) el.elementAt(4);
        final OtpErlangObject head = el.elementAt(5);
        final OtpErlangTuple namePos = (OtpErlangTuple) el.elementAt(7);
        ErlFunction f = null;
        final OtpErlangAtom exportedA = (OtpErlangAtom) el.elementAt(8);
        final boolean exported = Boolean.parseBoolean(exportedA.atomValue());
        try {
View Full Code Here

TOP

Related Classes of com.ericsson.otp.erlang.OtpErlangObject$Hash

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.