Collected pos, line, and column into a Mark struct

This commit is contained in:
Jesse Beder
2009-07-27 02:56:18 +00:00
parent 9b78bd459b
commit b1ce042535
17 changed files with 145 additions and 137 deletions

View File

@@ -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);
}
}
}