Improved diagnostics.
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
|
||||
|
||||
|
||||
static TokList* CollectRepeatTokens (void)
|
||||
static TokList* CollectRepeatTokens (const FilePos* StartPos)
|
||||
/* Collect all tokens inside the .REPEAT body in a token list and return
|
||||
** this list. In case of errors, NULL is returned.
|
||||
*/
|
||||
@@ -67,7 +67,8 @@ static TokList* CollectRepeatTokens (void)
|
||||
|
||||
/* Check for end of input */
|
||||
if (CurTok.Tok == TOK_EOF) {
|
||||
Error ("Unexpected end of file");
|
||||
ErrorExpect ("Expected '.ENDREPEAT'");
|
||||
PNotification (StartPos, "For this '.REPEAT' command");
|
||||
FreeTokList (List);
|
||||
return 0;
|
||||
}
|
||||
@@ -117,6 +118,10 @@ void ParseRepeat (void)
|
||||
char* Name;
|
||||
TokList* List;
|
||||
|
||||
/* Remember the position of the .REPEAT token, then skip it */
|
||||
FilePos StartPos = CurTok.Pos;
|
||||
NextTok ();
|
||||
|
||||
/* Repeat count follows */
|
||||
long RepCount = ConstExpression ();
|
||||
if (RepCount < 0) {
|
||||
@@ -145,7 +150,7 @@ void ParseRepeat (void)
|
||||
ConsumeSep ();
|
||||
|
||||
/* Read the token list */
|
||||
List = CollectRepeatTokens ();
|
||||
List = CollectRepeatTokens (&StartPos);
|
||||
|
||||
/* If we had an error, bail out */
|
||||
if (List == 0) {
|
||||
|
||||
Reference in New Issue
Block a user