The Manchester OWL Syntax Parser has trouble when classes are punned. In particular if A is a class and an object property, then the parser cannot parse "A and B". The trouble is that it is looking for something like "A some B". I have three illustrations of this problem. There is an owl file such that the definition of the "A" class is invalid in Protege 4 once it is editted. There is a program showing that "A and B" doesn't parse. And there is a program showing that this results in a failed round trip.
This is an awkward bug. (Using and LR1 grammar is easy except that this parser is hand generated which might make it a bit more difficult.) The context for this bug is [1] where the obvious fix of changing the owl entity checker does not work. I may work around this issue by requiring that the user disambiguate classes from properties when he wants to input a full iri.
-Timothy
A program showing that "A and B" does not parse
The round trip doesn't work because it can't parse the definition of A
While, as far as I can see, the specs do not forbid punning classes and properties, I cannot manage to figure out why someone thought that the use case there presented is a good reason for having classes and properties punnable - i.e.,
SubClassOf ( :PersonCompany :Association) (2) :PersonCompany denotes a subclass of an :Association used to model an association between classes :Person and Company as a class.
ObjectPropertyDomain( :PersonCompany :Person )(3) The domain of the property :PersonCompany is :Person.
What does it mean for an ObjectProperty to be a Class? How many instances does that class have? In my opinion, that's poor modelling choices.
Rant aside, for this bug to be fixed the parser would have to do lookaheads, as you say; I don't know much of it but it does not sound easy at all to me.
As far as I can tell, the parser was not designed to allow punning like this at all, and it will require large amounts of work to add the behavior; moving this to Feature requests.