use of org.erlide.engine.internal.model.erlang.ErlAttribute in project erlide_eclipse by erlang.
the class ErlParser method addModuleAttribute.
private IErlAttribute addModuleAttribute(final IErlModule module, final OtpErlangObject pos, final OtpErlangAtom value, final OtpErlangObject extra, final String nameS) {
final String s = Util.stringValue(extra);
final ErlAttribute r = new ErlAttribute(module, nameS, value, s);
setPos(r, pos);
return r;
}
use of org.erlide.engine.internal.model.erlang.ErlAttribute in project erlide_eclipse by erlang.
the class IParentTest method addChild.
// void addChild(IErlElement child);
@Test
public void addChild() throws Exception {
module.open(null);
final int childCount = module.getChildCount();
final String aname = "test_a";
final IErlAttribute attribute = new ErlAttribute(module, aname, null, "test");
module.addChild(attribute);
final int childCount2 = module.getChildCount();
final IErlElement childNamed = module.getChildNamed(aname);
assertEquals(childCount + 1, childCount2);
assertEquals(attribute, childNamed);
}
use of org.erlide.engine.internal.model.erlang.ErlAttribute in project erlide_eclipse by erlang.
the class ErlParser method addOtherAttribute.
private IErlAttribute addOtherAttribute(final IErlModule module, final OtpErlangObject pos, final OtpErlangObject val, final OtpErlangObject extra, final String nameS) {
// user-defined attribute? or maybe if else endif...
// OtpErlangObject val1 = concreteTerm(val);
// if (val instanceof OtpErlangList) {
// final OtpErlangList list = (OtpErlangList) val;
// if (list.arity() == 0) {
// val1 = null;
// }
// }
// final ErlAttribute a = new ErlAttribute(parent, nameS, val1, null);
OtpErlangObject o = val;
if (o instanceof OtpErlangAtom) {
final OtpErlangAtom u = (OtpErlangAtom) o;
if ("u".equals(u.atomValue())) {
o = null;
}
}
final ErlAttribute a = new ErlAttribute(module, nameS, o, Util.stringValue(extra));
setPos(a, pos);
// a.setParseTree(val);
return a;
}
use of org.erlide.engine.internal.model.erlang.ErlAttribute in project erlide_eclipse by erlang.
the class TestingSupport method createErlAttribute.
public static IErlElement createErlAttribute(final IParent parent, final String name, final OtpErlangObject value, final String extra, final int sourceRangeOffset, final int sourceRangeLength) {
final ErlAttribute attribute = new ErlAttribute(parent, name, value, extra);
attribute.setSourceRangeOffset(sourceRangeOffset);
attribute.setSourceRangeLength(sourceRangeLength);
return attribute;
}
use of org.erlide.engine.internal.model.erlang.ErlAttribute in project erlide_eclipse by erlang.
the class IParentTest method setChildren.
// public void setChildren(final Collection<? extends IErlElement>
// children);
@Test
public void setChildren() throws Exception {
module.open(null);
final List<IErlElement> children = module.getChildren();
final String aname = "test_a";
final IErlAttribute attribute = new ErlAttribute(module, aname, null, "test");
module.setChildren(Lists.newArrayList(attribute));
final int childCount = module.getChildCount();
final List<IErlElement> children2 = module.getChildren();
final IErlElement element = children2.iterator().next();
assertEquals(1, childCount);
assertFalse(children2.equals(children));
assertEquals(attribute, element);
}
Aggregations