cparse  1.1.0
A small hand-written recursive-descent parser core for C++
fedem::parser::ParseError Struct Reference

A single diagnostic produced during parsing. More...

#include <Parser.hh>

Public Types

enum class  Kind {
  Syntax , Type , Faulty , Internal ,
  Warning
}
 Severity / category of a #ParseError. More...
 

Public Attributes

Kind kind { Kind::Internal }
 Severity / category.
 
std::string message
 Human-readable description.
 
std::string filename
 Source file the error is in.
 
unsigned long int line { 0 }
 1-based line, or 0 if unknown.
 
unsigned long int col { 0 }
 1-based column, or 0 if unknown.
 

Detailed Description

A single diagnostic produced during parsing.

Records are appended to the collector by Parser::recordError() and read back through Parser::errors() after parse() returns. A record carries its severity (Kind), a message, and the source location it was raised at (filename / line / column, filled from the cursor when the caller passes 0).

See also
https://cparse.fedem.eu/reference/parse-error — reference manual page.
Parser::errors

Member Enumeration Documentation

◆ Kind

Severity / category of a #ParseError.

Enumerator
Syntax 

Malformed token sequence.

Type 

Type mismatch / undefined identifier.

Faulty 

Ill-formed expression (e.g. nested comment terminator).

Internal 

Parser-internal assertion / unexpected state.

Warning 

Non-fatal diagnostic; parsing continues.


The documentation for this struct was generated from the following file: