summaryrefslogtreecommitdiffstats
path: root/yql/essentials/parser/common/error.h
diff options
context:
space:
mode:
authorVictor Smirnov <[email protected]>2025-03-19 13:03:56 +0300
committerrobot-piglet <[email protected]>2025-03-19 13:18:48 +0300
commit28b29535ce7b21a3dde60b485c98f66f8c08f882 (patch)
treeb831ec57225a22c3241a443eccc20af1053fc561 /yql/essentials/parser/common/error.h
parent6c4b9a2b45127baabf73cdcb6323f3e3e09e5440 (diff)
YQL-19616 Implement ILexer via antlr_ast
- [x] Added `antlr_ast/antlr4` module and moved `TLexerTokensCollector4` there from `proto_ast/antlr4`. - [x] Moved stuff around back and forth. Ready for a review. --- Co-authored-by: vityaman [[email protected]] Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1128 commit_hash:e08785c3408ef813505bdc7511560e9536f4ab79
Diffstat (limited to 'yql/essentials/parser/common/error.h')
-rw-r--r--yql/essentials/parser/common/error.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/yql/essentials/parser/common/error.h b/yql/essentials/parser/common/error.h
new file mode 100644
index 00000000000..281d745a5bf
--- /dev/null
+++ b/yql/essentials/parser/common/error.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#include <util/generic/yexception.h>
+#include <util/generic/fwd.h>
+
+namespace NAST {
+ static const char* INVALID_TOKEN_NAME = "nothing";
+ static const char* ABSENCE = " absence";
+
+ class TTooManyErrors: public yexception {
+ };
+
+ class IErrorCollector {
+ public:
+ explicit IErrorCollector(size_t maxErrors);
+ virtual ~IErrorCollector();
+
+ // throws TTooManyErrors
+ void Error(ui32 line, ui32 col, const TString& message);
+
+ private:
+ virtual void AddError(ui32 line, ui32 col, const TString& message) = 0;
+
+ protected:
+ const size_t MaxErrors;
+ size_t NumErrors;
+ };
+
+ class TErrorOutput: public IErrorCollector {
+ public:
+ TErrorOutput(IOutputStream& err, const TString& name, size_t maxErrors);
+ virtual ~TErrorOutput();
+
+ private:
+ void AddError(ui32 line, ui32 col, const TString& message) override;
+
+ public:
+ IOutputStream& Err;
+ TString Name;
+ };
+
+} // namespace NAST