[xsd-users] Lines numbers after parsing
Jon D
tyrecius13 at yahoo.com
Fri Jun 29 04:23:43 EDT 2007
Hi,
I'm looking into using the C++/Tree xsd parser for configuration
files. It does prevent many of the awkward error-prone code that you
often have to write in C++ to manage the parser. I still have one
serious reservation that I was hoping that y'all might help me
resolve.
In my particular case, the configuration files are hand-crafted and
modified. And others, perhaps with no computer programming experience,
might need to modify them in the future. Given this, good error
messages are crucial. Looking over the error-handling documentation
for C++/Tree, it seems that it does or soon will perform all of the
syntactic checking necessary.
My problem comes when I want to do semantic checks after the parsing
is done. At that point, all of the diagnostic information (line
numbers, and the text of the lines themselves) seems to
disappear. This information is a crucial pre-condition if I want to
give helpful error messages.
The question is, how do I get line numbers after parsing is done? If I
can't, how hard would it be to modify the compiler to save that
information and make it available?
Thanks for any help. I have searched through the mailing-list, the
wiki, and the documenation and I can't find a mention of this issue.
To conclude, here is a simple motivating example of the kinds of
errors that I would like to print out:
Suppose I wanted to do a simple html-like language with
style-sheets. I might have documents that have elements like:
<p class="foo">Some text</p>
And I might have stylesheets that have elements that look like this:
<class name="bar" bold=true/>
Now the semantic error that I'm talking about is when a class used in
the document file doesn't match a class defined in the stylesheet
file. Both files would parse successfully. But after I created a table
of class names, one of the lookups would fail. And when that happens,
I'd like to be able to print out something like:
Line 37: "<p>" tag uses non-existant class "foo": <p class="foo">Some text</p>
Thanks again for any help.
-D
---------------------------------
Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us.
More information about the xsd-users
mailing list