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

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