----- Original Message -----
Sent: Wednesday, August 13, 2014 6:50 AM
Subject: Re: [geda-user] rs-274x nits
Sent: Tuesday, August 12, 2014 1:51 PM
Subject: [geda-user] rs-274x nits
I'm trying to interpret the gerber format specification document
authored by Ucamco.
The line separators CR and LF have no effect; they can be
processing the file. It
is recommended to use line separators to improve human readability.
It is recommended to add line separators between data blocks for
readability. Do not
put a line separator within a data block, except after a
in long data blocks.
The line separators have no effect on the image.
The '%' must immediately follow the '*' of the last
intervening line separators.
This is an exception to the general rule that a data block can be
followed by a line separator.
#3 is clear enough.
#1 and #2 seem to be in conflict. A strict reading of #1
would say that
CR and LF should simply be expunged, and that CR/LF could even split
Which seems odd, but is a result of strict reading of #1. But is in
conflict with the advice of #2.
I don't see any conflict there. #1 is saying that *when processing*
must ignore line breaks, but it is recommended to put them in for
readability. Your example of splitting G-codes, etc, certainly does NOT
So, then it is your interpretation that a correct RS-274X parser should
not reject G-codes (and other lexical units) that have been split by
Based solely on the 3 points you posted, no - but that is only a tiny
fraction of the specification and you will have to look through all of
it to determine that. However, splitting a lexical unit with a CR/LF
wouldn't make it more legible to humans, would it?
If the specification is silent about breaking a lexical unit then to be
safe a parser should accept such a broken unit even if your particular
writer never breaks a unit.
In this case it may be worthwhile writing to UCAMCO for clarification
on the issue. Make sure to present a few clear examples to illustrate
your points. I suspect the response would be along the lines of
"it's really silly to split a lexical unit given its length and the
stated purpose of CR/LF being for human readability only - so what
do you think?" However, perhaps the role of spaces could be
clarified. Where are spaces allowed other than after the '0' in a
block comment and within strings? Can spaces exist at the ends of a
string and will they be part of the string or discarded? The latter
is of particular importance since Value Attributes are strings; the
examples never show a space in a value attribute, but spaces are not
#2 is saying to put line blocks where they will improve readability, just
not at random spots in a data block.
It's easy enough to comply with the advice of #2 while
writing. But if
reading RS-274X, should CR/LF's that split lexical units be
Although I realize that even if legal, I doubt if anyone