LDraw.org Discussion Forums
whitespace deals.. 0// - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: LDraw File Processing and Conversion (https://forums.ldraw.org/forum-22.html)
+--- Thread: whitespace deals.. 0// (/thread-8649.html)



whitespace deals.. 0// - Santeri Piippo - 2013-03-15

So I was working on my little parts authoring tool (ldforge) again and ran into a little problemo: is there required to be a whitespace after the numeric code for comments? Is a line like "0// edge lines" valid or are they considered errorneous?

I would assume it's illegal but assuming is bad, so yeah. The specification doesn't seem to mention anything about this, maybe I am blind as usual?


Re: Numeric code whitespaces? - Michael Heidemann - 2013-03-15

It is an unknow line then.
The parameter of a line are separated by one or more whitespace.
In the case you mention "0//" this is the first parameter of the line, where a linetype 0 through 5 is expected. So it is an invalid line.
It's up to you as the author of the application what to do with that line Smile

Code:
Basic parsing / file content

An LDraw file consists of one command per line. There is no line length restriction. Each command consists of optional leading whitespace followed by whitespace-delimited tokens. Some commands also have trailing arbitrary data which may itself include internal whitespace; such data is not tokenized, but treated as single unit according to the command.

Whitespace is defined as one or more spaces (#32), tabs (#9), or combination thereof.
Taken from: http://www.ldraw.org/article/218


Re: whitespace deals.. 0// - Santeri Piippo - 2013-03-15

I guess I am indeed still blind, then.

Michael Heidemann Wrote:It's up to you as the author of the application what to do with that line Smile
It'll be listed as an errorneous line in the code, such will have a little dialog for changing the contents of that line so you can fix the error without the need of a text editor.

Thanks.