Alex Taylor Wrote:That brings up an interesting point: whilst a NOFILE is pretty unambiguous, suppose you encounter the following code:
0 !TEXMAP START PLANAR...
0 !: <geometry>
0 STEP
0 !: <geometry>
0 !TEXMAP END
I agree that the STEP should abort the texture, but what should be done with the second block of <geometry> - and should the parser report an error when it hits what is now effectively an invalid "0 !TEXMAP END" statement?
Might it in fact be simpler to just prohibit the appearance of STEP inside a texmap block?
This is actually a question of precedence: which is the higher-level object in the file: the step, or the texture? I argue that the step has higher precedence than the texture. In other words, when parsing out the logical structure of a file, one looks first for the steps, then for the stuff inside them. When we look at the file you've shown, we see two steps, containing the following:
Step 1:
Code:
0 !TEXMAP START PLANAR...
0 !: <geometry>
Code:
0 !: <geometry>
0 !TEXMAP END
There's no such thing as a step "inside" a texture. There are textures inside steps. This should make sense, as everything in a model must be in a step (even if it's only an implicitly 1-step model).
So now the question is whether either of those steps contain illegal statements. In my opinion, they don't. Step #1 definitely doesn't. We already know that TEXMAP can end when it runs out of scope at the end of a file, so it's perfectly legal (though unsightly) to have a START which isn't balanced by an END.
Step #2 is more debatable. However, in the spirit of how LDraw works, unrecognized type 0 lines devolve into comments. Since neither line in Step #2 has meaning without being prefaced by a TEXMAP START, I consider them stray junk in the file rather than parsing errors.
Allen