Reset the lexer, and create the tokens from the file: 'cirFileName'. :param cirFileName: Name of the netlist file to be tokenized. :type cirFileName: str :return: list with title line, command liness, or element definition lines. Each line consists of a list of token
(netlist)
| 239 | return out |
| 240 | |
| 241 | def _tokenize(netlist): |
| 242 | """ |
| 243 | Reset the lexer, and create the tokens from the file: 'cirFileName'. |
| 244 | |
| 245 | :param cirFileName: Name of the netlist file to be tokenized. |
| 246 | :type cirFileName: str |
| 247 | |
| 248 | :return: list with title line, command liness, or element definition lines. |
| 249 | |
| 250 | Each line consists of a list of tokens |
| 251 | |
| 252 | :rtype: list |
| 253 | """ |
| 254 | # Initialize the lexer |
| 255 | lexer.errCount = 0 |
| 256 | lexer.lineno = 0 |
| 257 | lexer.input(netlist) |
| 258 | lines = [] |
| 259 | lastLine = [] |
| 260 | tok = lexer.token() |
| 261 | while tok: |
| 262 | if tok.type != 'NEWLINE' and tok.type != 'PLUS': |
| 263 | lastLine.append(tok) |
| 264 | elif tok.type == 'NEWLINE': |
| 265 | if len(lastLine) != 0: |
| 266 | lines.append(lastLine) |
| 267 | lastLine = [] |
| 268 | elif tok.type == 'PLUS': |
| 269 | lastLine = lines[-1] |
| 270 | del lines[-1] |
| 271 | tok = lexer.token() |
| 272 | return lines, lexer.errCount |
| 273 | |
| 274 | def _printError(msg, tok): |
| 275 | """ |
no outgoing calls
no test coverage detected