A container for CompilerError instances generated by the various components of the Bond compiler.
More...
#include <bond/compiler/compilererror.h>
|
| | CompilerErrorBuffer () |
| | Default constructs an empty CompilerErrorBuffer object.
|
| void | Reset () |
| | Clears the contents of the error buffer.
|
| void | PushError (CompilerError::Type type, const Token *context=nullptr, const void *arg0=nullptr, const void *arg1=nullptr) |
| | Constructs a CompilerError object with the given type and pointer arguments to format the error message and adds it to the buffer, unless the buffer is full.
|
| void | PushErrorInt (CompilerError::Type type, const Token *context=nullptr, intptr_t arg0=0, intptr_t arg1=0) |
| | Constructs a CompilerError object with the given type and integer arguments to format the error message and adds it to the buffer, unless the buffer is full.
|
| bool | HasErrors () const |
| | Returns whether the buffer contains any errors.
|
| size_t | GetNumErrors () const |
| | Returns the number of errors in the buffer.
|
| void | Truncate (size_t numErrors) |
| | Discards the errors pushed after the buffer contained the given number of errors.
|
| const CompilerError & | GetError (size_t index) const |
| | Returns the CompilerError at the specified index in the buffer.
|
| void | CopyFrom (const CompilerErrorBuffer &other) |
| | Appends the contents of the given CompilerErrorBuffer to this one. Errors that do not fit are dropped.
|
| void | Print (OutputStream &stream) const |
| | Prints a formatted error message for each error, each followed by a newline, to the given OutputStream.
|
A container for CompilerError instances generated by the various components of the Bond compiler.
A CompilerErrorBuffer is used by the Lexer, Parser, SemanticAnalyzer and CodeGenerator of the Bond compiler to collect the errors that they detect. The CompilerErrorBuffer provides functionality for printing formatted error messages to an OutputStream.
The size of the buffer is fixed at 64 errors, and no memory allocations are incurred. If the buffer overflows, any additional errors are dropped since they are not considered relevant because they are most likely the consequence of the compiler being confused by the initial set of errors that caused the buffer to fill up.
- See also
- CodeGenerator, CompilerError, Lexer, Parser, SemanticAnalyzer
◆ CompilerErrorBuffer()
| Bond::CompilerErrorBuffer::CompilerErrorBuffer |
( |
| ) |
|
◆ CopyFrom()
Appends the contents of the given CompilerErrorBuffer to this one. Errors that do not fit are dropped.
- Parameters
-
◆ GetError()
| const CompilerError & Bond::CompilerErrorBuffer::GetError |
( |
size_t | index | ) |
const |
|
inline |
Returns the CompilerError at the specified index in the buffer.
- Parameters
-
| index | The index of the error to be retrieved. |
◆ GetNumErrors()
| size_t Bond::CompilerErrorBuffer::GetNumErrors |
( |
| ) |
const |
|
inline |
Returns the number of errors in the buffer.
◆ HasErrors()
| bool Bond::CompilerErrorBuffer::HasErrors |
( |
| ) |
const |
|
inline |
Returns whether the buffer contains any errors.
◆ Print()
| void Bond::CompilerErrorBuffer::Print |
( |
OutputStream & | stream | ) |
const |
Prints a formatted error message for each error, each followed by a newline, to the given OutputStream.
- Parameters
-
| stream | The OutputStream to which the error messages are printed. |
◆ PushError()
| void Bond::CompilerErrorBuffer::PushError |
( |
CompilerError::Type | type, |
|
|
const Token * | context = nullptr, |
|
|
const void * | arg0 = nullptr, |
|
|
const void * | arg1 = nullptr ) |
◆ PushErrorInt()
| void Bond::CompilerErrorBuffer::PushErrorInt |
( |
CompilerError::Type | type, |
|
|
const Token * | context = nullptr, |
|
|
intptr_t | arg0 = 0, |
|
|
intptr_t | arg1 = 0 ) |
◆ Reset()
| void Bond::CompilerErrorBuffer::Reset |
( |
| ) |
|
Clears the contents of the error buffer.
◆ Truncate()
| void Bond::CompilerErrorBuffer::Truncate |
( |
size_t | numErrors | ) |
|
|
inline |
Discards the errors pushed after the buffer contained the given number of errors.
- Parameters
-
| numErrors | The number of errors to retain. Has no effect if it is not smaller than the current number of errors. |
The documentation for this class was generated from the following file:
- include/bond/compiler/compilererror.h