p.setOutput(parts.get(4).equals("output)"));
pins.add(p);
}
for(int i = 0; i < elementCount; i++){
readLine();
Element e = new Element();
e.setName(parts.get(2));
int elementPinCount = Integer.parseInt(parts.get(3).replace(")", ""));
e.setBel(parts.size() > 5 && parts.get(4).equals("#") && parts.get(5).equals("BEL"));
for(int j = 0; j < elementPinCount; j++){
readLine();
PrimitiveDefPin elementPin = new PrimitiveDefPin();
elementPin.setInternalName(parts.get(2));
elementPin.setOutput(parts.get(3).equals("output)"));
e.addPin(elementPin);
}
while(!readLine().startsWith("\t\t)")){
if(line.startsWith("\t\t\t(cfg ")){
for(int k = 2; k < parts.size(); k++){
e.addCfgOption(parts.get(k).replace(")", ""));
}
}
else if(line.startsWith("\t\t\t(conn ")){
Connection c = new Connection();
c.setElement0(parts.get(2));
c.setPin0(parts.get(3));
c.setForwardConnection(parts.get(4).equals("==>"));
c.setElement1(parts.get(5));
c.setPin1(parts.get(6).substring(0, parts.get(6).length() - 1));
e.addConnection(c);
}
}
elements.add(e);
}
def.setPins(pins);