use of org.erlide.util.erlang.OtpParserException in project erlide_eclipse by erlang.
the class TestCaseData method parseReason.
private FailReason parseReason(final OtpErlangObject reason) {
OtpBindings b;
try {
b = OtpErlang.match("{Cause, Stack}", reason);
if (b == null) {
return new FailReason("internal error: " + reason.toString(), TestCaseData.NO_STACK);
}
final Collection<OtpErlangObject> stack = b.getList("Stack");
return new FailReason(b.get("Cause").toString(), stack);
} catch (final OtpParserException e) {
ErlLogger.warn(e);
} catch (final OtpErlangException e) {
ErlLogger.warn(e);
}
return null;
}
use of org.erlide.util.erlang.OtpParserException in project erlide_eclipse by erlang.
the class CompilerOptions method export.
@SuppressWarnings("unchecked")
public OtpErlangList export() {
final List<OtpErlangObject> result = new ArrayList<>();
for (final CompilerOption option : ALL_OPTIONS) {
final Object optionValue = options.get(option);
if (optionValue != null) {
if (option instanceof BooleanOption) {
final OtpErlangObject val = ((BooleanOption) option).toTerm((Boolean) optionValue);
if (val != null) {
result.add(val);
}
} else if (option instanceof PathsOption) {
final Iterable<String> value = (Iterable<String>) optionValue;
final OtpErlangList val = (OtpErlangList) ((PathsOption) option).toTerm(value);
for (final OtpErlangObject inc : val.elements()) {
result.add(inc);
}
} else if (option instanceof ModuleOption) {
final String value = (String) optionValue;
final OtpErlangObject val = ((ModuleOption) option).toTerm(value);
result.add(val);
} else if (option instanceof RawOption) {
final String value = (String) optionValue;
final OtpErlangList val = (OtpErlangList) ((RawOption) option).toTerm(value);
for (final OtpErlangObject item : val.elements()) {
result.add(item);
}
} else {
try {
final OtpErlangList val = ((DefineOption) option).toTerm((List<Pair<String, String>>) optionValue);
if (val != null) {
result.addAll(Lists.newArrayList(val.elements()));
}
} catch (final OtpParserException e) {
ErlLogger.warn(e);
}
}
}
}
final OtpErlangList list = OtpErlang.mkList(result);
return list;
}
use of org.erlide.util.erlang.OtpParserException in project erlide_eclipse by erlang.
the class ErlideDebug method setVariableValue.
@SuppressWarnings("boxing")
public static String setVariableValue(final IOtpRpc backend, final String name, final String value, final int stackFrameNo, final OtpErlangPid meta) {
try {
final OtpErlangObject res = backend.call(ErlideDebug.ERLIDE_DEBUG, "set_variable_value", "ssix", name, value, stackFrameNo + 1, meta);
try {
final OtpBindings bind = OtpErlang.match("{eval_rsp, {'EXIT', Val}}", res);
if (bind == null) {
return null;
}
final String err = bind.getAsString("Val");
return err;
} catch (final OtpParserException e1) {
}
return null;
} catch (final RpcException e) {
ErlLogger.warn(e);
}
return "error";
}
Aggregations