[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: Using mm units in .pcb files



DJ Delorie wrote:
> 
>> As a handy extension, it would be convenient to be able to specify a
>> default unit that applies to an entire footprint, so that a unit of
>> "mm" or whatever didn't have to appear after every number.
> 
> That would be tricker because you'd have to have communication between
> the parser and the lexer, so it knows *which* default prefix to use.

I was thinking of extending the syntax so that something like:
    units mm;
was legal inside a footprint, so the parser *would* know for all 
subsequent statements inside the footprint. (*)  The parser could export 
a C variable with the scaling factor, the lexer could pick it up. Having 
any kind of default with larger that footprint scope strikes me as a Bad 
Idea.

Now, of course, old lex/yacc hands will point out that this kind of 
communication is dangerous, since the parser looks ahead, meaning the 
lexer might actually be a token or two ahead of the parser.  The net 
effect of which is the global in the parser doesn't appear to be set 
from the lexer's viewpoint until after a couple more calls. But... I 
think the pcb format has enough syntactic sugar that you will have 
already picked up a "pad" and a '(' or such, before getting a number so 
all is well.  There are ways to force synchronization but I'd have to 
look them up since it has been a while since I did anything like that.

-dave

(*) Or, instead of adding keywords, you could say that a rule on one of 
the numbers in the "element" line, say the mark, was the default for the 
footprint.  But that seems excessively obscure.



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user