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

@@ -68,10 +68,10 @@ namespace YAML
while(1) {
Token *pToken = pScanner->PeekNextToken();
if(!pToken)
throw SeqEndNotFound();
throw ParserException(-1, -1, "end of sequence not found");
if(pToken->type != TT_BLOCK_ENTRY && pToken->type != TT_BLOCK_END)
throw SeqEndNotFound();
throw ParserException(pToken->line, pToken->column, "end of sequence not found");
pScanner->PopNextToken();
if(pToken->type == TT_BLOCK_END)
@@ -111,7 +111,7 @@ namespace YAML
while(1) {
Token *pToken = pScanner->PeekNextToken();
if(!pToken)
throw SeqEndNotFound();
throw ParserException(-1, -1, "end of sequence flow not found");
// first check for end
if(pToken->type == TT_FLOW_SEQ_END) {
@@ -129,7 +129,7 @@ namespace YAML
if(pToken->type == TT_FLOW_ENTRY)
pScanner->EatNextToken();
else if(pToken->type != TT_FLOW_SEQ_END)
throw SeqEndNotFound();
throw ParserException(pToken->line, pToken->column, "end of sequence flow not found");
}
}