Bitstream Interpretation Library (BIL)  0.1
XDLRCParserImp4.cpp
Go to the documentation of this file.
1 
10 
11 using namespace bil;
12 using namespace bil::xdlrcparser_detail;
13 
14 
15 void XDLRCParserImp::parseTileSummary()
16 {
17  // skip site name
18  if (StreamTokenizer::TT_WORD != m_tok->nextToken()) throw Exception();
19 
20  // skip site type
21  if (StreamTokenizer::TT_WORD != m_tok->nextToken()) throw Exception();
22 
23  // skip pin count
24  if (StreamTokenizer::TT_WORD != m_tok->nextToken()) throw Exception();
25  size_t count;
26  if (!m_tok->uintToken(count)) throw Exception();
27 
28  // skip wire count
29  if (StreamTokenizer::TT_WORD != m_tok->nextToken()) throw Exception();
30  if (!m_tok->uintToken(count)) throw Exception();
31 
32  // skip pip count
33  if (StreamTokenizer::TT_WORD != m_tok->nextToken()) throw Exception();
34  if (!m_tok->uintToken(count)) throw Exception();
35 
36  // skip closing parenthesis
37  if (StreamTokenizer::TT_SEPARATOR != m_tok->nextToken()) throw Exception();
38  if (')' != m_tok->separatorToken()) throw Exception();
39 }
40 
41 
42 void XDLRCParserImp::parseSummary()
43 {
44  // skip keyword
45  if (StreamTokenizer::TT_WORD != m_tok->nextToken()) throw Exception();
46  if (strcmp(m_tok->wordToken(), XDLRCKeywords::TILES) != 0) throw Exception();
47  // skip equal sign
48  if (StreamTokenizer::TT_SEPARATOR != m_tok->nextToken()) throw Exception();
49  if ('=' != m_tok->separatorToken()) throw Exception();
50  // skip tile count
51  size_t count;
52  if (StreamTokenizer::TT_WORD != m_tok->nextToken()) throw Exception();
53  if (!m_tok->uintToken(count)) throw Exception();
54 
55  // skip keyword
56  if (StreamTokenizer::TT_WORD != m_tok->nextToken()) throw Exception();
57  if (strcmp(m_tok->wordToken(), XDLRCKeywords::SITES) != 0) throw Exception();
58  // skip equal sign
59  if (StreamTokenizer::TT_SEPARATOR != m_tok->nextToken()) throw Exception();
60  if ('=' != m_tok->separatorToken()) throw Exception();
61  // skip primitive site count
62  if (StreamTokenizer::TT_WORD != m_tok->nextToken()) throw Exception();
63  if (!m_tok->uintToken(count)) throw Exception();
64 
65  // skip keyword
66  if (StreamTokenizer::TT_WORD != m_tok->nextToken()) throw Exception();
67  if (strcmp(m_tok->wordToken(), XDLRCKeywords::SITEDEFS) != 0) throw Exception();
68  // skip equal sign
69  if (StreamTokenizer::TT_SEPARATOR != m_tok->nextToken()) throw Exception();
70  if ('=' != m_tok->separatorToken()) throw Exception();
71  // skip primitive definition count
72  if (StreamTokenizer::TT_WORD != m_tok->nextToken()) throw Exception();
73  if (!m_tok->uintToken(count)) throw Exception();
74 
75  // skip closing parenthesis (summary may end here)
76  if ((StreamTokenizer::TT_SEPARATOR == m_tok->nextToken()) &&
77  (')' == m_tok->separatorToken())) return;
78  // skip keyword
79  if (StreamTokenizer::TT_WORD != m_tok->tokenType()) throw Exception();
80  if (strcmp(m_tok->wordToken(), XDLRCKeywords::NUMPINS) != 0) throw Exception();
81  // skip equal sign
82  if (StreamTokenizer::TT_SEPARATOR != m_tok->nextToken()) throw Exception();
83  if ('=' != m_tok->separatorToken()) throw Exception();
84  // skip pin definition count
85  if (StreamTokenizer::TT_WORD != m_tok->nextToken()) throw Exception();
86  if (!m_tok->uintToken(count)) throw Exception();
87 
88  // skip closing parenthesis (summary may end here)
89  if ((StreamTokenizer::TT_SEPARATOR == m_tok->nextToken()) &&
90  (')' == m_tok->separatorToken())) return;
91  // skip keyword
92  if (StreamTokenizer::TT_WORD != m_tok->tokenType()) throw Exception();
93  if (strcmp(m_tok->wordToken(), XDLRCKeywords::NUMPIPS) != 0) throw Exception();
94  // skip equal sign
95  if (StreamTokenizer::TT_SEPARATOR != m_tok->nextToken()) throw Exception();
96  if ('=' != m_tok->separatorToken()) throw Exception();
97  // skip pin definition count
98  if (StreamTokenizer::TT_WORD != m_tok->nextToken()) throw Exception();
99  if (!m_tok->uintToken(count)) throw Exception();
100 
101  // skip closing parenthesis
102  if (StreamTokenizer::TT_SEPARATOR != m_tok->nextToken()) throw Exception();
103  if (')' != m_tok->separatorToken()) throw Exception();
104 }