|
From: | Hans Aberg |
Subject: | Re: Delaying activation of actions |
Date: | Tue, 27 Feb 2007 19:27:03 +0100 |
On 13 Feb 2007, at 14:32, Frans Englich wrote:
I have a design problem that I don't know how to solve, so any pointer wouldbe highly appreciated! The problem is that is that in a parser for pseudo-XML, ...
If it is a known problem, perhaps you might check the USenet newsgroup comp.compilers, or some XML list.
I need to delay thelookup of certain names, to after all namespace declarations has been parsed.Here's an example: <e attribute="{p:herePrefixPisUsed}" xmlns:p="http://example.com/HerePrefixPisDeclared"/> As can be seen, "xmlns:p" appears after "p:herePrefixPisUsed".The problem is that the parser operates sequentially, and attempts to resolve "p" inside "p:herePrefixPisUsed", but since "xmlns:p" hasn't been encounteredyet, it doesn't know about it, and hence fails.
Unless you can save "{p:herePrefixPisUsed}", and resolve in the actions, when he 'xmlns:p=', I think you will have a hard parsing problem. You might cause delays in the parsing by the use of %glr, and letting the grammar be ambiguous until being resolved.
Hans Aberg
[Prev in Thread] | Current Thread | [Next in Thread] |