[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: monitrc erroneous line numbering off by one
From: |
Christian Hopp |
Subject: |
Re: monitrc erroneous line numbering off by one |
Date: |
Fri, 13 Feb 2004 15:35:07 +0100 (CET) |
Hi!
Okay... this is how I think parser errors should look like (patch).
The errors/warnings are reported in loose gcc style:
file:lineno: type:msg 'yytext'
like:
/home/chopp/monitrc.pholdaway:7: Error: invalid syslog facility 'foobar'
/home/chopp/monitrc.pholdaway:10: Warning: credentials for user admin were
already added, entry ignored 'accxess'
/home/chopp/monitrc.pholdaway:11: Error: hostname did not resolve
'localhosttttttttttt'
(...)
/home/chopp/monitrc.foo:12: Error: the number of restarts must be less
than poll cycles '2'
(...)
But I don't like the 'yytext' part at the end. But that means
including them in the msg accordingly (if I work myself though every
error message 5 times or 6 times does not make a difference (-:).
As you can see include files are handled mostly correctly (sometimes
you cannot catch the position of the erroneous context).
yyerror() accepts now variable arguments, like printf. I do hope that
flex does not misuse it and introduces format string bugs calling yyerror().
And now the dirty parts:
- I need to save the context every time an argument is parsed.
- The buffer stacks for the include file was extended by a filename
and a line number stack. Thus, we cannot not switch to the flex's
new include file engine easily.
- Now there is not only yyerror() (which uses the last parsed token)
but also yyerror2() (which uses the context of the last argument),
yywarning[2]() (for warning of course, yywarning2 is equivalent to
yyerror2).
Please try it out.
I also included a modified version of the config file showing
misplaced line numbers. It should give a variety of errors and warnings. You
need monitrc.foo for errors inside include files. Try it.
Christian
--
Christian Hopp email: address@hidden
Institut für Elektrische Informationstechnik fon: +49-5323-72-2113
TU Clausthal, Leibnizstr. 28, 38678 Clausthal-Zellerf. fax: +49-5323-72-3197
pgpkey: https://www.iei.tu-clausthal.de/pgp-keys/
parseerror.diff
Description: Text document
monitrc.pholdaway
Description: Text document
monitrc.foo
Description: Text document
- Re: monitrc erroneous line numbering off by one, Martin Pala, 2004/02/11
- Re: monitrc erroneous line numbering off by one, Martin Pala, 2004/02/11
- Re: monitrc erroneous line numbering off by one, Jan-Henrik Haukeland, 2004/02/12
- Re: monitrc erroneous line numbering off by one, Christian Hopp, 2004/02/12
- Re: monitrc erroneous line numbering off by one, Christian Hopp, 2004/02/12
- Re: monitrc erroneous line numbering off by one, Christian Hopp, 2004/02/12
- Re: monitrc erroneous line numbering off by one, Jan-Henrik Haukeland, 2004/02/12
- Re: monitrc erroneous line numbering off by one, Christian Hopp, 2004/02/12
- Re: monitrc erroneous line numbering off by one,
Christian Hopp <=
- Re: monitrc erroneous line numbering off by one, Jan-Henrik Haukeland, 2004/02/13
- Re: monitrc erroneous line numbering off by one, Christian Hopp, 2004/02/13
- Re: monitrc erroneous line numbering off by one, Jan-Henrik Haukeland, 2004/02/13
- Re: monitrc erroneous line numbering off by one, Christian Hopp, 2004/02/13