1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 04:48:06 +01:00

Remove dependency to CPP: add function to report problems while parsing

The default function used so far provides informations not so useful
to user, like wmaker's source file, line number and function; it
also cannot provide the line number from the parsed file because cpp
messes this information.

With this dedicated function we try to provide useful things which
are being tracked by the parser internally, like valid line number
and the name of the file being read (which can be convenient in the
case of #include, for which we may also be able to provide the
inclusion tree!)
This commit is contained in:
Christophe CURIS
2012-07-08 02:12:36 +02:00
committed by Carlos R. Mafra
parent 42cccb2313
commit 7d74648fc3
3 changed files with 20 additions and 8 deletions

View File

@@ -898,7 +898,7 @@ static WMenu *parseCascade(WScreen * scr, WMenu * menu, WMenuParser parser)
while (WMenuParserGetLine(parser, &title, &command, &params, &shortcut)) {
if (command == NULL || !command[0]) {
wwarning(_("%s:missing command in menu config"), WMenuParserGetFilename(parser));
WMenuParserError(parser, _("missing command in menu config") );
freeline(title, command, params, shortcut);
goto error;
}
@@ -926,7 +926,7 @@ static WMenu *parseCascade(WScreen * scr, WMenu * menu, WMenuParser parser)
freeline(title, command, params, shortcut);
}
wwarning(_("%s:syntax error in menu file:END declaration missing"), WMenuParserGetFilename(parser));
WMenuParserError(parser, _("syntax error in menu file: END declaration missing") );
error:
return NULL;
@@ -974,7 +974,7 @@ static WMenu *readMenuFile(WScreen * scr, char *file_name)
while (WMenuParserGetLine(parser, &title, &command, &params, &shortcut)) {
if (command == NULL || !command[0]) {
wwarning(_("%s:missing command in menu config"), file_name);
WMenuParserError(parser, _("missing command in menu config") );
freeline(title, command, params, shortcut);
break;
}
@@ -988,7 +988,7 @@ static WMenu *readMenuFile(WScreen * scr, char *file_name)
freeline(title, command, params, shortcut);
break;
} else {
wwarning(_("%s:invalid menu file. MENU command is missing"), file_name);
WMenuParserError(parser, _("invalid menu file, MENU command is missing") );
freeline(title, command, params, shortcut);
break;
}
@@ -1065,7 +1065,7 @@ static WMenu *readMenuPipe(WScreen * scr, char **file_name)
while (WMenuParserGetLine(parser, &title, &command, &params, &shortcut)) {
if (command == NULL || !command[0]) {
wwarning(_("%s:missing command in menu config"), filename);
WMenuParserError(parser, _("missing command in menu config") );
freeline(title, command, params, shortcut);
break;
}
@@ -1079,7 +1079,7 @@ static WMenu *readMenuPipe(WScreen * scr, char **file_name)
freeline(title, command, params, shortcut);
break;
} else {
wwarning(_("%s:no title given for the root menu"), filename);
WMenuParserError(parser, _("no title given for the root menu") );
freeline(title, command, params, shortcut);
break;
}