Thrown for a malformed .lex grammar: where (origin, 1-based line, and 1-based byte column in the line when the cause has one) and why.
More...
#include <grammar.hpp>
|
| | grammar_error (const std::string &origin, std::size_t line, std::size_t column, const std::string &cause) |
| | Builds the error.
|
| |
| std::size_t | line () const noexcept |
| | The 1-based line of the offending rule (0 for a grammar-wide error such as no rules).
|
| |
| std::size_t | column () const noexcept |
| | The 1-based byte column in the line, or 0 when the cause has none.
|
| |
| const std::string & | cause () const noexcept |
| | What is wrong, without the location.
|
| |
Thrown for a malformed .lex grammar: where (origin, 1-based line, and 1-based byte column in the line when the cause has one) and why.
what() reads origin:line[:column]: cause, the form compilers and editors recognize, or origin: cause for an error with no line (an unreadable file, a grammar with no rules).
◆ grammar_error()
| scilex::grammar_error::grammar_error |
( |
const std::string & |
origin, |
|
|
std::size_t |
line, |
|
|
std::size_t |
column, |
|
|
const std::string & |
cause |
|
) |
| |
|
inline |
Builds the error.
- Parameters
-
| [in] | origin | Where the grammar came from (a path, or a label such as <string>). |
| [in] | line | The 1-based line of the offending rule. |
| [in] | column | The 1-based byte column in that line, or 0 when the cause has none. |
| [in] | cause | What is wrong, without the location. |
◆ cause()
| const std::string & scilex::grammar_error::cause |
( |
| ) |
const |
|
inlinenoexcept |
What is wrong, without the location.
- Returns
- The cause.
◆ column()
| std::size_t scilex::grammar_error::column |
( |
| ) |
const |
|
inlinenoexcept |
The 1-based byte column in the line, or 0 when the cause has none.
- Returns
- The column.
◆ line()
| std::size_t scilex::grammar_error::line |
( |
| ) |
const |
|
inlinenoexcept |
The 1-based line of the offending rule (0 for a grammar-wide error such as no rules).
- Returns
- The line.
The documentation for this class was generated from the following file: