Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangTuple


    }

    @Override
    public ISourceRange findVariable(final ISourceRange range, final String variableName,
            final String elementText) throws OtpErlangRangeException {
        final OtpErlangTuple res2 = ErlangEngine.getInstance()
                .getService(OpenService.class).findFirstVar(variableName, elementText);
        if (res2 != null) {
            final int relativePos = ((OtpErlangLong) res2.elementAt(0)).intValue() - 1;
            final int length = ((OtpErlangLong) res2.elementAt(1)).intValue();
            final int start = relativePos + range.getOffset();
            return new SourceRange(start, length);
        }
        return range;
    }
View Full Code Here


                    .getInstance().getSimpleScannerService();
            final OtpErlangObject checkAll = internalScanner.checkAll(scannerName, text,
                    true);
            String s;
            if (checkAll instanceof OtpErlangTuple) {
                final OtpErlangTuple t = (OtpErlangTuple) checkAll;
                s = Util.stringValue(t.elementAt(0));
                final OtpErlangObject o1 = t.elementAt(1);
                final OtpErlangObject o2 = t.elementAt(2);
                dumpText(o1.toString(), "/tmp/scannerTokens.txt");
                dumpText(o2.toString(), "/tmp/rescanTokens.txt");
            } else {
                s = Util.stringValue(checkAll);
            }
View Full Code Here

        return super.internalGetChildren();
    }

    private void mkOtpStructureMap(final OtpErlangList input) {
        for (final OtpErlangObject o : input) {
            final OtpErlangTuple t = (OtpErlangTuple) o;
            final String lib = ((OtpErlangString) t.elementAt(0)).stringValue();
            final OtpErlangList dirs = (OtpErlangList) t.elementAt(1);
            final String group = OtpErlang.asString(t.elementAt(2));

            final ErlExternalReferenceEntry extLib = new ErlExternalReferenceEntry(this,
                    getLibName(lib), lib, true, false);
            extLib.setGroup(group);
            addChild(extLib);

            for (final OtpErlangObject dir : dirs.elements()) {
                final OtpErlangTuple tdir = (OtpErlangTuple) dir;
                final String dname = ((OtpErlangString) tdir.elementAt(0)).stringValue();
                final OtpErlangList files = (OtpErlangList) tdir.elementAt(1);

                final ErlExternalReferenceEntry subdir = new ErlExternalReferenceEntry(
                        extLib, getLibName(dname), dname, true, includePath(dname));
                extLib.addChild(subdir);
View Full Code Here

            int j = 0;
            for (final ErlangFunction f : functions) {
                funsT[j] = f.getNameArityTuple();
                j++;
            }
            final OtpErlangTuple modFunsT = new OtpErlangTuple(new OtpErlangObject[] {
                    new OtpErlangAtom(i.getImportModule()), new OtpErlangList(funsT) });
            result.add(modFunsT);
        }
        return result;
    }
View Full Code Here

        });
    }

    private void handleEvent(final OtpErlangObject msg) throws TermParserException,
            OtpErlangException {
        final OtpErlangTuple tuple = (OtpErlangTuple) msg;
        final String tag = ((OtpErlangAtom) tuple.elementAt(0)).atomValue();
        final OtpErlangObject value = tuple.elementAt(1);

        TestCaseData test;
        if ("init".equals(tag)) {
            // value = {Dir, Suite, Case}
            label.setText("Started: " + formatTitle(value)
View Full Code Here

        final URI path = getTmpURIPath("");
        pvm.setURIValue(PV, path);
        final OtpErlangList pathVars2 = model.getPathVars(project.getWorkspaceProject());
        assertEquals(n + 1, pathVars2.arity());

        final OtpErlangTuple t = (OtpErlangTuple) pathVars2.elementAt(0);
        final String name = Util.stringValue(t.elementAt(0));
        final String value = pvm.getURIValue(name).getPath();
        String value2 = Util.stringValue(t.elementAt(1));
        if (!value2.startsWith("/")) {
            value2 = "/" + value2;
        }
        assertEquals(value, value2);
    }
View Full Code Here

            for (final IPath sp : sd) {
                dirList[j++] = project.getLocation().toPortableString() + "/" + sp;
            }
            final OtpErlangList res = getSourceClashes(backend, dirList);
            for (int i = 0; i < res.arity(); i++) {
                final OtpErlangTuple t = (OtpErlangTuple) res.elementAt(i);
                final String f1 = ((OtpErlangString) t.elementAt(0)).stringValue();
                final String f2 = ((OtpErlangString) t.elementAt(1)).stringValue();
                MarkerUtils.createProblemMarker(project, null,
                        "duplicated module name in " + f1 + " and " + f2, 0,
                        IMarker.SEVERITY_WARNING);
            }
        } catch (final Exception e) {
View Full Code Here

        if (compilationResult == null) {
            MarkerUtils.createProblemMarker(source, null, "Could not compile file", 0,
                    IMarker.SEVERITY_ERROR);
            return;
        }
        final OtpErlangTuple t = (OtpErlangTuple) compilationResult;

        if ("ok".equals(((OtpErlangAtom) t.elementAt(0)).atomValue())) {
            final String beamf = source.getFullPath().removeFileExtension().lastSegment();
            BuilderHelper.loadModule(project, beamf);
            refreshDirs(project, t.elementAt(2));
        }

        // process compilation messages
        if (t.elementAt(1) instanceof OtpErlangList) {
            final OtpErlangList l = (OtpErlangList) t.elementAt(1);
            MarkerUtils.addErrorMarkers(source, l);
        } else {
            ErlLogger.warn("bad result from builder: %s", t);
        }
View Full Code Here

    @Override
    public OtpErlangObject getOtpDoc(final IOtpRpc b,
            final ErlangFunctionCall functionCall, final String stateDir) {
        OtpErlangObject res = null;
        final OtpErlangTuple input = new OtpErlangTuple(new OtpErlangObject[] {
                new OtpErlangAtom("external"),
                new OtpErlangAtom(functionCall.getModule()),
                new OtpErlangAtom(functionCall.getName()),
                new OtpErlangInt(functionCall.getArity()), new OtpErlangString("") });
        try {
View Full Code Here

    private ErlangAST parse(final String contents, final String encoding) {
        ErlangAST result = null;
        final ParserService parser = ErlangEngine.getInstance().getParserService();
        final OtpErlangObject parsed = parser.parse(createScannerName(), contents);
        if (Util.isOk(parsed)) {
            final OtpErlangTuple tuple = (OtpErlangTuple) parsed;
            result = new ErlangAST((OtpErlangTuple) tuple.elementAt(1));
        }
        return result;
    }
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.