Conditions | 2 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | """ |
||
39 | def _error(self, message, token): |
||
40 | """ |
||
41 | Logs an error. |
||
42 | |||
43 | :param str message: The error message.this message will be appended with 'at filename:line.column' ot the token. |
||
44 | :param antlr4.Token.CommonToken token: The token where the error occurred. |
||
45 | """ |
||
46 | self._errors += 1 |
||
47 | |||
48 | filename = token.getInputStream().fileName # Replace fileName with get_source_name() when implemented in ANTLR. |
||
49 | line_number = token.line |
||
50 | column_number = token.column + 1 |
||
51 | if token: |
||
52 | print("Error at {0!s}:{1:d}.{2:d}:".format(filename, line_number, column_number)) |
||
53 | print(message) |
||
54 | |||
56 |