GCC Code Coverage Report


Directory: ../
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 1 / 0 / 1
Functions: 100.0% 1 / 0 / 1
Branches: -% 0 / 0 / 0

src/exception/AntlrThrowingErrorListener.h
Line Branch Exec Source
1 // Copyright (c) 2021-2026 ChilliBits. All rights reserved.
2
3 #pragma once
4
5 #include <BaseErrorListener.h>
6
7 namespace spice::compiler {
8
9 // Forward declarations
10 class SourceFile;
11
12 enum class ThrowingErrorListenerMode : uint8_t {
13 LEXER,
14 PARSER,
15 };
16
17 class AntlrThrowingErrorListener final : public antlr4::BaseErrorListener {
18 public:
19 // Constructors
20 2477 AntlrThrowingErrorListener(ThrowingErrorListenerMode mode, SourceFile *sourceFile) : mode(mode), sourceFile(sourceFile) {}
21
22 // Public methods
23 void syntaxError(antlr4::Recognizer *recognizer, antlr4::Token *offendingSymbol, size_t line, size_t charPositionInLine,
24 const std::string &msg, std::exception_ptr e) override;
25
26 private:
27 // Private members
28 ThrowingErrorListenerMode mode;
29 SourceFile *sourceFile;
30 };
31
32 } // namespace spice::compiler
33