mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-10 04:51:17 +00:00
Collected pos, line, and column into a Mark struct
This commit is contained in:
@@ -98,17 +98,17 @@ namespace YAML
|
||||
void Parser::HandleYamlDirective(Token *pToken)
|
||||
{
|
||||
if(pToken->params.size() != 1)
|
||||
throw ParserException(pToken->line, pToken->column, ErrorMsg::YAML_DIRECTIVE_ARGS);
|
||||
throw ParserException(pToken->mark, ErrorMsg::YAML_DIRECTIVE_ARGS);
|
||||
|
||||
std::stringstream str(pToken->params[0]);
|
||||
str >> m_state.version.major;
|
||||
str.get();
|
||||
str >> m_state.version.minor;
|
||||
if(!str || str.peek() != EOF)
|
||||
throw ParserException(pToken->line, pToken->column, ErrorMsg::YAML_VERSION + pToken->params[0]);
|
||||
throw ParserException(pToken->mark, ErrorMsg::YAML_VERSION + pToken->params[0]);
|
||||
|
||||
if(m_state.version.major > 1)
|
||||
throw ParserException(pToken->line, pToken->column, ErrorMsg::YAML_MAJOR_VERSION);
|
||||
throw ParserException(pToken->mark, ErrorMsg::YAML_MAJOR_VERSION);
|
||||
|
||||
// TODO: warning on major == 1, minor > 2?
|
||||
}
|
||||
@@ -118,7 +118,7 @@ namespace YAML
|
||||
void Parser::HandleTagDirective(Token *pToken)
|
||||
{
|
||||
if(pToken->params.size() != 2)
|
||||
throw ParserException(pToken->line, pToken->column, ErrorMsg::TAG_DIRECTIVE_ARGS);
|
||||
throw ParserException(pToken->mark, ErrorMsg::TAG_DIRECTIVE_ARGS);
|
||||
|
||||
std::string handle = pToken->params[0], prefix = pToken->params[1];
|
||||
m_state.tags[handle] = prefix;
|
||||
|
Reference in New Issue
Block a user