|
From: James W. <ja...@fr...> - 2007-05-14 18:41:19
|
Roger Holmes wrote: > On 14 May, 2007, at 17:23, James W. Walker wrote: > >> On May 14, 2007, at 2:21 AM, Roger Holmes wrote: >> >>> On 14 May, 2007, at 00:32, James W. Walker wrote: >>> >>>> On May 12, 2007, at 9:10 AM, Stefan Huber wrote: >>>> >>>>> Please ignore the previous mail. So once again... >>>>> >>>>> "Apple Computer, Inc.:NameElement" and "Apple Computer, Inc.: >>>>> URLElement" are not very parser friendly. >>>>> >>>>> The problem is in E3FFR_3DMF_Text.c/ >>>>> e3fformat_3dmf_text_readobjecttype. >>>>> E3FileFormat_GenericReadText_ReadUntilChars with argument blank = >>>>> true cannot read object types with blanks in their name. So the >>>>> parser tries to handle an object "Apple" and runs into trouble. >>>> I wish Apple had published a formal grammar for ASCII 3DMF. It is >>>> not clear to me how the parser is supposed to know where an object >>>> type ends, or how to tell the difference between a label and an >>>> object type. >>> I agree. But here, can't we just read everything up to the colon? >> That takes you to the middle of the name element object type. Then >> what? > > From the only two samples so far mentioned, the spaces are only in > the first part of the name element object type. The rest is a normal > identifier terminated by white space or any non alpha-numeric character. True... I don't know of any formal rules as to what constitutes a legal type name, but it would certainly be an improvement to at least handle the standard Apple names. >> It appears that in a label, the colon should always be >> followed by a line break. So, if it's not followed by a line break, >> we continue reading up to the open parenthesis? > > A parser or any lexical analyser does not need to apply the same > rules to a symbol in all circumstances. A label can have different > rules to a name element object type. Any compiler can treat a colon > in a comment differently from a colon in a statement. True, but a compiler knows it's looking at a C or C++ comment as soon as the comment has started. A 3DMF parser doesn't know whether it is looking at a label or an object type until it has either gone past a colon or reached a line break or parenthesis. -- James W. Walker, Innoventive Software LLC <http://www.frameforge3d.com/> |