lib-ruby-parser (C++ bindings)  4.0.1+ruby-3.1.1
C++ bindings for lib-ruby-parser library
diagnostic.hpp
Go to the documentation of this file.
1 #ifndef LIB_RUBY_PARSER_DIAGNOSTIC_HPP
2 #define LIB_RUBY_PARSER_DIAGNOSTIC_HPP
3 
4 #include <cstddef>
5 #include "messages.hpp"
6 #include "loc.hpp"
7 #include "decoded_input.hpp"
8 
9 namespace lib_ruby_parser
10 {
12  enum class ErrorLevel
13  {
14  WARNING,
15  ERROR
16  };
17 
19  class Diagnostic
20  {
21  public:
24 
27 
30 
31  Diagnostic() = delete;
33 
34  Diagnostic(const Diagnostic &) = delete;
35  Diagnostic &operator=(Diagnostic const &) = delete;
36 
37  Diagnostic(Diagnostic &&) = default;
38  Diagnostic &operator=(Diagnostic &&) = default;
39 
43  std::string render(const DecodedInput &input) const;
44  };
45 
48  {
49  public:
51  size_t capacity;
52  size_t len;
53 
54  DiagnosticList() = delete;
55  DiagnosticList(Diagnostic *ptr, size_t len, size_t capacity);
57 
58  DiagnosticList(const DiagnosticList &) = delete;
59  DiagnosticList &operator=(DiagnosticList const &) = delete;
60 
63  };
64 } // namespace lib_ruby_parser
65 
66 #endif // LIB_RUBY_PARSER_DIAGNOSTIC_HPP
lib_ruby_parser::Loc
Loc struct from lib-ruby-parser
Definition: loc.hpp:12
lib_ruby_parser::ErrorLevel::ERROR
@ ERROR
lib_ruby_parser::DiagnosticList::operator=
DiagnosticList & operator=(DiagnosticList const &)=delete
lib_ruby_parser::Diagnostic::Diagnostic
Diagnostic()=delete
lib_ruby_parser::DiagnosticMessage
Definition: messages.hpp:1708
decoded_input.hpp
lib_ruby_parser::DiagnosticList::~DiagnosticList
~DiagnosticList()
lib_ruby_parser::Diagnostic::render
std::string render(const DecodedInput &input) const
lib_ruby_parser::Diagnostic::message
DiagnosticMessage message
Message of the diagnsotic.
Definition: diagnostic.hpp:26
lib_ruby_parser::DiagnosticList::ptr
Diagnostic * ptr
Definition: diagnostic.hpp:50
lib_ruby_parser::DiagnosticList::capacity
size_t capacity
Definition: diagnostic.hpp:51
lib_ruby_parser::Diagnostic::operator=
Diagnostic & operator=(Diagnostic const &)=delete
lib_ruby_parser::DecodedInput
Equivalent of lib_ruby_parser::source::DecodedInput
Definition: decoded_input.hpp:11
lib_ruby_parser::DiagnosticList::DiagnosticList
DiagnosticList()=delete
lib_ruby_parser::ErrorLevel::WARNING
@ WARNING
lib_ruby_parser
Definition: api.hpp:7
lib_ruby_parser::Diagnostic::loc
Loc loc
Location of the diagnostic.
Definition: diagnostic.hpp:29
lib_ruby_parser::ErrorLevel
ErrorLevel
Equivalent of lib_ruby_parser::ErrorLevel
Definition: diagnostic.hpp:12
lib_ruby_parser::Diagnostic::level
ErrorLevel level
Level of the diagnostic (error/warning)
Definition: diagnostic.hpp:23
lib_ruby_parser::DiagnosticList::len
size_t len
Definition: diagnostic.hpp:52
lib_ruby_parser::DiagnosticList
Equivalent of Vec<lib_ruby_parser::Diagnostic
Definition: diagnostic.hpp:47
lib_ruby_parser::Diagnostic
Equivalent of lib_ruby_parser::Diagnostic
Definition: diagnostic.hpp:19
messages.hpp
loc.hpp