Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangTuple


        if (module == null) {
            return false;
        }
        OtpErlangList forms = null;
        OtpErlangList comments = null;
        OtpErlangTuple res = null;
        if (initialParse) {
            final String stateDir = ErlangEngine.getInstance().getStateDir();
            final String pathNotNull = path == null ? "" : path;
            res = ErlideNoparse.initialParse(backend, scannerName, pathNotNull,
                    initialText, stateDir, true, updateSearchServer);
        } else {
            res = ErlideNoparse.reparse(backend, scannerName, updateSearchServer);
        }
        if (Util.isOk(res)) {
            final OtpErlangTuple t = (OtpErlangTuple) res.elementAt(1);
            forms = (OtpErlangList) t.elementAt(1);
            comments = (OtpErlangList) t.elementAt(2);
        } else {
            ErlLogger.error("error when parsing %s: %s", path, res);
        }
        if (forms == null) {
            module.setChildren(null);
View Full Code Here


     */
    private IErlMember create(final IErlModule module, final OtpErlangTuple el) {
        final OtpErlangAtom type = (OtpErlangAtom) el.elementAt(0);
        final String typeS = type.atomValue();
        if ("error".equals(typeS)) {
            final OtpErlangTuple er = (OtpErlangTuple) el.elementAt(1);
            final String msg = helper.formatError(er);
            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
                    .arity());
            for (int i = 0; i < clauses.arity(); i++) {
                final OtpErlangTuple clause = (OtpErlangTuple) clauses.elementAt(i);
                final ErlFunctionClause cl = makeErlFunctionClause(f, i, clause);
                cls.add(cl);
            }
            f.setChildren(cls);
            return f;
View Full Code Here

     *            -record(function, {pos, name, arity, args, head, clauses,
     *            name_pos, comment, exported}).
     * @return ErlFunction
     */
    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 {
            f = new ErlFunction(module, name.atomValue(), arity.intValue(),
View Full Code Here

     *
     *
     */
    private ErlFunctionClause makeErlFunctionClause(final ErlFunction f, final int i,
            final OtpErlangTuple clause) {
        final OtpErlangTuple cpos = (OtpErlangTuple) clause.elementAt(1);
        final OtpErlangList parameters = (OtpErlangList) clause.elementAt(3);
        final OtpErlangObject head = clause.elementAt(4);
        final OtpErlangTuple cnamePos = (OtpErlangTuple) clause.elementAt(5);
        final ErlFunctionClause cl = new ErlFunctionClause(f, "#" + i,
                Util.stringValue(head), parameters);
        try {
            setNamePos(cl, cnamePos);
        } catch (final OtpErlangRangeException e) {
View Full Code Here

        return cl;
    }

    private void setNamePos(final ErlMember f, final OtpErlangTuple namePos)
            throws OtpErlangRangeException {
        final OtpErlangTuple tpos1 = (OtpErlangTuple) namePos.elementAt(0);
        final int ofs = ((OtpErlangLong) tpos1.elementAt(1)).intValue();
        final int len = ((OtpErlangLong) namePos.elementAt(1)).intValue();
        f.setNameRange(ofs, len);
    }
View Full Code Here

            // r.setParseTree(val);
            return r;
        } else if (val instanceof OtpErlangList) {
            final OtpErlangList macroList = (OtpErlangList) val;
            if (macroList.elementAt(0) instanceof OtpErlangTuple) {
                final OtpErlangTuple macroNameTuple = (OtpErlangTuple) macroList
                        .elementAt(0);
                OtpErlangObject o = macroNameTuple.elementAt(2);
                if (o instanceof OtpErlangTuple) {
                    o = ((OtpErlangTuple) o).elementAt(2);
                }
                ErlMember r;
                if (o instanceof OtpErlangAtom) {
View Full Code Here

                }
                final IOtpRpc backend = BackendCore.getBuildBackend(project);

                final String stateDir = ErlideUIPlugin.getDefault().getStateLocation()
                        .toString();
                final OtpErlangTuple otpDoc = (OtpErlangTuple) ErlangEngine.getInstance()
                        .getService(OtpDocService.class)
                        .getOtpDoc(backend, functionCall, stateDir);
                if (Util.isOk(otpDoc)) {
                    final String docStr = Util.stringValue(otpDoc.elementAt(1));
                    final StringBuffer result = new StringBuffer(docStr);
                    String docPath = "";
                    String anchor = "";
                    if (otpDoc.arity() > 4) {
                        docPath = Util.stringValue(otpDoc.elementAt(3));
                        anchor = Util.stringValue(otpDoc.elementAt(4));
                    }
                    if (result.length() > 0) {
                        final String html = HoverUtil.getHTMLAndReplaceJSLinks(result);
                        final Object element = OpenResult.build(otpDoc.elementAt(2));
                        input = new ErlBrowserInformationControlInput(input, editor,
                                element, html, 20, HoverUtil.getDocumentationURL(docPath,
                                        anchor));
                    }
                }
View Full Code Here

            }

            final IErlModel model = ErlangEngine.getInstance().getModel();
            final String externalModulesString = erlProject.getProperties()
                    .getExternalModules();
            final OtpErlangTuple t = (OtpErlangTuple) ErlangEngine
                    .getInstance()
                    .getService(OtpDocService.class)
                    .getOtpDoc(
                            backend,
                            offset,
                            stateDir,
                            editor.getScannerName(),
                            fImports,
                            externalModulesString,
                            model.getPathVars(editor.getModule()
                                    .getCorrespondingResource()));
            ErlLogger.debug("otp doc %s", t);
            if (Util.isOk(t)) {
                element = OpenResult.build(t.elementAt(2));
                final String docStr = Util.stringValue(t.elementAt(1));
                result.append(docStr);
                if (t.arity() > 4) {
                    docPath = Util.stringValue(t.elementAt(3));
                    anchor = Util.stringValue(t.elementAt(4));
                }
            } else {
                element = OpenResult.build(t);
                final Object found = new OpenUtils().findOpenResult(editor,
                        editor.getModule(), erlProject, element,
View Full Code Here

                }
            }

            @Override
            public void progress(final OtpErlangObject msg) {
                final OtpErlangTuple t = (OtpErlangTuple) msg;
                final OtpErlangPid backgroundSearchPid = (OtpErlangPid) t.elementAt(0);
                final OtpErlangLong progressL = (OtpErlangLong) t.elementAt(1);
                final OtpErlangObject resultO = t.elementAt(2);
                int progress = 1;
                try {
                    progress = progressL.intValue();
                    final List<ModuleLineFunctionArityRef> result = Lists.newArrayList();
                    SearchUtil.addSearchResult(result, resultO);
View Full Code Here

        final IPathVariableManager pvm = context.getProject().getPathVariableManager();
        final List<OtpErlangObject> objects = Lists.newArrayList();
        final String[] names = pvm.getPathVariableNames();
        for (final String name : names) {
            final String value = URIUtil.toPath(pvm.getURIValue(name)).toPortableString();
            objects.add(new OtpErlangTuple(new OtpErlangObject[] {
                    new OtpErlangString(name), new OtpErlangString(value) }));
        }

        fCachedPathVars = OtpErlang.mkList(objects);
        // }
View Full Code Here

TOP

Related Classes of com.ericsson.otp.erlang.OtpErlangTuple

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.