Combined the myriad ScannerExceptions and ParserExceptions to a single ParserException class that has a message and a line/column position in the file where the error occurred.

This commit is contained in:
beder
2008-07-08 05:48:38 +00:00
parent 1acc0e4982
commit 2f5c19fa00
12 changed files with 114 additions and 113 deletions

View File

@@ -35,7 +35,7 @@ namespace YAML
if(params.onDocIndicator == BREAK)
break;
else if(params.onDocIndicator == THROW)
throw IllegalDocIndicator();
throw ParserException(INPUT.line, INPUT.column, "illegal document indicator in scalar");
}
foundNonEmptyLine = true;
@@ -61,7 +61,7 @@ namespace YAML
// eof? if we're looking to eat something, then we throw
if(INPUT.peek() == EOF) {
if(params.eatEnd)
throw IllegalEOF();
throw ParserException(INPUT.line, INPUT.column, "illegal EOF in scalar");
break;
}
@@ -97,7 +97,7 @@ namespace YAML
while(Exp::Blank.Matches(INPUT)) {
// we check for tabs that masquerade as indentation
if(INPUT.peek() == '\t'&& INPUT.column < params.indent && params.onTabInIndentation == THROW)
throw IllegalTabInIndentation();
throw ParserException(INPUT.line, INPUT.column, "illegal tab when looking for indentation");
if(!params.eatLeadingWhitespace)
break;