mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Collected pos, line, and column into a Mark struct
This commit is contained in:
10
src/exp.cpp
10
src/exp.cpp
@@ -7,7 +7,7 @@ namespace YAML
|
||||
{
|
||||
namespace Exp
|
||||
{
|
||||
unsigned ParseHex(const std::string& str, int line, int column)
|
||||
unsigned ParseHex(const std::string& str, const Mark& mark)
|
||||
{
|
||||
unsigned value = 0;
|
||||
for(unsigned i=0;i<str.size();i++) {
|
||||
@@ -20,7 +20,7 @@ namespace YAML
|
||||
else if('0' <= ch && ch <= '9')
|
||||
digit = ch - '0';
|
||||
else
|
||||
throw ParserException(line, column, ErrorMsg::INVALID_HEX);
|
||||
throw ParserException(mark, ErrorMsg::INVALID_HEX);
|
||||
|
||||
value = (value << 4) + digit;
|
||||
}
|
||||
@@ -44,13 +44,13 @@ namespace YAML
|
||||
str += in.get();
|
||||
|
||||
// get the value
|
||||
unsigned value = ParseHex(str, in.line, in.column);
|
||||
unsigned value = ParseHex(str, in.mark());
|
||||
|
||||
// legal unicode?
|
||||
if((value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF) {
|
||||
std::stringstream msg;
|
||||
msg << ErrorMsg::INVALID_UNICODE << value;
|
||||
throw ParserException(in.line, in.column, msg.str());
|
||||
throw ParserException(in.mark(), msg.str());
|
||||
}
|
||||
|
||||
// now break it up into chars
|
||||
@@ -107,7 +107,7 @@ namespace YAML
|
||||
}
|
||||
|
||||
std::stringstream msg;
|
||||
throw ParserException(in.line, in.column, ErrorMsg::INVALID_ESCAPE + ch);
|
||||
throw ParserException(in.mark(), ErrorMsg::INVALID_ESCAPE + ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user