12 using namespace bil::xdlparser_detail;
15 void XDLParserImp::parseInstance()
19 addInstance(m_quoteBuffer);
23 m_instance->primitiveTypeIndex(findPrimitiveType(m_quoteBuffer));
27 if (
',' != m_tok->separatorToken())
throw Exception();
31 const char* keyword = m_tok->wordToken();
35 m_instance->placed(
true);
36 m_instance->bonded(
false);
40 size_t tileIndex = findTile(m_tok->wordToken());
41 m_instance->tileIndex(tileIndex);
45 size_t siteIndex = findPrimitiveSite(m_tok->wordToken(), tileIndex);
46 m_instance->primitiveSiteIndex(siteIndex);
50 if (
',' != m_tok->separatorToken())
throw Exception();
55 m_instance->placed(
false);
61 m_instance->bonded(
true);
62 if (
',' != m_tok->separatorToken())
throw Exception();
67 keyword = m_tok->wordToken();
74 if (
',' != m_tok->separatorToken())
throw Exception();
86 (m_instance->attributes()).assign(m_quoteBuffer);
90 if (
';' != m_tok->separatorToken())
throw Exception();
94 void XDLParserImp::parseNet()
98 addNet(m_quoteBuffer);
100 PinRefs& pinRefs = m_net->pinRefs();
101 PIPRefs& pipRefs = m_net->pipRefs();
111 if (
',' != m_tok->separatorToken())
throw Exception();
119 if (
',' != m_tok->separatorToken())
throw Exception();
123 const char* keyword = 0;
128 tokenType = m_tok->nextToken();
130 keyword = m_tok->wordToken();
137 size_t instanceIndex = findInstance(m_quoteBuffer);
142 size_t pinIndex = findPin(m_tok->wordToken(), instanceIndex);
146 pinRefs.push_back(pinRef);
150 if (
',' != m_tok->separatorToken())
throw Exception();
162 size_t instanceIndex = findInstance(m_quoteBuffer);
167 size_t pinIndex = findPin(m_tok->wordToken(), instanceIndex);
171 pinRefs.push_back(pinRef);
175 if (
',' != m_tok->separatorToken())
throw Exception();
178 tokenType = m_tok->nextToken();
180 keyword = m_tok->wordToken();
194 size_t tileIndex = findTile(m_tok->wordToken());
197 const Tile& tile = m_tiles->at(tileIndex);
205 size_t wireIndex = findWire(m_tok->wordToken(), wireMap);
209 m_tok->wordChar(
'=');
210 m_tok->wordChar(
'>');
213 m_tok->separatorChar(
'=');
214 m_tok->separatorChar(
'>');
218 wireIndex = findWire(m_tok->wordToken(), wireMap);
219 pip.
endWireIndex(static_cast<unsigned short>(wireIndex));
222 pipRef.
pipIndex(findPIP(pip, pipMap));
223 pipRefs.push_back(pipRef);
227 if (
',' != m_tok->separatorToken())
throw Exception();
230 tokenType = m_tok->nextToken();
232 keyword = m_tok->wordToken();
242 (m_net->attributes()).assign(m_quoteBuffer);
245 if (
',' != m_tok->separatorToken())
throw Exception();
247 tokenType = m_tok->nextToken();
252 if (
';' != m_tok->separatorToken())
throw Exception();
256 void XDLParserImp::parseQuotedString()
259 char* quotePtr = m_quoteBuffer;
260 char* quoteBufferEnd = quotePtr + QUOTE_BUFFER_SIZE;
264 if (
'"' != m_tok->separatorToken())
throw Exception();
267 m_tok->resetSyntax();
268 bool escapeChar =
false;
274 char c = m_tok->separatorToken();
282 if (quotePtr < quoteBufferEnd) *(quotePtr++) =
'"';
286 if (quotePtr < quoteBufferEnd) *(quotePtr++) =
'\\';
287 if (quotePtr < quoteBufferEnd) *(quotePtr++) = c;
293 else if (
'\\' == c) escapeChar =
true;
296 if (quotePtr < quoteBufferEnd) *(quotePtr++) = c;