Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangList


                try {
                    OtpErlangObject matchSpec = null;
                    if (tracePattern.getMatchSpec().getMsObject() != null) {
                        matchSpec = tracePattern.getMatchSpec().getMsObject();
                    } else {
                        matchSpec = new OtpErlangList();
                    }
                    if (tracePattern.getArity() < 0) {
                        tracerBackend.getOtpRpc().call(Constants.TTB_MODULE, function,
                                "aax", tracePattern.getModuleName(),
                                tracePattern.getFunctionName(), matchSpec);
View Full Code Here


    public List<IStackFrame> getStackFrames(final IDebugTarget target,
            final IThread process) {
        // XXX JC copy paste
        final OtpErlangTuple tuple = getTuple();
        final OtpErlangList erlStackFrames = (OtpErlangList) tuple.elementAt(2);
        final OtpErlangTuple t2 = (OtpErlangTuple) tuple.elementAt(1);
        final OtpErlangTuple ieval = (OtpErlangTuple) t2.elementAt(0);
        OtpErlangAtom m = (OtpErlangAtom) ieval.elementAt(3);
        OtpErlangList bindings = (OtpErlangList) t2.elementAt(t2.arity() - 1);
        OtpErlangLong l = (OtpErlangLong) ieval.elementAt(1);
        final List<IStackFrame> stackFrames = new ArrayList<IStackFrame>(
                erlStackFrames.arity() + 1);
        for (final OtpErlangObject o : erlStackFrames) {
            final OtpErlangTuple t = (OtpErlangTuple) o;
View Full Code Here

            final boolean initialParse, final String path, final String initialText,
            final boolean updateSearchServer) {
        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);
        } else {
            final List<IErlElement> children = createForms(module, forms);
            module.setChildren(children);
        }
        if (comments == null) {
            module.setComments(null);
        } else {
            final List<IErlComment> moduleComments = createComments(module, comments);
            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();
            }
        }
        if (TRACE) {
            ErlLogger.debug("Parsed %d forms and %d comments (%s)",
                    forms != null ? forms.arity() : 0,
                    comments != null ? comments.arity() : 0, cached);
        }
        return forms != null && comments != null;
    }
View Full Code Here

            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

     */
    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());
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 {
View Full Code Here

    }

    private IErlMember addExportAttribute(final IErlModule module,
            final OtpErlangObject pos, final OtpErlangObject val,
            final OtpErlangObject extra) {
        final OtpErlangList functionList = (OtpErlangList) val;
        final ErlExport ex = new ErlExport(module, functionList, Util.stringValue(extra));
        setPos(ex, pos);
        return ex;
    }
View Full Code Here

                    ((OtpErlangAtom) val).atomValue(), s);
            setPos(r, pos);
            // 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);
                }
View Full Code Here

        if (val instanceof OtpErlangTuple) {
            final OtpErlangTuple recordTuple = (OtpErlangTuple) val;
            if (recordTuple.elementAt(0) instanceof OtpErlangAtom) {
                final String s = extra instanceof OtpErlangString ? ((OtpErlangString) extra)
                        .stringValue() : null;
                final OtpErlangList fields = (OtpErlangList) recordTuple.elementAt(1);
                final ErlRecordDef r = new ErlRecordDef(module, null, s);
                setPos(r, pos);
                if (fields != null) {
                    final List<ErlRecordField> children = Lists
                            .newArrayListWithCapacity(fields.arity());
                    for (final OtpErlangObject o : fields) {
                        if (o instanceof OtpErlangTuple) {
                            final OtpErlangTuple fieldTuple = (OtpErlangTuple) o;
                            final OtpErlangAtom fieldNameAtom = (OtpErlangAtom) fieldTuple
                                    .elementAt(0);
View Full Code Here

            final OtpErlangObject pos, final OtpErlangObject val) {
        final OtpErlangTuple t = (OtpErlangTuple) val;
        if (t.elementAt(0) instanceof OtpErlangAtom
                && t.elementAt(1) instanceof OtpErlangList) {
            final OtpErlangAtom importModule = (OtpErlangAtom) t.elementAt(0);
            final OtpErlangList functionList = (OtpErlangList) t.elementAt(1);
            final ErlImport imp = new ErlImport(module, importModule.atomValue(),
                    functionList);
            setPos(imp, pos);
            return imp;
        }
View Full Code Here

TOP

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

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.