use of org.erlide.engine.internal.model.erlang.ErlMacroDef in project erlide_eclipse by erlang.
the class ErlParser method addMacroDef.
private IErlMember addMacroDef(final IErlModule module, final OtpErlangObject pos, final OtpErlangObject val, final OtpErlangObject extra, final String nameS) {
if (val instanceof OtpErlangAtom) {
final String s = Util.stringValue(extra);
final ErlMember r = new ErlMacroDef(module, ((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);
}
ErlMember r;
if (o instanceof OtpErlangAtom) {
final String macroName = ((OtpErlangAtom) o).atomValue();
r = new ErlMacroDef(module, macroName, null);
} else {
// what do we do here? the define isn't correct
// Erlang...
ErlLogger.warn("Strange macro definition in %s: %s", module.getName(), o.toString());
r = new ErlMacroDef(module, o.toString(), null);
}
setPos(r, pos);
// r.setParseTree(val);
return r;
}
}
return addOtherAttribute(module, pos, val, extra, nameS);
}
Aggregations