Conditions | 2 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 1 |
CRAP Score | 4.8094 |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | """ |
||
47 | 1 | def _error(self, message, token=None): |
|
48 | """ |
||
49 | Logs an error. |
||
50 | |||
51 | :param str message: The error message.This message will be appended with 'at filename:line.column' ot the token. |
||
52 | :param antlr4.Token.CommonToken token: The token where the error occurred. |
||
53 | """ |
||
54 | self._errors += 1 |
||
55 | |||
56 | filename = token.getInputStream().fileName # Replace fileName with get_source_name() when implemented in ANTLR. |
||
57 | line_number = token.line |
||
58 | column_number = token.column + 1 |
||
59 | messages = [message] |
||
60 | if token: |
||
61 | messages.append('Position: {0!s}:{1:d}.{2:d}'.format(filename, line_number, column_number)) |
||
62 | self._io.error(messages) |
||
63 | |||
66 |