Output line number of error msg error
"kmoving1985" <[email protected]>
| Newsgroups | gmane.text.clearsilver.general |
|---|---|
| Message-ID | <[email protected]> |
When using clearsilver with hdf file having multiline value,
if the hdf is illegal,
I will get some error msg which points out where failed and
gives the line number in hdf file.
In order to have a better view,I also paste the line number
that comes from vim:)
For example:
test_multiline.hdf
1 HDF{
2 Value << EOM
3 line1
4 line2
5 line3
6 EOM
7
8 unvalid*name="hello"
9 }
test_multiline.cs
<?cs HDF.Value?>
and execute it like this:
./cs -v -h test_multiline.hdf -c test_multiline.cs
I get fallowing errors :
Traceback (innermost last):
File "neo_hdf.c", line 1857, in hdf_read_file()
File "neo_hdf.c", line 1695, in _hdf_read_string()
In file test_multiline.hdf:8
File "neo_hdf.c", line 1756, in _hdf_read_string()
ParseError: [test_multiline.hdf:8] Unable to parse line
unvalid*name="hello"
as you see,"ParseError: [test_multiline.hdf:8]" gives me
msg that line number *8* in test_multiline.hdf failed.
everything goes well.
but if I change the test_multiline.hdf by making
the length of the next line of "Value << EOM" in the hdf longer,
500 bytes for example,the line number in "ParseError:[...]" will
not be correct.
1 HDF{
2 Value << EOM
3 It is often convenient to load elements of a dataset from
disk. Normally data is loaded from a ClearSilver file format c
alled HDF, although it could easily be loaded from XML or
another format. HDF stands for Hierarchical Data Format (yes, anot
her HDF). It supports two different syntax for representing the
dataset hierarchy which can be intermixed arbitrarily. The f
irst is a simple dotted path scheme
4 EOM
5
6 unvalid*name="hello"
7 }
error msg:
Traceback (innermost last):
File "neo_hdf.c", line 1857, in hdf_read_file()
File "neo_hdf.c", line 1695, in _hdf_read_string()
In file test_multiline.hdf:9
File "neo_hdf.c", line 1756, in _hdf_read_string()
ParseError: [test_multiline.hdf:9] Unable to parse line
unvalid*name="hello"
as you see,line number in "ParseError: [test_multiline.hdf:9]"
is *9*,not 6.
so,is this a bug?
whether or not,if that does happens,i think the error msg will
mislead users:)
code in line 1724 in
static NEOERR* _hdf_read_string (HDF *hdf, const char **str, STRING
*line, const char *path, int *lineno, int include_handle)
in neo_hdf.c is:
while (_copy_line (str, m+msize, mmax-msize) != 0)
{
(*lineno)++;
...
}
should clearsilver make sure that it does read a line
and then increases lineno?
Regards
kmoving