| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Copyright (c) 2021-2025 ChilliBits. All rights reserved. | ||
| 2 | |||
| 3 | #include "AntlrThrowingErrorListener.h" | ||
| 4 | |||
| 5 | #include <exception/LexerError.h> | ||
| 6 | #include <exception/ParserError.h> | ||
| 7 | #include <util/CodeLoc.h> | ||
| 8 | |||
| 9 | namespace spice::compiler { | ||
| 10 | |||
| 11 | 3 | void AntlrThrowingErrorListener::syntaxError(antlr4::Recognizer *recognizer, antlr4::Token *offendingSymbol, size_t line, | |
| 12 | size_t charPositionInLine, const std::string &msg, std::exception_ptr e) { | ||
| 13 |
1/2✓ Branch 2 → 3 taken 3 times.
✗ Branch 2 → 16 not taken.
|
3 | const CodeLoc codeLoc(line, charPositionInLine, sourceFile); |
| 14 |
2/2✓ Branch 3 → 4 taken 1 time.
✓ Branch 3 → 7 taken 2 times.
|
3 | if (mode == ThrowingErrorListenerMode::LEXER) |
| 15 |
1/2✓ Branch 5 → 6 taken 1 time.
✗ Branch 5 → 10 not taken.
|
1 | throw LexerError(codeLoc, TOKENIZING_FAILED, msg); |
| 16 | else | ||
| 17 |
1/2✓ Branch 8 → 9 taken 2 times.
✗ Branch 8 → 13 not taken.
|
2 | throw ParserError(codeLoc, PARSING_FAILED, msg); |
| 18 | } | ||
| 19 | |||
| 20 | } // namespace spice::compiler | ||
| 21 |