Add #define list of flags to unset when copying into a buffer
[geda-pcb/pcjc2.git] / src / edif.y
blobe5a606d0c51d3e168d21bf77433391f6c86ad612
1 %{
2 /*
3 * PCB Edif parser based heavily on:
5 * Header: edif.y,v 1.18 87/12/07 19:59:49 roger Locked
6 */
7 /************************************************************************
8 * *
9 * edif.y *
10 * *
11 * EDIF 2.0.0 parser, Level 0 *
12 * *
13 * You are free to copy, distribute, use it, abuse it, make it *
14 * write bad tracks all over the disk ... or anything else. *
15 * *
16 * Your friendly neighborhood Rogue Monster - roger@mips.com *
17 * *
18 ************************************************************************/
19 #include <stdio.h>
21 /* for malloc, free, atoi */
22 #include <stdlib.h>
24 /* for strcpy */
25 #include <string.h>
27 #include <ctype.h>
29 #include "global.h"
30 #include "data.h"
31 /* from mymem.h, not include because of the malloc junk */
32 LibraryMenuType * GetLibraryMenuMemory (LibraryType *);
33 LibraryEntryType * GetLibraryEntryMemory (LibraryMenuType *);
36 * Local definitions.
38 #define IDENT_LENGTH 255
39 #define Malloc(s) malloc(s)
40 #define Free(p) free(p)
41 #define Getc(s) getc(s)
42 #define Ungetc(c) ungetc(c,Input)
44 typedef struct _str_pair
46 char* str1;
47 char* str2;
48 struct _str_pair* next;
49 } str_pair;
51 typedef struct _pair_list
53 char* name;
54 str_pair* list;
55 } pair_list;
57 str_pair* new_str_pair(char* s1, char* s2)
59 str_pair* ps = (str_pair *)malloc(sizeof(str_pair));
60 ps->str1 = s1;
61 ps->str2 = s2;
62 ps->next = NULL;
63 return ps;
66 pair_list* new_pair_list(str_pair* ps)
68 pair_list* pl = (pair_list *)malloc(sizeof(pair_list));
69 pl->list = ps;
70 pl->name = NULL;
71 return pl;
74 void str_pair_free(str_pair* ps)
76 str_pair* node;
77 while ( ps )
79 free(ps->str1);
80 free(ps->str2);
81 node = ps;
82 ps = ps->next;
83 free(node);
87 void pair_list_free(pair_list* pl)
89 str_pair_free(pl->list);
90 free(pl->name);
91 free(pl);
94 void define_pcb_net(str_pair* name, pair_list* nodes)
96 int tl;
97 str_pair* done_node;
98 str_pair* node;
99 char* buf;
100 char* p;
101 LibraryEntryType *entry;
102 LibraryMenuType *menu = GetLibraryMenuMemory (&PCB->NetlistLib);
104 if ( !name->str1 )
106 /* no net name given, stop now */
107 /* if renamed str2 also exists and must be freed */
108 if ( name->str2 ) free(name->str2);
109 free(name);
110 pair_list_free(nodes);
111 return;
113 menu->Name = strdup (name->str1);
114 free(name->str1);
115 /* if renamed str2 also exists and must be freed */
116 if ( name->str2 ) free(name->str2);
117 free(name);
118 buf = (char *)malloc(256);
119 if ( !buf )
121 /* no memory */
122 pair_list_free(nodes);
123 return;
126 node = nodes->list;
127 free(nodes->name);
128 free(nodes);
129 while ( node )
131 /* check for node with no instance */
132 if ( !node->str1 )
134 /* toss it and move on */
135 free(node->str2);
136 done_node = node;
137 node = node->next;
138 free(done_node);
139 continue;
141 tl = strlen(node->str1) + strlen(node->str2);
142 if ( tl + 3 > 256 )
144 free(buf);
145 buf = (char *)malloc(tl+3);
146 if ( !buf )
148 /* no memory */
149 str_pair_free(node);
150 return;
153 strcpy(buf,node->str1);
154 /* make all upper case, because of PCB funky behaviour */
155 p=buf;
156 while ( *p )
158 *p = toupper( (int) *p);
159 p++;
161 /* add dash separating designator from node */
162 *(buf+strlen(node->str1)) = '-';
163 /* check for the edif number prefix */
164 if ( node->str2[0] == '&' )
166 /* skip number prefix */
167 strcpy(buf+strlen(node->str1)+1,node->str2 +1);
169 else
171 strcpy(buf+strlen(node->str1)+1,node->str2);
173 /* free the strings */
174 free(node->str1);
175 free(node->str2);
176 entry = GetLibraryEntryMemory (menu);
177 entry->ListEntry = strdup(buf);
178 done_node = node;
179 node = node->next;
180 free(done_node);
185 /* forward function declarations */
186 static int yylex(void);
187 static void yyerror(const char *);
188 static void PopC(void);
191 %name-prefix="edif"
193 %union {
194 char* s;
195 pair_list* pl;
196 str_pair* ps;
199 %type <s> Int Ident Str Keyword Name _Name
200 %type <ps> PortRef _PortRef NetNameDef NameDef
201 %type <ps> Rename _Joined
202 %type <s>__Rename _Rename NameRef
203 %type <s> InstanceRef InstNameRef Member PortNameRef
204 %type <pl> Net _Net Joined
206 %token <s> EDIF_TOK_IDENT
207 %token <s> EDIF_TOK_INT
208 %token <s> EDIF_TOK_KEYWORD
209 %token <s> EDIF_TOK_STR
211 %token EDIF_TOK_ANGLE
212 %token EDIF_TOK_BEHAVIOR
213 %token EDIF_TOK_CALCULATED
214 %token EDIF_TOK_CAPACITANCE
215 %token EDIF_TOK_CENTERCENTER
216 %token EDIF_TOK_CENTERLEFT
217 %token EDIF_TOK_CENTERRIGHT
218 %token EDIF_TOK_CHARGE
219 %token EDIF_TOK_CONDUCTANCE
220 %token EDIF_TOK_CURRENT
221 %token EDIF_TOK_DISTANCE
222 %token EDIF_TOK_DOCUMENT
223 %token EDIF_TOK_ENERGY
224 %token EDIF_TOK_EXTEND
225 %token EDIF_TOK_FLUX
226 %token EDIF_TOK_FREQUENCY
227 %token EDIF_TOK_GENERIC
228 %token EDIF_TOK_GRAPHIC
229 %token EDIF_TOK_INDUCTANCE
230 %token EDIF_TOK_INOUT
231 %token EDIF_TOK_INPUT
232 %token EDIF_TOK_LOGICMODEL
233 %token EDIF_TOK_LOWERCENTER
234 %token EDIF_TOK_LOWERLEFT
235 %token EDIF_TOK_LOWERRIGHT
236 %token EDIF_TOK_MASKLAYOUT
237 %token EDIF_TOK_MASS
238 %token EDIF_TOK_MEASURED
239 %token EDIF_TOK_MX
240 %token EDIF_TOK_MXR90
241 %token EDIF_TOK_MY
242 %token EDIF_TOK_MYR90
243 %token EDIF_TOK_NETLIST
244 %token EDIF_TOK_OUTPUT
245 %token EDIF_TOK_PCBLAYOUT
246 %token EDIF_TOK_POWER
247 %token EDIF_TOK_R0
248 %token EDIF_TOK_R180
249 %token EDIF_TOK_R270
250 %token EDIF_TOK_R90
251 %token EDIF_TOK_REQUIRED
252 %token EDIF_TOK_RESISTANCE
253 %token EDIF_TOK_RIPPER
254 %token EDIF_TOK_ROUND
255 %token EDIF_TOK_SCHEMATIC
256 %token EDIF_TOK_STRANGER
257 %token EDIF_TOK_SYMBOLIC
258 %token EDIF_TOK_TEMPERATURE
259 %token EDIF_TOK_TIE
260 %token EDIF_TOK_TIME
261 %token EDIF_TOK_TRUNCATE
262 %token EDIF_TOK_UPPERCENTER
263 %token EDIF_TOK_UPPERLEFT
264 %token EDIF_TOK_UPPERRIGHT
265 %token EDIF_TOK_VOLTAGE
267 %token EDIF_TOK_ACLOAD
268 %token EDIF_TOK_AFTER
269 %token EDIF_TOK_ANNOTATE
270 %token EDIF_TOK_APPLY
271 %token EDIF_TOK_ARC
272 %token EDIF_TOK_ARRAY
273 %token EDIF_TOK_ARRAYMACRO
274 %token EDIF_TOK_ARRAYRELATEDINFO
275 %token EDIF_TOK_ARRAYSITE
276 %token EDIF_TOK_ATLEAST
277 %token EDIF_TOK_ATMOST
278 %token EDIF_TOK_AUTHOR
279 %token EDIF_TOK_BASEARRAY
280 %token EDIF_TOK_BECOMES
281 %token EDIF_TOK_BETWEEN
282 %token EDIF_TOK_BOOLEAN
283 %token EDIF_TOK_BOOLEANDISPLAY
284 %token EDIF_TOK_BOOLEANMAP
285 %token EDIF_TOK_BORDERPATTERN
286 %token EDIF_TOK_BORDERWIDTH
287 %token EDIF_TOK_BOUNDINGBOX
288 %token EDIF_TOK_CELL
289 %token EDIF_TOK_CELLREF
290 %token EDIF_TOK_CELLTYPE
291 %token EDIF_TOK_CHANGE
292 %token EDIF_TOK_CIRCLE
293 %token EDIF_TOK_COLOR
294 %token EDIF_TOK_COMMENT
295 %token EDIF_TOK_COMMENTGRAPHICS
296 %token EDIF_TOK_COMPOUND
297 %token EDIF_TOK_CONNECTLOCATION
298 %token EDIF_TOK_CONTENTS
299 %token EDIF_TOK_CORNERTYPE
300 %token EDIF_TOK_CRITICALITY
301 %token EDIF_TOK_CURRENTMAP
302 %token EDIF_TOK_CURVE
303 %token EDIF_TOK_CYCLE
304 %token EDIF_TOK_DATAORIGIN
305 %token EDIF_TOK_DCFANINLOAD
306 %token EDIF_TOK_DCFANOUTLOAD
307 %token EDIF_TOK_DCMAXFANIN
308 %token EDIF_TOK_DCMAXFANOUT
309 %token EDIF_TOK_DELAY
310 %token EDIF_TOK_DELTA
311 %token EDIF_TOK_DERIVATION
312 %token EDIF_TOK_DESIGN
313 %token EDIF_TOK_DESIGNATOR
314 %token EDIF_TOK_DIFFERENCE
315 %token EDIF_TOK_DIRECTION
316 %token EDIF_TOK_DISPLAY
317 %token EDIF_TOK_DOMINATES
318 %token EDIF_TOK_DOT
319 %token EDIF_TOK_DURATION
320 %token EDIF_TOK_E
321 %token EDIF_TOK_EDIF
322 %token EDIF_TOK_EDIFLEVEL
323 %token EDIF_TOK_EDIFVERSION
324 %token EDIF_TOK_ENCLOSUREDISTANCE
325 %token EDIF_TOK_ENDTYPE
326 %token EDIF_TOK_ENTRY
327 %token EDIF_TOK_EVENT
328 %token EDIF_TOK_EXACTLY
329 %token EDIF_TOK_EXTERNAL
330 %token EDIF_TOK_FABRICATE
331 %token EDIF_TOK_FALSE
332 %token EDIF_TOK_FIGURE
333 %token EDIF_TOK_FIGUREAREA
334 %token EDIF_TOK_FIGUREGROUP
335 %token EDIF_TOK_FIGUREGROUPOBJECT
336 %token EDIF_TOK_FIGUREGROUPOVERRIDE
337 %token EDIF_TOK_FIGUREGROUPREF
338 %token EDIF_TOK_FIGUREPERIMETER
339 %token EDIF_TOK_FIGUREWIDTH
340 %token EDIF_TOK_FILLPATTERN
341 %token EDIF_TOK_FOLLOW
342 %token EDIF_TOK_FORBIDDENEVENT
343 %token EDIF_TOK_GLOBALPORTREF
344 %token EDIF_TOK_GREATERTHAN
345 %token EDIF_TOK_GRIDMAP
346 %token EDIF_TOK_IGNORE
347 %token EDIF_TOK_INCLUDEFIGUREGROUP
348 %token EDIF_TOK_INITIAL
349 %token EDIF_TOK_INSTANCE
350 %token EDIF_TOK_INSTANCEBACKANNOTATE
351 %token EDIF_TOK_INSTANCEGROUP
352 %token EDIF_TOK_INSTANCEMAP
353 %token EDIF_TOK_INSTANCEREF
354 %token EDIF_TOK_INTEGER
355 %token EDIF_TOK_INTEGERDISPLAY
356 %token EDIF_TOK_INTERFACE
357 %token EDIF_TOK_INTERFIGUREGROUPSPACING
358 %token EDIF_TOK_INTERSECTION
359 %token EDIF_TOK_INTRAFIGUREGROUPSPACING
360 %token EDIF_TOK_INVERSE
361 %token EDIF_TOK_ISOLATED
362 %token EDIF_TOK_JOINED
363 %token EDIF_TOK_JUSTIFY
364 %token EDIF_TOK_KEYWORDDISPLAY
365 %token EDIF_TOK_KEYWORDLEVEL
366 %token EDIF_TOK_KEYWORDMAP
367 %token EDIF_TOK_LESSTHAN
368 %token EDIF_TOK_LIBRARY
369 %token EDIF_TOK_LIBRARYREF
370 %token EDIF_TOK_LISTOFNETS
371 %token EDIF_TOK_LISTOFPORTS
372 %token EDIF_TOK_LOADDELAY
373 %token EDIF_TOK_LOGICASSIGN
374 %token EDIF_TOK_LOGICINPUT
375 %token EDIF_TOK_LOGICLIST
376 %token EDIF_TOK_LOGICMAPINPUT
377 %token EDIF_TOK_LOGICMAPOUTPUT
378 %token EDIF_TOK_LOGICONEOF
379 %token EDIF_TOK_LOGICOUTPUT
380 %token EDIF_TOK_LOGICPORT
381 %token EDIF_TOK_LOGICREF
382 %token EDIF_TOK_LOGICVALUE
383 %token EDIF_TOK_LOGICWAVEFORM
384 %token EDIF_TOK_MAINTAIN
385 %token EDIF_TOK_MATCH
386 %token EDIF_TOK_MEMBER
387 %token EDIF_TOK_MINOMAX
388 %token EDIF_TOK_MINOMAXDISPLAY
389 %token EDIF_TOK_MNM
390 %token EDIF_TOK_MULTIPLEVALUESET
391 %token EDIF_TOK_MUSTJOIN
392 %token EDIF_TOK_NAME
393 %token EDIF_TOK_NET
394 %token EDIF_TOK_NETBACKANNOTATE
395 %token EDIF_TOK_NETBUNDLE
396 %token EDIF_TOK_NETDELAY
397 %token EDIF_TOK_NETGROUP
398 %token EDIF_TOK_NETMAP
399 %token EDIF_TOK_NETREF
400 %token EDIF_TOK_NOCHANGE
401 %token EDIF_TOK_NONPERMUTABLE
402 %token EDIF_TOK_NOTALLOWED
403 %token EDIF_TOK_NOTCHSPACING
404 %token EDIF_TOK_NUMBER
405 %token EDIF_TOK_NUMBERDEFINITION
406 %token EDIF_TOK_NUMBERDISPLAY
407 %token EDIF_TOK_OFFPAGECONNECTOR
408 %token EDIF_TOK_OFFSETEVENT
409 %token EDIF_TOK_OPENSHAPE
410 %token EDIF_TOK_ORIENTATION
411 %token EDIF_TOK_ORIGIN
412 %token EDIF_TOK_OVERHANGDISTANCE
413 %token EDIF_TOK_OVERLAPDISTANCE
414 %token EDIF_TOK_OVERSIZE
415 %token EDIF_TOK_OWNER
416 %token EDIF_TOK_PAGE
417 %token EDIF_TOK_PAGESIZE
418 %token EDIF_TOK_PARAMETER
419 %token EDIF_TOK_PARAMETERASSIGN
420 %token EDIF_TOK_PARAMETERDISPLAY
421 %token EDIF_TOK_PATH
422 %token EDIF_TOK_PATHDELAY
423 %token EDIF_TOK_PATHWIDTH
424 %token EDIF_TOK_PERMUTABLE
425 %token EDIF_TOK_PHYSICALDESIGNRULE
426 %token EDIF_TOK_PLUG
427 %token EDIF_TOK_POINT
428 %token EDIF_TOK_POINTDISPLAY
429 %token EDIF_TOK_POINTLIST
430 %token EDIF_TOK_POLYGON
431 %token EDIF_TOK_PORT
432 %token EDIF_TOK_PORTBACKANNOTATE
433 %token EDIF_TOK_PORTBUNDLE
434 %token EDIF_TOK_PORTDELAY
435 %token EDIF_TOK_PORTGROUP
436 %token EDIF_TOK_PORTIMPLEMENTATION
437 %token EDIF_TOK_PORTINSTANCE
438 %token EDIF_TOK_PORTLIST
439 %token EDIF_TOK_PORTLISTALIAS
440 %token EDIF_TOK_PORTMAP
441 %token EDIF_TOK_PORTREF
442 %token EDIF_TOK_PROGRAM
443 %token EDIF_TOK_PROPERTY
444 %token EDIF_TOK_PROPERTYDISPLAY
445 %token EDIF_TOK_PROTECTIONFRAME
446 %token EDIF_TOK_PT
447 %token EDIF_TOK_RANGEVECTOR
448 %token EDIF_TOK_RECTANGLE
449 %token EDIF_TOK_RECTANGLESIZE
450 %token EDIF_TOK_RENAME
451 %token EDIF_TOK_RESOLVES
452 %token EDIF_TOK_SCALE
453 %token EDIF_TOK_SCALEX
454 %token EDIF_TOK_SCALEY
455 %token EDIF_TOK_SECTION
456 %token EDIF_TOK_SHAPE
457 %token EDIF_TOK_SIMULATE
458 %token EDIF_TOK_SIMULATIONINFO
459 %token EDIF_TOK_SINGLEVALUESET
460 %token EDIF_TOK_SITE
461 %token EDIF_TOK_SOCKET
462 %token EDIF_TOK_SOCKETSET
463 %token EDIF_TOK_STATUS
464 %token EDIF_TOK_STEADY
465 %token EDIF_TOK_STRING
466 %token EDIF_TOK_STRINGDISPLAY
467 %token EDIF_TOK_STRONG
468 %token EDIF_TOK_SYMBOL
469 %token EDIF_TOK_SYMMETRY
470 %token EDIF_TOK_TABLE
471 %token EDIF_TOK_TABLEDEFAULT
472 %token EDIF_TOK_TECHNOLOGY
473 %token EDIF_TOK_TEXTHEIGHT
474 %token EDIF_TOK_TIMEINTERVAL
475 %token EDIF_TOK_TIMESTAMP
476 %token EDIF_TOK_TIMING
477 %token EDIF_TOK_TRANSFORM
478 %token EDIF_TOK_TRANSITION
479 %token EDIF_TOK_TRIGGER
480 %token EDIF_TOK_TRUE
481 %token EDIF_TOK_UNCONSTRAINED
482 %token EDIF_TOK_UNDEFINED
483 %token EDIF_TOK_UNION
484 %token EDIF_TOK_UNIT
485 %token EDIF_TOK_UNUSED
486 %token EDIF_TOK_USERDATA
487 %token EDIF_TOK_VERSION
488 %token EDIF_TOK_VIEW
489 %token EDIF_TOK_VIEWLIST
490 %token EDIF_TOK_VIEWMAP
491 %token EDIF_TOK_VIEWREF
492 %token EDIF_TOK_VIEWTYPE
493 %token EDIF_TOK_VISIBLE
494 %token EDIF_TOK_VOLTAGEMAP
495 %token EDIF_TOK_WAVEVALUE
496 %token EDIF_TOK_WEAK
497 %token EDIF_TOK_WEAKJOINED
498 %token EDIF_TOK_WHEN
499 %token EDIF_TOK_WRITTEN
501 %start Edif
505 PopC : ')' { PopC(); }
508 Edif : EDIF_TOK_EDIF EdifFileName EdifVersion EdifLevel KeywordMap _Edif PopC
511 _Edif :
512 | _Edif Status
513 | _Edif External
514 | _Edif Library
515 | _Edif Design
516 | _Edif Comment
517 | _Edif UserData
520 EdifFileName : NameDef { str_pair_free($1); }
523 EdifLevel : EDIF_TOK_EDIFLEVEL Int PopC { free($2); }
526 EdifVersion : EDIF_TOK_EDIFVERSION Int Int Int PopC
527 { free($2); free($3); free($4); }
530 AcLoad : EDIF_TOK_ACLOAD _AcLoad PopC
533 _AcLoad : MiNoMaValue
534 | MiNoMaDisp
537 After : EDIF_TOK_AFTER _After PopC
540 _After : MiNoMaValue
541 | _After Follow
542 | _After Maintain
543 | _After LogicAssn
544 | _After Comment
545 | _After UserData
548 Annotate : EDIF_TOK_ANNOTATE _Annotate PopC
551 _Annotate : Str { free($1); }
552 | StrDisplay
555 Apply : EDIF_TOK_APPLY _Apply PopC
558 _Apply : Cycle
559 | _Apply LogicIn
560 | _Apply LogicOut
561 | _Apply Comment
562 | _Apply UserData
565 Arc : EDIF_TOK_ARC PointValue PointValue PointValue PopC
568 Array : EDIF_TOK_ARRAY NameDef Int _Array PopC { str_pair_free($2); free($3); }
571 _Array :
572 | Int { free($1); }
575 ArrayMacro : EDIF_TOK_ARRAYMACRO Plug PopC
578 ArrayRelInfo : EDIF_TOK_ARRAYRELATEDINFO _ArrayRelInfo PopC
581 _ArrayRelInfo : BaseArray
582 | ArraySite
583 | ArrayMacro
584 | _ArrayRelInfo Comment
585 | _ArrayRelInfo UserData
588 ArraySite : EDIF_TOK_ARRAYSITE Socket PopC
591 AtLeast : EDIF_TOK_ATLEAST ScaledInt PopC
594 AtMost : EDIF_TOK_ATMOST ScaledInt PopC
597 Author : EDIF_TOK_AUTHOR Str PopC { free($2); }
600 BaseArray : EDIF_TOK_BASEARRAY PopC
603 Becomes : EDIF_TOK_BECOMES _Becomes PopC
606 _Becomes : LogicNameRef
607 | LogicList
608 | LogicOneOf
611 Between : EDIF_TOK_BETWEEN __Between _Between PopC
614 __Between : AtLeast
615 | GreaterThan
618 _Between : AtMost
619 | LessThan
622 Boolean : EDIF_TOK_BOOLEAN _Boolean PopC
625 _Boolean :
626 | _Boolean BooleanValue
627 | _Boolean BooleanDisp
628 | _Boolean Boolean
631 BooleanDisp : EDIF_TOK_BOOLEANDISPLAY _BooleanDisp PopC
634 _BooleanDisp : BooleanValue
635 | _BooleanDisp Display
638 BooleanMap : EDIF_TOK_BOOLEANMAP BooleanValue PopC
641 BooleanValue : True
642 | False
645 BorderPat : EDIF_TOK_BORDERPATTERN Int Int Boolean PopC { free($2); free($3); }
648 BorderWidth : EDIF_TOK_BORDERWIDTH Int PopC { free($2); }
651 BoundBox : EDIF_TOK_BOUNDINGBOX Rectangle PopC
654 Cell : EDIF_TOK_CELL CellNameDef _Cell PopC
657 _Cell : CellType
658 | _Cell Status
659 | _Cell ViewMap
660 | _Cell View
661 | _Cell Comment
662 | _Cell UserData
663 | _Cell Property
666 CellNameDef : NameDef { str_pair_free($1); }
669 CellRef : EDIF_TOK_CELLREF CellNameRef _CellRef PopC
672 _CellRef :
673 | LibraryRef
676 CellNameRef : NameRef { free($1); }
679 CellType : EDIF_TOK_CELLTYPE _CellType PopC
682 _CellType : EDIF_TOK_TIE
683 | EDIF_TOK_RIPPER
684 | EDIF_TOK_GENERIC
687 Change : EDIF_TOK_CHANGE __Change _Change PopC
690 __Change : PortNameRef
691 | PortRef { str_pair_free($1); }
692 | PortList
695 _Change :
696 | Becomes
697 | Transition
700 Circle : EDIF_TOK_CIRCLE PointValue PointValue _Circle PopC
703 _Circle :
704 | _Circle Property
707 Color : EDIF_TOK_COLOR ScaledInt ScaledInt ScaledInt PopC
710 Comment : EDIF_TOK_COMMENT _Comment PopC
713 _Comment :
714 | _Comment Str { free($2); }
717 CommGraph : EDIF_TOK_COMMENTGRAPHICS _CommGraph PopC
720 _CommGraph :
721 | _CommGraph Annotate
722 | _CommGraph Figure
723 | _CommGraph Instance
724 | _CommGraph BoundBox
725 | _CommGraph Property
726 | _CommGraph Comment
727 | _CommGraph UserData
730 Compound : EDIF_TOK_COMPOUND LogicNameRef PopC
733 Contents : EDIF_TOK_CONTENTS _Contents PopC
736 _Contents :
737 | _Contents Instance
738 | _Contents OffPageConn
739 | _Contents Figure
740 | _Contents Section
741 | _Contents Net
742 | _Contents NetBundle
743 | _Contents Page
744 | _Contents CommGraph
745 | _Contents PortImpl
746 | _Contents Timing
747 | _Contents Simulate
748 | _Contents When
749 | _Contents Follow
750 | _Contents LogicPort
751 | _Contents BoundBox
752 | _Contents Comment
753 | _Contents UserData
756 ConnectLoc : EDIF_TOK_CONNECTLOCATION _ConnectLoc PopC
759 _ConnectLoc :
760 | Figure
763 CornerType : EDIF_TOK_CORNERTYPE _CornerType PopC
766 _CornerType : EDIF_TOK_EXTEND
767 | EDIF_TOK_ROUND
768 | EDIF_TOK_TRUNCATE
771 Criticality : EDIF_TOK_CRITICALITY _Criticality PopC
774 _Criticality : Int { free($1); }
775 | IntDisplay
778 CurrentMap : EDIF_TOK_CURRENTMAP MiNoMaValue PopC
781 Curve : EDIF_TOK_CURVE _Curve PopC
784 _Curve :
785 | _Curve Arc
786 | _Curve PointValue
789 Cycle : EDIF_TOK_CYCLE Int _Cycle PopC { free($2); }
792 _Cycle :
793 | Duration
796 DataOrigin : EDIF_TOK_DATAORIGIN Str _DataOrigin PopC { free($2); }
799 _DataOrigin :
800 | Version
803 DcFanInLoad : EDIF_TOK_DCFANINLOAD _DcFanInLoad PopC
806 _DcFanInLoad : ScaledInt
807 | NumbDisplay
810 DcFanOutLoad : EDIF_TOK_DCFANOUTLOAD _DcFanOutLoad PopC
813 _DcFanOutLoad : ScaledInt
814 | NumbDisplay
817 DcMaxFanIn : EDIF_TOK_DCMAXFANIN _DcMaxFanIn PopC
820 _DcMaxFanIn : ScaledInt
821 | NumbDisplay
824 DcMaxFanOut : EDIF_TOK_DCMAXFANOUT _DcMaxFanOut PopC
827 _DcMaxFanOut : ScaledInt
828 | NumbDisplay
831 Delay : EDIF_TOK_DELAY _Delay PopC
834 _Delay : MiNoMaValue
835 | MiNoMaDisp
838 Delta : EDIF_TOK_DELTA _Delta PopC
841 _Delta :
842 | _Delta PointValue
845 Derivation : EDIF_TOK_DERIVATION _Derivation PopC
848 _Derivation : EDIF_TOK_CALCULATED
849 | EDIF_TOK_MEASURED
850 | EDIF_TOK_REQUIRED
853 Design : EDIF_TOK_DESIGN DesignNameDef _Design PopC
856 _Design : CellRef
857 | _Design Status
858 | _Design Comment
859 | _Design Property
860 | _Design UserData
863 Designator : EDIF_TOK_DESIGNATOR _Designator PopC
866 _Designator : Str { free($1); }
867 | StrDisplay
870 DesignNameDef : NameDef { str_pair_free($1); }
873 DesignRule : EDIF_TOK_PHYSICALDESIGNRULE _DesignRule PopC
876 _DesignRule :
877 | _DesignRule FigureWidth
878 | _DesignRule FigureArea
879 | _DesignRule RectSize
880 | _DesignRule FigurePerim
881 | _DesignRule OverlapDist
882 | _DesignRule OverhngDist
883 | _DesignRule EncloseDist
884 | _DesignRule InterFigGrp
885 | _DesignRule IntraFigGrp
886 | _DesignRule NotchSpace
887 | _DesignRule NotAllowed
888 | _DesignRule FigGrp
889 | _DesignRule Comment
890 | _DesignRule UserData
893 Difference : EDIF_TOK_DIFFERENCE _Difference PopC
896 _Difference : FigGrpRef
897 | FigureOp
898 | _Difference FigGrpRef
899 | _Difference FigureOp
902 Direction : EDIF_TOK_DIRECTION _Direction PopC
905 _Direction : EDIF_TOK_INOUT
906 | EDIF_TOK_INPUT
907 | EDIF_TOK_OUTPUT
910 Display : EDIF_TOK_DISPLAY _Display _DisplayJust _DisplayOrien _DisplayOrg PopC
913 _Display : FigGrpNameRef
914 | FigGrpOver
917 _DisplayJust :
918 | Justify
921 _DisplayOrien :
922 | Orientation
925 _DisplayOrg :
926 | Origin
929 Dominates : EDIF_TOK_DOMINATES _Dominates PopC
932 _Dominates :
933 | _Dominates LogicNameRef
936 Dot : EDIF_TOK_DOT _Dot PopC
939 _Dot : PointValue
940 | _Dot Property
943 Duration : EDIF_TOK_DURATION ScaledInt PopC
946 EncloseDist : EDIF_TOK_ENCLOSUREDISTANCE RuleNameDef FigGrpObj FigGrpObj _EncloseDist
947 PopC
950 _EncloseDist : Range
951 | SingleValSet
952 | _EncloseDist Comment
953 | _EncloseDist UserData
956 EndType : EDIF_TOK_ENDTYPE _EndType PopC
959 _EndType : EDIF_TOK_EXTEND
960 | EDIF_TOK_ROUND
961 | EDIF_TOK_TRUNCATE
964 Entry : EDIF_TOK_ENTRY ___Entry __Entry _Entry
965 PopC
968 ___Entry : Match
969 | Change
970 | Steady
973 __Entry : LogicRef
974 | PortRef { str_pair_free($1); }
975 | NoChange
976 | Table
979 _Entry :
980 | Delay
981 | LoadDelay
984 Event : EDIF_TOK_EVENT _Event PopC
987 _Event : PortRef { str_pair_free($1); }
988 | PortList
989 | PortGroup
990 | NetRef
991 | NetGroup
992 | _Event Transition
993 | _Event Becomes
996 Exactly : EDIF_TOK_EXACTLY ScaledInt PopC
999 External : EDIF_TOK_EXTERNAL LibNameDef EdifLevel _External PopC
1002 _External : Technology
1003 | _External Status
1004 | _External Cell
1005 | _External Comment
1006 | _External UserData
1009 Fabricate : EDIF_TOK_FABRICATE LayerNameDef FigGrpNameRef PopC
1012 False : EDIF_TOK_FALSE PopC
1015 FigGrp : EDIF_TOK_FIGUREGROUP _FigGrp PopC
1018 _FigGrp : FigGrpNameDef
1019 | _FigGrp CornerType
1020 | _FigGrp EndType
1021 | _FigGrp PathWidth
1022 | _FigGrp BorderWidth
1023 | _FigGrp Color
1024 | _FigGrp FillPattern
1025 | _FigGrp BorderPat
1026 | _FigGrp TextHeight
1027 | _FigGrp Visible
1028 | _FigGrp Comment
1029 | _FigGrp Property
1030 | _FigGrp UserData
1031 | _FigGrp IncFigGrp
1034 FigGrpNameDef : NameDef { str_pair_free($1); }
1037 FigGrpNameRef : NameRef { free($1); }
1040 FigGrpObj : EDIF_TOK_FIGUREGROUPOBJECT _FigGrpObj PopC
1043 _FigGrpObj : FigGrpNameRef
1044 | FigGrpRef
1045 | FigureOp
1048 FigGrpOver : EDIF_TOK_FIGUREGROUPOVERRIDE _FigGrpOver PopC
1051 _FigGrpOver : FigGrpNameRef
1052 | _FigGrpOver CornerType
1053 | _FigGrpOver EndType
1054 | _FigGrpOver PathWidth
1055 | _FigGrpOver BorderWidth
1056 | _FigGrpOver Color
1057 | _FigGrpOver FillPattern
1058 | _FigGrpOver BorderPat
1059 | _FigGrpOver TextHeight
1060 | _FigGrpOver Visible
1061 | _FigGrpOver Comment
1062 | _FigGrpOver Property
1063 | _FigGrpOver UserData
1066 FigGrpRef : EDIF_TOK_FIGUREGROUPREF FigGrpNameRef _FigGrpRef PopC
1069 _FigGrpRef :
1070 | LibraryRef
1073 Figure : EDIF_TOK_FIGURE _Figure PopC
1076 _Figure : FigGrpNameDef
1077 | FigGrpOver
1078 | _Figure Circle
1079 | _Figure Dot
1080 | _Figure OpenShape
1081 | _Figure Path
1082 | _Figure Polygon
1083 | _Figure Rectangle
1084 | _Figure Shape
1085 | _Figure Comment
1086 | _Figure UserData
1089 FigureArea : EDIF_TOK_FIGUREAREA RuleNameDef FigGrpObj _FigureArea PopC
1092 _FigureArea : Range
1093 | SingleValSet
1094 | _FigureArea Comment
1095 | _FigureArea UserData
1098 FigureOp : Intersection
1099 | Union
1100 | Difference
1101 | Inverse
1102 | Oversize
1105 FigurePerim : EDIF_TOK_FIGUREPERIMETER RuleNameDef FigGrpObj _FigurePerim PopC
1108 _FigurePerim : Range
1109 | SingleValSet
1110 | _FigurePerim Comment
1111 | _FigurePerim UserData
1114 FigureWidth : EDIF_TOK_FIGUREWIDTH RuleNameDef FigGrpObj _FigureWidth PopC
1117 _FigureWidth : Range
1118 | SingleValSet
1119 | _FigureWidth Comment
1120 | _FigureWidth UserData
1123 FillPattern : EDIF_TOK_FILLPATTERN Int Int Boolean PopC { free($2); free($3); }
1126 Follow : EDIF_TOK_FOLLOW __Follow _Follow PopC
1129 __Follow : PortNameRef
1130 | PortRef { str_pair_free($1); }
1133 _Follow : PortRef { str_pair_free($1); }
1134 | Table
1135 | _Follow Delay
1136 | _Follow LoadDelay
1139 Forbidden : EDIF_TOK_FORBIDDENEVENT _Forbidden PopC
1142 _Forbidden : TimeIntval
1143 | _Forbidden Event
1146 Form : Keyword _Form ')' { free($1); }
1149 _Form :
1150 | _Form Int { free($2); }
1151 | _Form Str { free($2); }
1152 | _Form Ident { free($2); }
1153 | _Form Form
1156 GlobPortRef : EDIF_TOK_GLOBALPORTREF PortNameRef PopC
1159 GreaterThan : EDIF_TOK_GREATERTHAN ScaledInt PopC
1162 GridMap : EDIF_TOK_GRIDMAP ScaledInt ScaledInt PopC
1165 Ignore : EDIF_TOK_IGNORE PopC
1168 IncFigGrp : EDIF_TOK_INCLUDEFIGUREGROUP _IncFigGrp PopC
1171 _IncFigGrp : FigGrpRef
1172 | FigureOp
1175 Initial : EDIF_TOK_INITIAL PopC
1178 Instance : EDIF_TOK_INSTANCE InstNameDef _Instance PopC
1181 _Instance : ViewRef
1182 | ViewList
1183 | _Instance Transform
1184 | _Instance ParamAssign
1185 | _Instance PortInst
1186 | _Instance Timing
1187 | _Instance Designator
1188 | _Instance Property
1189 | _Instance Comment
1190 | _Instance UserData
1193 InstanceRef : EDIF_TOK_INSTANCEREF InstNameRef _InstanceRef PopC { $$=$2; }
1196 _InstanceRef :
1197 | InstanceRef { free($1); }
1198 | ViewRef
1201 InstBackAn : EDIF_TOK_INSTANCEBACKANNOTATE _InstBackAn PopC
1204 _InstBackAn : InstanceRef { free($1); }
1205 | _InstBackAn Designator
1206 | _InstBackAn Timing
1207 | _InstBackAn Property
1208 | _InstBackAn Comment
1211 InstGroup : EDIF_TOK_INSTANCEGROUP _InstGroup PopC
1214 _InstGroup :
1215 | _InstGroup InstanceRef { free($2); }
1218 InstMap : EDIF_TOK_INSTANCEMAP _InstMap PopC
1221 _InstMap :
1222 | _InstMap InstanceRef { free($2); }
1223 | _InstMap InstGroup
1224 | _InstMap Comment
1225 | _InstMap UserData
1228 InstNameDef : NameDef { str_pair_free($1); }
1229 | Array
1232 InstNameRef : NameRef { $$=$1; }
1233 | Member
1236 IntDisplay : EDIF_TOK_INTEGERDISPLAY _IntDisplay PopC
1239 _IntDisplay : Int { free($1); }
1240 | _IntDisplay Display
1243 Integer : EDIF_TOK_INTEGER _Integer PopC
1246 _Integer :
1247 | _Integer Int { free($2); }
1248 | _Integer IntDisplay
1249 | _Integer Integer
1252 Interface : EDIF_TOK_INTERFACE _Interface PopC
1255 _Interface :
1256 | _Interface Port
1257 | _Interface PortBundle
1258 | _Interface Symbol
1259 | _Interface ProtectFrame
1260 | _Interface ArrayRelInfo
1261 | _Interface Parameter
1262 | _Interface Joined { pair_list_free($2); }
1263 | _Interface MustJoin
1264 | _Interface WeakJoined
1265 | _Interface Permutable
1266 | _Interface Timing
1267 | _Interface Simulate
1268 | _Interface Designator
1269 | _Interface Property
1270 | _Interface Comment
1271 | _Interface UserData
1274 InterFigGrp : EDIF_TOK_INTERFIGUREGROUPSPACING RuleNameDef FigGrpObj FigGrpObj
1275 _InterFigGrp PopC
1278 _InterFigGrp : Range
1279 | SingleValSet
1280 | _InterFigGrp Comment
1281 | _InterFigGrp UserData
1284 Intersection : EDIF_TOK_INTERSECTION _Intersection PopC
1287 _Intersection : FigGrpRef
1288 | FigureOp
1289 | _Intersection FigGrpRef
1290 | _Intersection FigureOp
1293 IntraFigGrp : EDIF_TOK_INTRAFIGUREGROUPSPACING RuleNameDef FigGrpObj _IntraFigGrp PopC
1296 _IntraFigGrp : Range
1297 | SingleValSet
1298 | _IntraFigGrp Comment
1299 | _IntraFigGrp UserData
1302 Inverse : EDIF_TOK_INVERSE _Inverse PopC
1305 _Inverse : FigGrpRef
1306 | FigureOp
1309 Isolated : EDIF_TOK_ISOLATED PopC
1312 Joined : EDIF_TOK_JOINED _Joined PopC { $$ = new_pair_list($2); }
1315 _Joined : { $$=NULL; }
1316 | _Joined PortRef { $2->next = $1; $$ = $2; }
1317 | _Joined PortList
1318 | _Joined GlobPortRef
1321 Justify : EDIF_TOK_JUSTIFY _Justify PopC
1324 _Justify : EDIF_TOK_CENTERCENTER
1325 | EDIF_TOK_CENTERLEFT
1326 | EDIF_TOK_CENTERRIGHT
1327 | EDIF_TOK_LOWERCENTER
1328 | EDIF_TOK_LOWERLEFT
1329 | EDIF_TOK_LOWERRIGHT
1330 | EDIF_TOK_UPPERCENTER
1331 | EDIF_TOK_UPPERLEFT
1332 | EDIF_TOK_UPPERRIGHT
1335 KeywordDisp : EDIF_TOK_KEYWORDDISPLAY _KeywordDisp PopC
1338 _KeywordDisp : KeywordName
1339 | _KeywordDisp Display
1342 KeywordLevel : EDIF_TOK_KEYWORDLEVEL Int PopC { free($2); }
1345 KeywordMap : EDIF_TOK_KEYWORDMAP _KeywordMap PopC
1348 _KeywordMap : KeywordLevel
1349 | _KeywordMap Comment
1352 KeywordName : Ident { free($1); }
1355 LayerNameDef : NameDef { str_pair_free($1); }
1358 LessThan : EDIF_TOK_LESSTHAN ScaledInt PopC
1361 LibNameDef : NameDef { str_pair_free($1); }
1364 LibNameRef : NameRef { free($1); }
1367 Library : EDIF_TOK_LIBRARY LibNameDef EdifLevel _Library PopC
1370 _Library : Technology
1371 | _Library Status
1372 | _Library Cell
1373 | _Library Comment
1374 | _Library UserData
1377 LibraryRef : EDIF_TOK_LIBRARYREF LibNameRef PopC
1380 ListOfNets : EDIF_TOK_LISTOFNETS _ListOfNets PopC
1383 _ListOfNets :
1384 | _ListOfNets Net
1387 ListOfPorts : EDIF_TOK_LISTOFPORTS _ListOfPorts PopC
1390 _ListOfPorts :
1391 | _ListOfPorts Port
1392 | _ListOfPorts PortBundle
1395 LoadDelay : EDIF_TOK_LOADDELAY _LoadDelay _LoadDelay PopC
1398 _LoadDelay : MiNoMaValue
1399 | MiNoMaDisp
1402 LogicAssn : EDIF_TOK_LOGICASSIGN ___LogicAssn __LogicAssn _LogicAssn PopC
1405 ___LogicAssn : PortNameRef
1406 | PortRef { str_pair_free($1); }
1409 __LogicAssn : PortRef { str_pair_free($1); }
1410 | LogicRef
1411 | Table
1414 _LogicAssn :
1415 | Delay
1416 | LoadDelay
1419 LogicIn : EDIF_TOK_LOGICINPUT _LogicIn PopC
1422 _LogicIn : PortList
1423 | PortRef { str_pair_free($1); }
1424 | PortNameRef
1425 | _LogicIn LogicWave
1428 LogicList : EDIF_TOK_LOGICLIST _LogicList PopC
1431 _LogicList :
1432 | _LogicList LogicNameRef
1433 | _LogicList LogicOneOf
1434 | _LogicList Ignore
1437 LogicMapIn : EDIF_TOK_LOGICMAPINPUT _LogicMapIn PopC
1440 _LogicMapIn :
1441 | _LogicMapIn LogicNameRef
1444 LogicMapOut : EDIF_TOK_LOGICMAPOUTPUT _LogicMapOut PopC
1447 _LogicMapOut :
1448 | _LogicMapOut LogicNameRef
1451 LogicNameDef : NameDef { str_pair_free($1); }
1454 LogicNameRef : NameRef { free($1); }
1457 LogicOneOf : EDIF_TOK_LOGICONEOF _LogicOneOf PopC
1460 _LogicOneOf :
1461 | _LogicOneOf LogicNameRef
1462 | _LogicOneOf LogicList
1465 LogicOut : EDIF_TOK_LOGICOUTPUT _LogicOut PopC
1468 _LogicOut : PortList
1469 | PortRef { str_pair_free($1); }
1470 | PortNameRef
1471 | _LogicOut LogicWave
1474 LogicPort : EDIF_TOK_LOGICPORT _LogicPort PopC
1477 _LogicPort : PortNameDef
1478 | _LogicPort Property
1479 | _LogicPort Comment
1480 | _LogicPort UserData
1483 LogicRef : EDIF_TOK_LOGICREF LogicNameRef _LogicRef PopC
1486 _LogicRef :
1487 | LibraryRef
1490 LogicValue : EDIF_TOK_LOGICVALUE _LogicValue PopC
1493 _LogicValue : LogicNameDef
1494 | _LogicValue VoltageMap
1495 | _LogicValue CurrentMap
1496 | _LogicValue BooleanMap
1497 | _LogicValue Compound
1498 | _LogicValue Weak
1499 | _LogicValue Strong
1500 | _LogicValue Dominates
1501 | _LogicValue LogicMapOut
1502 | _LogicValue LogicMapIn
1503 | _LogicValue Isolated
1504 | _LogicValue Resolves
1505 | _LogicValue Property
1506 | _LogicValue Comment
1507 | _LogicValue UserData
1510 LogicWave : EDIF_TOK_LOGICWAVEFORM _LogicWave PopC
1513 _LogicWave :
1514 | _LogicWave LogicNameRef
1515 | _LogicWave LogicList
1516 | _LogicWave LogicOneOf
1517 | _LogicWave Ignore
1520 Maintain : EDIF_TOK_MAINTAIN __Maintain _Maintain PopC
1523 __Maintain : PortNameRef
1524 | PortRef { str_pair_free($1); }
1527 _Maintain :
1528 | Delay
1529 | LoadDelay
1532 Match : EDIF_TOK_MATCH __Match _Match PopC
1535 __Match : PortNameRef
1536 | PortRef { str_pair_free($1); }
1537 | PortList
1540 _Match : LogicNameRef
1541 | LogicList
1542 | LogicOneOf
1545 Member : EDIF_TOK_MEMBER NameRef _Member PopC { free($2); }
1548 _Member : Int { free($1); }
1549 | _Member Int { free($2); }
1552 MiNoMa : EDIF_TOK_MINOMAX _MiNoMa PopC
1555 _MiNoMa :
1556 | _MiNoMa MiNoMaValue
1557 | _MiNoMa MiNoMaDisp
1558 | _MiNoMa MiNoMa
1561 MiNoMaDisp : EDIF_TOK_MINOMAXDISPLAY _MiNoMaDisp PopC
1564 _MiNoMaDisp : MiNoMaValue
1565 | _MiNoMaDisp Display
1568 MiNoMaValue : Mnm
1569 | ScaledInt
1572 Mnm : EDIF_TOK_MNM _Mnm _Mnm _Mnm PopC
1575 _Mnm : ScaledInt
1576 | Undefined
1577 | Unconstrained
1580 MultValSet : EDIF_TOK_MULTIPLEVALUESET _MultValSet PopC
1583 _MultValSet :
1584 | _MultValSet RangeVector
1587 MustJoin : EDIF_TOK_MUSTJOIN _MustJoin PopC
1590 _MustJoin :
1591 | _MustJoin PortRef { str_pair_free($2); }
1592 | _MustJoin PortList
1593 | _MustJoin WeakJoined
1594 | _MustJoin Joined { pair_list_free($2); }
1597 Name : EDIF_TOK_NAME _Name PopC { $$=$2; }
1600 _Name : Ident { $$=$1; }
1601 | _Name Display
1604 NameDef : Ident { $$ = new_str_pair($1,NULL); }
1605 | Name { $$ = new_str_pair($1,NULL); }
1606 | Rename { $$=$1; }
1609 NameRef : Ident { $$=$1; }
1610 | Name { $$=$1; }
1613 Net : EDIF_TOK_NET NetNameDef _Net PopC { define_pcb_net($2, $3); }
1616 _Net : Joined { $$=$1; }
1617 | _Net Criticality
1618 | _Net NetDelay
1619 | _Net Figure
1620 | _Net Net
1621 | _Net Instance
1622 | _Net CommGraph
1623 | _Net Property
1624 | _Net Comment
1625 | _Net UserData
1628 NetBackAn : EDIF_TOK_NETBACKANNOTATE _NetBackAn PopC
1631 _NetBackAn : NetRef
1632 | _NetBackAn NetDelay
1633 | _NetBackAn Criticality
1634 | _NetBackAn Property
1635 | _NetBackAn Comment
1638 NetBundle : EDIF_TOK_NETBUNDLE NetNameDef _NetBundle PopC { str_pair_free($2); }
1641 _NetBundle : ListOfNets
1642 | _NetBundle Figure
1643 | _NetBundle CommGraph
1644 | _NetBundle Property
1645 | _NetBundle Comment
1646 | _NetBundle UserData
1649 NetDelay : EDIF_TOK_NETDELAY Derivation _NetDelay PopC
1652 _NetDelay : Delay
1653 | _NetDelay Transition
1654 | _NetDelay Becomes
1657 NetGroup : EDIF_TOK_NETGROUP _NetGroup PopC
1660 _NetGroup :
1661 | _NetGroup NetNameRef
1662 | _NetGroup NetRef
1665 NetMap : EDIF_TOK_NETMAP _NetMap PopC
1668 _NetMap :
1669 | _NetMap NetRef
1670 | _NetMap NetGroup
1671 | _NetMap Comment
1672 | _NetMap UserData
1675 NetNameDef : NameDef { $$=$1; }
1676 | Array { $$=NULL; }
1680 NetNameRef : NameRef { free($1); }
1681 | Member
1684 NetRef : EDIF_TOK_NETREF NetNameRef _NetRef PopC
1687 _NetRef :
1688 | NetRef
1689 | InstanceRef { free($1); }
1690 | ViewRef
1693 NoChange : EDIF_TOK_NOCHANGE PopC
1696 NonPermut : EDIF_TOK_NONPERMUTABLE _NonPermut PopC
1699 _NonPermut :
1700 | _NonPermut PortRef { str_pair_free($2); }
1701 | _NonPermut Permutable
1704 NotAllowed : EDIF_TOK_NOTALLOWED RuleNameDef _NotAllowed PopC
1707 _NotAllowed : FigGrpObj
1708 | _NotAllowed Comment
1709 | _NotAllowed UserData
1712 NotchSpace : EDIF_TOK_NOTCHSPACING RuleNameDef FigGrpObj _NotchSpace PopC
1715 _NotchSpace : Range
1716 | SingleValSet
1717 | _NotchSpace Comment
1718 | _NotchSpace UserData
1721 Number : EDIF_TOK_NUMBER _Number PopC
1724 _Number :
1725 | _Number ScaledInt
1726 | _Number NumbDisplay
1727 | _Number Number
1730 NumbDisplay : EDIF_TOK_NUMBERDISPLAY _NumbDisplay PopC
1733 _NumbDisplay : ScaledInt
1734 | _NumbDisplay Display
1737 NumberDefn : EDIF_TOK_NUMBERDEFINITION _NumberDefn PopC
1740 _NumberDefn :
1741 | _NumberDefn Scale
1742 | _NumberDefn GridMap
1743 | _NumberDefn Comment
1746 OffPageConn : EDIF_TOK_OFFPAGECONNECTOR _OffPageConn PopC
1749 _OffPageConn : PortNameDef
1750 | _OffPageConn Unused
1751 | _OffPageConn Property
1752 | _OffPageConn Comment
1753 | _OffPageConn UserData
1756 OffsetEvent : EDIF_TOK_OFFSETEVENT Event ScaledInt PopC
1759 OpenShape : EDIF_TOK_OPENSHAPE _OpenShape PopC
1762 _OpenShape : Curve
1763 | _OpenShape Property
1766 Orientation : EDIF_TOK_ORIENTATION _Orientation PopC
1769 _Orientation : EDIF_TOK_R0
1770 | EDIF_TOK_R90
1771 | EDIF_TOK_R180
1772 | EDIF_TOK_R270
1773 | EDIF_TOK_MX
1774 | EDIF_TOK_MY
1775 | EDIF_TOK_MYR90
1776 | EDIF_TOK_MXR90
1779 Origin : EDIF_TOK_ORIGIN PointValue PopC
1782 OverhngDist : EDIF_TOK_OVERHANGDISTANCE RuleNameDef FigGrpObj FigGrpObj _OverhngDist
1783 PopC
1786 _OverhngDist : Range
1787 | SingleValSet
1788 | _OverhngDist Comment
1789 | _OverhngDist UserData
1792 OverlapDist : EDIF_TOK_OVERLAPDISTANCE RuleNameDef FigGrpObj FigGrpObj _OverlapDist
1793 PopC
1796 _OverlapDist : Range
1797 | SingleValSet
1798 | _OverlapDist Comment
1799 | _OverlapDist UserData
1802 Oversize : EDIF_TOK_OVERSIZE Int _Oversize CornerType PopC { free($2); }
1805 _Oversize : FigGrpRef
1806 | FigureOp
1809 Owner : EDIF_TOK_OWNER Str PopC { free($2); }
1812 Page : EDIF_TOK_PAGE _Page PopC
1815 _Page : InstNameDef
1816 | _Page Instance
1817 | _Page Net
1818 | _Page NetBundle
1819 | _Page CommGraph
1820 | _Page PortImpl
1821 | _Page PageSize
1822 | _Page BoundBox
1823 | _Page Comment
1824 | _Page UserData
1827 PageSize : EDIF_TOK_PAGESIZE Rectangle PopC
1830 ParamDisp : EDIF_TOK_PARAMETERDISPLAY _ParamDisp PopC
1833 _ParamDisp : ValueNameRef
1834 | _ParamDisp Display
1837 Parameter : EDIF_TOK_PARAMETER ValueNameDef TypedValue _Parameter PopC
1840 _Parameter :
1841 | Unit
1844 ParamAssign : EDIF_TOK_PARAMETERASSIGN ValueNameRef TypedValue PopC
1847 Path : EDIF_TOK_PATH _Path PopC
1850 _Path : PointList
1851 | _Path Property
1854 PathDelay : EDIF_TOK_PATHDELAY _PathDelay PopC
1857 _PathDelay : Delay
1858 | _PathDelay Event
1861 PathWidth : EDIF_TOK_PATHWIDTH Int PopC { free($2); }
1864 Permutable : EDIF_TOK_PERMUTABLE _Permutable PopC
1867 _Permutable :
1868 | _Permutable PortRef { str_pair_free($2); }
1869 | _Permutable Permutable
1870 | _Permutable NonPermut
1873 Plug : EDIF_TOK_PLUG _Plug PopC
1876 _Plug :
1877 | _Plug SocketSet
1880 Point : EDIF_TOK_POINT _Point PopC
1883 _Point :
1884 | _Point PointValue
1885 | _Point PointDisp
1886 | _Point Point
1889 PointDisp : EDIF_TOK_POINTDISPLAY _PointDisp PopC
1892 _PointDisp : PointValue
1893 | _PointDisp Display
1896 PointList : EDIF_TOK_POINTLIST _PointList PopC
1899 _PointList :
1900 | _PointList PointValue
1903 PointValue : EDIF_TOK_PT Int Int PopC { free($2); free($3); }
1906 Polygon : EDIF_TOK_POLYGON _Polygon PopC
1909 _Polygon : PointList
1910 | _Polygon Property
1913 Port : EDIF_TOK_PORT _Port PopC
1916 _Port : PortNameDef
1917 | _Port Direction
1918 | _Port Unused
1919 | _Port PortDelay
1920 | _Port Designator
1921 | _Port DcFanInLoad
1922 | _Port DcFanOutLoad
1923 | _Port DcMaxFanIn
1924 | _Port DcMaxFanOut
1925 | _Port AcLoad
1926 | _Port Property
1927 | _Port Comment
1928 | _Port UserData
1931 PortBackAn : EDIF_TOK_PORTBACKANNOTATE _PortBackAn PopC
1934 _PortBackAn : PortRef { str_pair_free($1); }
1935 | _PortBackAn Designator
1936 | _PortBackAn PortDelay
1937 | _PortBackAn DcFanInLoad
1938 | _PortBackAn DcFanOutLoad
1939 | _PortBackAn DcMaxFanIn
1940 | _PortBackAn DcMaxFanOut
1941 | _PortBackAn AcLoad
1942 | _PortBackAn Property
1943 | _PortBackAn Comment
1946 PortBundle : EDIF_TOK_PORTBUNDLE PortNameDef _PortBundle PopC
1949 _PortBundle : ListOfPorts
1950 | _PortBundle Property
1951 | _PortBundle Comment
1952 | _PortBundle UserData
1955 PortDelay : EDIF_TOK_PORTDELAY Derivation _PortDelay PopC
1958 _PortDelay : Delay
1959 | LoadDelay
1960 | _PortDelay Transition
1961 | _PortDelay Becomes
1964 PortGroup : EDIF_TOK_PORTGROUP _PortGroup PopC
1967 _PortGroup :
1968 | _PortGroup PortNameRef
1969 | _PortGroup PortRef { str_pair_free($2); }
1972 PortImpl : EDIF_TOK_PORTIMPLEMENTATION _PortImpl PopC
1975 _PortImpl : PortRef { str_pair_free($1); }
1976 | PortNameRef
1977 | _PortImpl ConnectLoc
1978 | _PortImpl Figure
1979 | _PortImpl Instance
1980 | _PortImpl CommGraph
1981 | _PortImpl PropDisplay
1982 | _PortImpl KeywordDisp
1983 | _PortImpl Property
1984 | _PortImpl UserData
1985 | _PortImpl Comment
1988 PortInst : EDIF_TOK_PORTINSTANCE _PortInst PopC
1991 _PortInst : PortRef { str_pair_free($1); }
1992 | PortNameRef
1993 | _PortInst Unused
1994 | _PortInst PortDelay
1995 | _PortInst Designator
1996 | _PortInst DcFanInLoad
1997 | _PortInst DcFanOutLoad
1998 | _PortInst DcMaxFanIn
1999 | _PortInst DcMaxFanOut
2000 | _PortInst AcLoad
2001 | _PortInst Property
2002 | _PortInst Comment
2003 | _PortInst UserData
2006 PortList : EDIF_TOK_PORTLIST _PortList PopC
2009 _PortList :
2010 | _PortList PortRef { str_pair_free($2); }
2011 | _PortList PortNameRef
2014 PortListAls : EDIF_TOK_PORTLISTALIAS PortNameDef PortList PopC
2017 PortMap : EDIF_TOK_PORTMAP _PortMap PopC
2020 _PortMap :
2021 | _PortMap PortRef { str_pair_free($2); }
2022 | _PortMap PortGroup
2023 | _PortMap Comment
2024 | _PortMap UserData
2027 PortNameDef : NameDef { str_pair_free($1); }
2028 | Array
2031 PortNameRef : NameRef { $$=$1; }
2032 | Member
2035 PortRef : EDIF_TOK_PORTREF PortNameRef _PortRef PopC
2037 if ($3)
2039 $$ = new_str_pair($3->str1,$2);
2040 free($3);
2042 else
2044 /* handle port with no instance by passing up the chain */
2045 $$ = new_str_pair(NULL,$2);
2050 _PortRef : { $$=NULL; }
2051 | PortRef { $$=$1; }
2052 | InstanceRef { $$ = new_str_pair($1,NULL); }
2053 | ViewRef { $$=NULL; }
2056 Program : EDIF_TOK_PROGRAM Str _Program PopC
2059 _Program :
2060 | Version
2063 PropDisplay : EDIF_TOK_PROPERTYDISPLAY _PropDisplay PopC
2066 _PropDisplay : PropNameRef
2067 | _PropDisplay Display
2070 Property : EDIF_TOK_PROPERTY PropNameDef _Property PopC
2073 _Property : TypedValue
2074 | _Property Owner
2075 | _Property Unit
2076 | _Property Property
2077 | _Property Comment
2080 PropNameDef : NameDef { str_pair_free($1); }
2083 PropNameRef : NameRef { free($1); }
2086 ProtectFrame : EDIF_TOK_PROTECTIONFRAME _ProtectFrame PopC
2089 _ProtectFrame :
2090 | _ProtectFrame PortImpl
2091 | _ProtectFrame Figure
2092 | _ProtectFrame Instance
2093 | _ProtectFrame CommGraph
2094 | _ProtectFrame BoundBox
2095 | _ProtectFrame PropDisplay
2096 | _ProtectFrame KeywordDisp
2097 | _ProtectFrame ParamDisp
2098 | _ProtectFrame Property
2099 | _ProtectFrame Comment
2100 | _ProtectFrame UserData
2103 Range : LessThan
2104 | GreaterThan
2105 | AtMost
2106 | AtLeast
2107 | Exactly
2108 | Between
2111 RangeVector : EDIF_TOK_RANGEVECTOR _RangeVector PopC
2114 _RangeVector :
2115 | _RangeVector Range
2116 | _RangeVector SingleValSet
2119 Rectangle : EDIF_TOK_RECTANGLE PointValue _Rectangle PopC
2122 _Rectangle : PointValue
2123 | _Rectangle Property
2126 RectSize : EDIF_TOK_RECTANGLESIZE RuleNameDef FigGrpObj _RectSize PopC
2129 _RectSize : RangeVector
2130 | MultValSet
2131 | _RectSize Comment
2132 | _RectSize UserData
2135 Rename : EDIF_TOK_RENAME __Rename _Rename PopC
2136 { $$ = new_str_pair($2,$3); }
2139 __Rename : Ident { $$=$1; }
2140 | Name { $$=$1; }
2143 _Rename : Str { $$=$1; }
2144 | StrDisplay { $$=NULL; }
2147 Resolves : EDIF_TOK_RESOLVES _Resolves PopC
2150 _Resolves :
2151 | _Resolves LogicNameRef
2154 RuleNameDef : NameDef { str_pair_free($1); }
2157 Scale : EDIF_TOK_SCALE ScaledInt ScaledInt Unit PopC
2160 ScaledInt : Int { free($1); }
2161 | EDIF_TOK_E Int Int PopC { free($2); free($3); }
2164 ScaleX : EDIF_TOK_SCALEX Int Int PopC { free($2); free($3); }
2167 ScaleY : EDIF_TOK_SCALEY Int Int PopC { free($2); free($3); }
2170 Section : EDIF_TOK_SECTION _Section PopC
2173 _Section : Str { free($1); }
2174 | _Section Section
2175 | _Section Str { free($2); }
2176 | _Section Instance
2179 Shape : EDIF_TOK_SHAPE _Shape PopC
2182 _Shape : Curve
2183 | _Shape Property
2186 SimNameDef : NameDef { str_pair_free($1); }
2189 Simulate : EDIF_TOK_SIMULATE _Simulate PopC
2192 _Simulate : SimNameDef
2193 | _Simulate PortListAls
2194 | _Simulate WaveValue
2195 | _Simulate Apply
2196 | _Simulate Comment
2197 | _Simulate UserData
2200 SimulInfo : EDIF_TOK_SIMULATIONINFO _SimulInfo PopC
2203 _SimulInfo :
2204 | _SimulInfo LogicValue
2205 | _SimulInfo Comment
2206 | _SimulInfo UserData
2209 SingleValSet : EDIF_TOK_SINGLEVALUESET _SingleValSet PopC
2212 _SingleValSet :
2213 | Range
2216 Site : EDIF_TOK_SITE ViewRef _Site PopC
2219 _Site :
2220 | Transform
2223 Socket : EDIF_TOK_SOCKET _Socket PopC
2226 _Socket :
2227 | Symmetry
2230 SocketSet : EDIF_TOK_SOCKETSET _SocketSet PopC
2233 _SocketSet : Symmetry
2234 | _SocketSet Site
2237 Status : EDIF_TOK_STATUS _Status PopC
2240 _Status :
2241 | _Status Written
2242 | _Status Comment
2243 | _Status UserData
2246 Steady : EDIF_TOK_STEADY __Steady _Steady PopC
2249 __Steady : PortNameRef
2250 | PortRef { str_pair_free($1); }
2251 | PortList
2254 _Steady : Duration
2255 | _Steady Transition
2256 | _Steady Becomes
2259 StrDisplay : EDIF_TOK_STRINGDISPLAY _StrDisplay PopC
2262 String : EDIF_TOK_STRING _String PopC
2265 _String :
2266 | _String Str { free($2); }
2267 | _String StrDisplay
2268 | _String String
2271 _StrDisplay : Str { free($1); }
2272 | _StrDisplay Display
2275 Strong : EDIF_TOK_STRONG LogicNameRef PopC
2278 Symbol : EDIF_TOK_SYMBOL _Symbol PopC
2281 _Symbol :
2282 | _Symbol PortImpl
2283 | _Symbol Figure
2284 | _Symbol Instance
2285 | _Symbol CommGraph
2286 | _Symbol Annotate
2287 | _Symbol PageSize
2288 | _Symbol BoundBox
2289 | _Symbol PropDisplay
2290 | _Symbol KeywordDisp
2291 | _Symbol ParamDisp
2292 | _Symbol Property
2293 | _Symbol Comment
2294 | _Symbol UserData
2297 Symmetry : EDIF_TOK_SYMMETRY _Symmetry PopC
2300 _Symmetry :
2301 | _Symmetry Transform
2304 Table : EDIF_TOK_TABLE _Table PopC
2307 _Table :
2308 | _Table Entry
2309 | _Table TableDeflt
2312 TableDeflt : EDIF_TOK_TABLEDEFAULT __TableDeflt _TableDeflt PopC
2315 __TableDeflt : LogicRef
2316 | PortRef { str_pair_free($1); }
2317 | NoChange
2318 | Table
2321 _TableDeflt :
2322 | Delay
2323 | LoadDelay
2326 Technology : EDIF_TOK_TECHNOLOGY _Technology PopC
2329 _Technology : NumberDefn
2330 | _Technology FigGrp
2331 | _Technology Fabricate
2332 | _Technology SimulInfo
2333 | _Technology DesignRule
2334 | _Technology Comment
2335 | _Technology UserData
2338 TextHeight : EDIF_TOK_TEXTHEIGHT Int PopC { free($2); }
2341 TimeIntval : EDIF_TOK_TIMEINTERVAL __TimeIntval _TimeIntval PopC
2344 __TimeIntval : Event
2345 | OffsetEvent
2348 _TimeIntval : Event
2349 | OffsetEvent
2350 | Duration
2353 TimeStamp : EDIF_TOK_TIMESTAMP Int Int Int Int Int Int PopC
2354 { free($2); free($3); free($4); free($5); free($6); free($7); }
2357 Timing : EDIF_TOK_TIMING _Timing PopC
2360 _Timing : Derivation
2361 | _Timing PathDelay
2362 | _Timing Forbidden
2363 | _Timing Comment
2364 | _Timing UserData
2367 Transform : EDIF_TOK_TRANSFORM _TransX _TransY _TransDelta _TransOrien _TransOrg
2368 PopC
2371 _TransX :
2372 | ScaleX
2375 _TransY :
2376 | ScaleY
2379 _TransDelta :
2380 | Delta
2383 _TransOrien :
2384 | Orientation
2387 _TransOrg :
2388 | Origin
2391 Transition : EDIF_TOK_TRANSITION _Transition _Transition PopC
2394 _Transition : LogicNameRef
2395 | LogicList
2396 | LogicOneOf
2399 Trigger : EDIF_TOK_TRIGGER _Trigger PopC
2402 _Trigger :
2403 | _Trigger Change
2404 | _Trigger Steady
2405 | _Trigger Initial
2408 True : EDIF_TOK_TRUE PopC
2411 TypedValue : Boolean
2412 | Integer
2413 | MiNoMa
2414 | Number
2415 | Point
2416 | String
2419 Unconstrained : EDIF_TOK_UNCONSTRAINED PopC
2422 Undefined : EDIF_TOK_UNDEFINED PopC
2425 Union : EDIF_TOK_UNION _Union PopC
2428 _Union : FigGrpRef
2429 | FigureOp
2430 | _Union FigGrpRef
2431 | _Union FigureOp
2434 Unit : EDIF_TOK_UNIT _Unit PopC
2437 _Unit : EDIF_TOK_DISTANCE
2438 | EDIF_TOK_CAPACITANCE
2439 | EDIF_TOK_CURRENT
2440 | EDIF_TOK_RESISTANCE
2441 | EDIF_TOK_TEMPERATURE
2442 | EDIF_TOK_TIME
2443 | EDIF_TOK_VOLTAGE
2444 | EDIF_TOK_MASS
2445 | EDIF_TOK_FREQUENCY
2446 | EDIF_TOK_INDUCTANCE
2447 | EDIF_TOK_ENERGY
2448 | EDIF_TOK_POWER
2449 | EDIF_TOK_CHARGE
2450 | EDIF_TOK_CONDUCTANCE
2451 | EDIF_TOK_FLUX
2452 | EDIF_TOK_ANGLE
2455 Unused : EDIF_TOK_UNUSED PopC
2458 UserData : EDIF_TOK_USERDATA _UserData PopC
2461 _UserData : Ident { free($1); }
2462 | _UserData Int { free($2); }
2463 | _UserData Str { free($2); }
2464 | _UserData Ident { free($2); }
2465 | _UserData Form
2468 ValueNameDef : NameDef { str_pair_free($1); }
2469 | Array
2472 ValueNameRef : NameRef { free($1); }
2473 | Member
2476 Version : EDIF_TOK_VERSION Str PopC { free($2); }
2479 View : EDIF_TOK_VIEW ViewNameDef ViewType _View PopC
2482 _View : Interface
2483 | _View Status
2484 | _View Contents
2485 | _View Comment
2486 | _View Property
2487 | _View UserData
2490 ViewList : EDIF_TOK_VIEWLIST _ViewList PopC
2493 _ViewList :
2494 | _ViewList ViewRef
2495 | _ViewList ViewList
2498 ViewMap : EDIF_TOK_VIEWMAP _ViewMap PopC
2501 _ViewMap :
2502 | _ViewMap PortMap
2503 | _ViewMap PortBackAn
2504 | _ViewMap InstMap
2505 | _ViewMap InstBackAn
2506 | _ViewMap NetMap
2507 | _ViewMap NetBackAn
2508 | _ViewMap Comment
2509 | _ViewMap UserData
2512 ViewNameDef : NameDef { str_pair_free($1); }
2515 ViewNameRef : NameRef { free($1); }
2518 ViewRef : EDIF_TOK_VIEWREF ViewNameRef _ViewRef PopC
2521 _ViewRef :
2522 | CellRef
2525 ViewType : EDIF_TOK_VIEWTYPE _ViewType PopC
2528 _ViewType : EDIF_TOK_MASKLAYOUT
2529 | EDIF_TOK_PCBLAYOUT
2530 | EDIF_TOK_NETLIST
2531 | EDIF_TOK_SCHEMATIC
2532 | EDIF_TOK_SYMBOLIC
2533 | EDIF_TOK_BEHAVIOR
2534 | EDIF_TOK_LOGICMODEL
2535 | EDIF_TOK_DOCUMENT
2536 | EDIF_TOK_GRAPHIC
2537 | EDIF_TOK_STRANGER
2540 Visible : EDIF_TOK_VISIBLE BooleanValue PopC
2543 VoltageMap : EDIF_TOK_VOLTAGEMAP MiNoMaValue PopC
2546 WaveValue : EDIF_TOK_WAVEVALUE LogicNameDef ScaledInt LogicWave PopC
2549 Weak : EDIF_TOK_WEAK LogicNameRef PopC
2552 WeakJoined : EDIF_TOK_WEAKJOINED _WeakJoined PopC
2555 _WeakJoined :
2556 | _WeakJoined PortRef { str_pair_free($2); }
2557 | _WeakJoined PortList
2558 | _WeakJoined Joined { pair_list_free($2); }
2561 When : EDIF_TOK_WHEN _When PopC
2564 _When : Trigger
2565 | _When After
2566 | _When Follow
2567 | _When Maintain
2568 | _When LogicAssn
2569 | _When Comment
2570 | _When UserData
2573 Written : EDIF_TOK_WRITTEN _Written PopC
2576 _Written : TimeStamp
2577 | _Written Author
2578 | _Written Program
2579 | _Written DataOrigin
2580 | _Written Property
2581 | _Written Comment
2582 | _Written UserData
2585 Ident : EDIF_TOK_IDENT { $$=$1; }
2588 Str : EDIF_TOK_STR { $$=$1; }
2591 Int : EDIF_TOK_INT { $$=$1; }
2594 Keyword : EDIF_TOK_KEYWORD { $$=$1; }
2599 * xmalloc:
2601 * Garbage function for 'alloca()'.
2603 char *xmalloc(int siz)
2605 return ((char *)Malloc(siz));
2608 * Token & context carriers:
2610 * These are the linkage pointers for threading this context garbage
2611 * for converting identifiers into parser tokens.
2613 typedef struct TokenCar {
2614 struct TokenCar *Next; /* pointer to next carrier */
2615 struct Token *Token; /* associated token */
2616 } TokenCar;
2617 typedef struct UsedCar {
2618 struct UsedCar *Next; /* pointer to next carrier */
2619 short Code; /* used '%token' value */
2620 } UsedCar;
2621 typedef struct ContextCar {
2622 struct ContextCar *Next; /* pointer to next carrier */
2623 struct Context *Context; /* associated context */
2624 union {
2625 int Single; /* single usage flag (context tree) */
2626 struct UsedCar *Used; /* single used list (context stack) */
2627 } u;
2628 } ContextCar;
2630 * Token definitions:
2632 * This associates the '%token' codings with strings which are to
2633 * be free standing tokens. Doesn't have to be in sorted order but the
2634 * strings must be in lower case.
2636 typedef struct Token {
2637 char *Name; /* token name */
2638 int Code; /* '%token' value */
2639 struct Token *Next; /* hash table linkage */
2640 } Token;
2641 static Token TokenDef[] = {
2642 {"angle", EDIF_TOK_ANGLE},
2643 {"behavior", EDIF_TOK_BEHAVIOR},
2644 {"calculated", EDIF_TOK_CALCULATED},
2645 {"capacitance", EDIF_TOK_CAPACITANCE},
2646 {"centercenter", EDIF_TOK_CENTERCENTER},
2647 {"centerleft", EDIF_TOK_CENTERLEFT},
2648 {"centerright", EDIF_TOK_CENTERRIGHT},
2649 {"charge", EDIF_TOK_CHARGE},
2650 {"conductance", EDIF_TOK_CONDUCTANCE},
2651 {"current", EDIF_TOK_CURRENT},
2652 {"distance", EDIF_TOK_DISTANCE},
2653 {"document", EDIF_TOK_DOCUMENT},
2654 {"energy", EDIF_TOK_ENERGY},
2655 {"extend", EDIF_TOK_EXTEND},
2656 {"flux", EDIF_TOK_FLUX},
2657 {"frequency", EDIF_TOK_FREQUENCY},
2658 {"generic", EDIF_TOK_GENERIC},
2659 {"graphic", EDIF_TOK_GRAPHIC},
2660 {"inductance", EDIF_TOK_INDUCTANCE},
2661 {"inout", EDIF_TOK_INOUT},
2662 {"input", EDIF_TOK_INPUT},
2663 {"logicmodel", EDIF_TOK_LOGICMODEL},
2664 {"lowercenter", EDIF_TOK_LOWERCENTER},
2665 {"lowerleft", EDIF_TOK_LOWERLEFT},
2666 {"lowerright", EDIF_TOK_LOWERRIGHT},
2667 {"masklayout", EDIF_TOK_MASKLAYOUT},
2668 {"mass", EDIF_TOK_MASS},
2669 {"measured", EDIF_TOK_MEASURED},
2670 {"mx", EDIF_TOK_MX},
2671 {"mxr90", EDIF_TOK_MXR90},
2672 {"my", EDIF_TOK_MY},
2673 {"myr90", EDIF_TOK_MYR90},
2674 {"netlist", EDIF_TOK_NETLIST},
2675 {"output", EDIF_TOK_OUTPUT},
2676 {"pcblayout", EDIF_TOK_PCBLAYOUT},
2677 {"power", EDIF_TOK_POWER},
2678 {"r0", EDIF_TOK_R0},
2679 {"r180", EDIF_TOK_R180},
2680 {"r270", EDIF_TOK_R270},
2681 {"r90", EDIF_TOK_R90},
2682 {"required", EDIF_TOK_REQUIRED},
2683 {"resistance", EDIF_TOK_RESISTANCE},
2684 {"ripper", EDIF_TOK_RIPPER},
2685 {"round", EDIF_TOK_ROUND},
2686 {"schematic", EDIF_TOK_SCHEMATIC},
2687 {"stranger", EDIF_TOK_STRANGER},
2688 {"symbolic", EDIF_TOK_SYMBOLIC},
2689 {"temperature", EDIF_TOK_TEMPERATURE},
2690 {"tie", EDIF_TOK_TIE},
2691 {"time", EDIF_TOK_TIME},
2692 {"truncate", EDIF_TOK_TRUNCATE},
2693 {"uppercenter", EDIF_TOK_UPPERCENTER},
2694 {"upperleft", EDIF_TOK_UPPERLEFT},
2695 {"upperright", EDIF_TOK_UPPERRIGHT},
2696 {"voltage", EDIF_TOK_VOLTAGE}
2698 static int TokenDefSize = sizeof(TokenDef) / sizeof(Token);
2700 * Token enable definitions:
2702 * There is one array for each set of tokens enabled by a
2703 * particular context (barf). Another array is used to bind
2704 * these arrays to a context.
2706 static short e_CellType[] = {EDIF_TOK_TIE, EDIF_TOK_RIPPER, EDIF_TOK_GENERIC};
2707 static short e_CornerType[] = {EDIF_TOK_EXTEND, EDIF_TOK_TRUNCATE,
2708 EDIF_TOK_ROUND};
2709 static short e_Derivation[] = {EDIF_TOK_CALCULATED, EDIF_TOK_MEASURED,
2710 EDIF_TOK_REQUIRED};
2711 static short e_Direction[] = {EDIF_TOK_INPUT, EDIF_TOK_OUTPUT,
2712 EDIF_TOK_INOUT};
2713 static short e_EndType[] = {EDIF_TOK_EXTEND, EDIF_TOK_TRUNCATE,
2714 EDIF_TOK_ROUND};
2715 static short e_Justify[] = {EDIF_TOK_CENTERCENTER, EDIF_TOK_CENTERLEFT,
2716 EDIF_TOK_CENTERRIGHT, EDIF_TOK_LOWERCENTER,
2717 EDIF_TOK_LOWERLEFT, EDIF_TOK_LOWERRIGHT,
2718 EDIF_TOK_UPPERCENTER, EDIF_TOK_UPPERLEFT,
2719 EDIF_TOK_UPPERRIGHT};
2720 static short e_Orientation[] = {EDIF_TOK_R0, EDIF_TOK_R90, EDIF_TOK_R180,
2721 EDIF_TOK_R270, EDIF_TOK_MX, EDIF_TOK_MY,
2722 EDIF_TOK_MXR90, EDIF_TOK_MYR90};
2723 static short e_Unit[] = {EDIF_TOK_DISTANCE, EDIF_TOK_CAPACITANCE,
2724 EDIF_TOK_CURRENT, EDIF_TOK_RESISTANCE,
2725 EDIF_TOK_TEMPERATURE, EDIF_TOK_TIME,
2726 EDIF_TOK_VOLTAGE, EDIF_TOK_MASS, EDIF_TOK_FREQUENCY,
2727 EDIF_TOK_INDUCTANCE, EDIF_TOK_ENERGY,
2728 EDIF_TOK_POWER, EDIF_TOK_CHARGE,
2729 EDIF_TOK_CONDUCTANCE, EDIF_TOK_FLUX, EDIF_TOK_ANGLE};
2730 static short e_ViewType[] = {EDIF_TOK_MASKLAYOUT, EDIF_TOK_PCBLAYOUT,
2731 EDIF_TOK_NETLIST, EDIF_TOK_SCHEMATIC,
2732 EDIF_TOK_SYMBOLIC, EDIF_TOK_BEHAVIOR,
2733 EDIF_TOK_LOGICMODEL, EDIF_TOK_DOCUMENT,
2734 EDIF_TOK_GRAPHIC, EDIF_TOK_STRANGER};
2736 * Token tying table:
2738 * This binds enabled tokens to a context.
2740 typedef struct Tie {
2741 short *Enable; /* pointer to enable array */
2742 short Origin; /* '%token' value of context */
2743 short EnableSize; /* size of enabled array */
2744 } Tie;
2745 #define TE(e,o) {e,o,sizeof(e)/sizeof(short)}
2746 static Tie TieDef[] = {
2747 TE(e_CellType, EDIF_TOK_CELLTYPE),
2748 TE(e_CornerType, EDIF_TOK_CORNERTYPE),
2749 TE(e_Derivation, EDIF_TOK_DERIVATION),
2750 TE(e_Direction, EDIF_TOK_DIRECTION),
2751 TE(e_EndType, EDIF_TOK_ENDTYPE),
2752 TE(e_Justify, EDIF_TOK_JUSTIFY),
2753 TE(e_Orientation, EDIF_TOK_ORIENTATION),
2754 TE(e_Unit, EDIF_TOK_UNIT),
2755 TE(e_ViewType, EDIF_TOK_VIEWTYPE)
2757 static int TieDefSize = sizeof(TieDef) / sizeof(Tie);
2759 * Context definitions:
2761 * This associates keyword strings with '%token' values. It
2762 * also creates a pretty much empty header for later building of
2763 * the context tree. Again they needn't be sorted, but strings
2764 * must be lower case.
2766 typedef struct Context {
2767 char *Name; /* keyword name */
2768 short Code; /* '%token' value */
2769 short Flags; /* special operation flags */
2770 struct ContextCar *Context; /* contexts which can be moved to */
2771 struct TokenCar *Token; /* active tokens */
2772 struct Context *Next; /* hash table linkage */
2773 } Context;
2774 static Context ContextDef[] = {
2775 {"", 0}, /* start context */
2776 {"acload", EDIF_TOK_ACLOAD},
2777 {"after", EDIF_TOK_AFTER},
2778 {"annotate", EDIF_TOK_ANNOTATE},
2779 {"apply", EDIF_TOK_APPLY},
2780 {"arc", EDIF_TOK_ARC},
2781 {"array", EDIF_TOK_ARRAY},
2782 {"arraymacro", EDIF_TOK_ARRAYMACRO},
2783 {"arrayrelatedinfo", EDIF_TOK_ARRAYRELATEDINFO},
2784 {"arraysite", EDIF_TOK_ARRAYSITE},
2785 {"atleast", EDIF_TOK_ATLEAST},
2786 {"atmost", EDIF_TOK_ATMOST},
2787 {"author", EDIF_TOK_AUTHOR},
2788 {"basearray", EDIF_TOK_BASEARRAY},
2789 {"becomes", EDIF_TOK_BECOMES},
2790 {"between", EDIF_TOK_BETWEEN},
2791 {"boolean", EDIF_TOK_BOOLEAN},
2792 {"booleandisplay", EDIF_TOK_BOOLEANDISPLAY},
2793 {"booleanmap", EDIF_TOK_BOOLEANMAP},
2794 {"borderpattern", EDIF_TOK_BORDERPATTERN},
2795 {"borderwidth", EDIF_TOK_BORDERWIDTH},
2796 {"boundingbox", EDIF_TOK_BOUNDINGBOX},
2797 {"cell", EDIF_TOK_CELL},
2798 {"cellref", EDIF_TOK_CELLREF},
2799 {"celltype", EDIF_TOK_CELLTYPE},
2800 {"change", EDIF_TOK_CHANGE},
2801 {"circle", EDIF_TOK_CIRCLE},
2802 {"color", EDIF_TOK_COLOR},
2803 {"comment", EDIF_TOK_COMMENT},
2804 {"commentgraphics", EDIF_TOK_COMMENTGRAPHICS},
2805 {"compound", EDIF_TOK_COMPOUND},
2806 {"connectlocation", EDIF_TOK_CONNECTLOCATION},
2807 {"contents", EDIF_TOK_CONTENTS},
2808 {"cornertype", EDIF_TOK_CORNERTYPE},
2809 {"criticality", EDIF_TOK_CRITICALITY},
2810 {"currentmap", EDIF_TOK_CURRENTMAP},
2811 {"curve", EDIF_TOK_CURVE},
2812 {"cycle", EDIF_TOK_CYCLE},
2813 {"dataorigin", EDIF_TOK_DATAORIGIN},
2814 {"dcfaninload", EDIF_TOK_DCFANINLOAD},
2815 {"dcfanoutload", EDIF_TOK_DCFANOUTLOAD},
2816 {"dcmaxfanin", EDIF_TOK_DCMAXFANIN},
2817 {"dcmaxfanout", EDIF_TOK_DCMAXFANOUT},
2818 {"delay", EDIF_TOK_DELAY},
2819 {"delta", EDIF_TOK_DELTA},
2820 {"derivation", EDIF_TOK_DERIVATION},
2821 {"design", EDIF_TOK_DESIGN},
2822 {"designator", EDIF_TOK_DESIGNATOR},
2823 {"difference", EDIF_TOK_DIFFERENCE},
2824 {"direction", EDIF_TOK_DIRECTION},
2825 {"display", EDIF_TOK_DISPLAY},
2826 {"dominates", EDIF_TOK_DOMINATES},
2827 {"dot", EDIF_TOK_DOT},
2828 {"duration", EDIF_TOK_DURATION},
2829 {"e", EDIF_TOK_E},
2830 {"edif", EDIF_TOK_EDIF},
2831 {"ediflevel", EDIF_TOK_EDIFLEVEL},
2832 {"edifversion", EDIF_TOK_EDIFVERSION},
2833 {"enclosuredistance", EDIF_TOK_ENCLOSUREDISTANCE},
2834 {"endtype", EDIF_TOK_ENDTYPE},
2835 {"entry", EDIF_TOK_ENTRY},
2836 {"exactly", EDIF_TOK_EXACTLY},
2837 {"external", EDIF_TOK_EXTERNAL},
2838 {"fabricate", EDIF_TOK_FABRICATE},
2839 {"false", EDIF_TOK_FALSE},
2840 {"figure", EDIF_TOK_FIGURE},
2841 {"figurearea", EDIF_TOK_FIGUREAREA},
2842 {"figuregroup", EDIF_TOK_FIGUREGROUP},
2843 {"figuregroupobject", EDIF_TOK_FIGUREGROUPOBJECT},
2844 {"figuregroupoverride", EDIF_TOK_FIGUREGROUPOVERRIDE},
2845 {"figuregroupref", EDIF_TOK_FIGUREGROUPREF},
2846 {"figureperimeter", EDIF_TOK_FIGUREPERIMETER},
2847 {"figurewidth", EDIF_TOK_FIGUREWIDTH},
2848 {"fillpattern", EDIF_TOK_FILLPATTERN},
2849 {"follow", EDIF_TOK_FOLLOW},
2850 {"forbiddenevent", EDIF_TOK_FORBIDDENEVENT},
2851 {"globalportref", EDIF_TOK_GLOBALPORTREF},
2852 {"greaterthan", EDIF_TOK_GREATERTHAN},
2853 {"gridmap", EDIF_TOK_GRIDMAP},
2854 {"ignore", EDIF_TOK_IGNORE},
2855 {"includefiguregroup", EDIF_TOK_INCLUDEFIGUREGROUP},
2856 {"initial", EDIF_TOK_INITIAL},
2857 {"instance", EDIF_TOK_INSTANCE},
2858 {"instancebackannotate", EDIF_TOK_INSTANCEBACKANNOTATE},
2859 {"instancegroup", EDIF_TOK_INSTANCEGROUP},
2860 {"instancemap", EDIF_TOK_INSTANCEMAP},
2861 {"instanceref", EDIF_TOK_INSTANCEREF},
2862 {"integer", EDIF_TOK_INTEGER},
2863 {"integerdisplay", EDIF_TOK_INTEGERDISPLAY},
2864 {"interface", EDIF_TOK_INTERFACE},
2865 {"interfiguregroupspacing", EDIF_TOK_INTERFIGUREGROUPSPACING},
2866 {"intersection", EDIF_TOK_INTERSECTION},
2867 {"intrafiguregroupspacing", EDIF_TOK_INTRAFIGUREGROUPSPACING},
2868 {"inverse", EDIF_TOK_INVERSE},
2869 {"isolated", EDIF_TOK_ISOLATED},
2870 {"joined", EDIF_TOK_JOINED},
2871 {"justify", EDIF_TOK_JUSTIFY},
2872 {"keyworddisplay", EDIF_TOK_KEYWORDDISPLAY},
2873 {"keywordlevel", EDIF_TOK_KEYWORDLEVEL},
2874 {"keywordmap", EDIF_TOK_KEYWORDMAP},
2875 {"lessthan", EDIF_TOK_LESSTHAN},
2876 {"library", EDIF_TOK_LIBRARY},
2877 {"libraryref", EDIF_TOK_LIBRARYREF},
2878 {"listofnets", EDIF_TOK_LISTOFNETS},
2879 {"listofports", EDIF_TOK_LISTOFPORTS},
2880 {"loaddelay", EDIF_TOK_LOADDELAY},
2881 {"logicassign", EDIF_TOK_LOGICASSIGN},
2882 {"logicinput", EDIF_TOK_LOGICINPUT},
2883 {"logiclist", EDIF_TOK_LOGICLIST},
2884 {"logicmapinput", EDIF_TOK_LOGICMAPINPUT},
2885 {"logicmapoutput", EDIF_TOK_LOGICMAPOUTPUT},
2886 {"logiconeof", EDIF_TOK_LOGICONEOF},
2887 {"logicoutput", EDIF_TOK_LOGICOUTPUT},
2888 {"logicport", EDIF_TOK_LOGICPORT},
2889 {"logicref", EDIF_TOK_LOGICREF},
2890 {"logicvalue", EDIF_TOK_LOGICVALUE},
2891 {"logicwaveform", EDIF_TOK_LOGICWAVEFORM},
2892 {"maintain", EDIF_TOK_MAINTAIN},
2893 {"match", EDIF_TOK_MATCH},
2894 {"member", EDIF_TOK_MEMBER},
2895 {"minomax", EDIF_TOK_MINOMAX},
2896 {"minomaxdisplay", EDIF_TOK_MINOMAXDISPLAY},
2897 {"mnm", EDIF_TOK_MNM},
2898 {"multiplevalueset", EDIF_TOK_MULTIPLEVALUESET},
2899 {"mustjoin", EDIF_TOK_MUSTJOIN},
2900 {"name", EDIF_TOK_NAME},
2901 {"net", EDIF_TOK_NET},
2902 {"netbackannotate", EDIF_TOK_NETBACKANNOTATE},
2903 {"netbundle", EDIF_TOK_NETBUNDLE},
2904 {"netdelay", EDIF_TOK_NETDELAY},
2905 {"netgroup", EDIF_TOK_NETGROUP},
2906 {"netmap", EDIF_TOK_NETMAP},
2907 {"netref", EDIF_TOK_NETREF},
2908 {"nochange", EDIF_TOK_NOCHANGE},
2909 {"nonpermutable", EDIF_TOK_NONPERMUTABLE},
2910 {"notallowed", EDIF_TOK_NOTALLOWED},
2911 {"notchspacing", EDIF_TOK_NOTCHSPACING},
2912 {"number", EDIF_TOK_NUMBER},
2913 {"numberdefinition", EDIF_TOK_NUMBERDEFINITION},
2914 {"numberdisplay", EDIF_TOK_NUMBERDISPLAY},
2915 {"offpageconnector", EDIF_TOK_OFFPAGECONNECTOR},
2916 {"offsetevent", EDIF_TOK_OFFSETEVENT},
2917 {"openshape", EDIF_TOK_OPENSHAPE},
2918 {"orientation", EDIF_TOK_ORIENTATION},
2919 {"origin", EDIF_TOK_ORIGIN},
2920 {"overhangdistance", EDIF_TOK_OVERHANGDISTANCE},
2921 {"overlapdistance", EDIF_TOK_OVERLAPDISTANCE},
2922 {"oversize", EDIF_TOK_OVERSIZE},
2923 {"owner", EDIF_TOK_OWNER},
2924 {"page", EDIF_TOK_PAGE},
2925 {"pagesize", EDIF_TOK_PAGESIZE},
2926 {"parameter", EDIF_TOK_PARAMETER},
2927 {"parameterassign", EDIF_TOK_PARAMETERASSIGN},
2928 {"parameterdisplay", EDIF_TOK_PARAMETERDISPLAY},
2929 {"path", EDIF_TOK_PATH},
2930 {"pathdelay", EDIF_TOK_PATHDELAY},
2931 {"pathwidth", EDIF_TOK_PATHWIDTH},
2932 {"permutable", EDIF_TOK_PERMUTABLE},
2933 {"physicaldesignrule", EDIF_TOK_PHYSICALDESIGNRULE},
2934 {"plug", EDIF_TOK_PLUG},
2935 {"point", EDIF_TOK_POINT},
2936 {"pointdisplay", EDIF_TOK_POINTDISPLAY},
2937 {"pointlist", EDIF_TOK_POINTLIST},
2938 {"polygon", EDIF_TOK_POLYGON},
2939 {"port", EDIF_TOK_PORT},
2940 {"portbackannotate", EDIF_TOK_PORTBACKANNOTATE},
2941 {"portbundle", EDIF_TOK_PORTBUNDLE},
2942 {"portdelay", EDIF_TOK_PORTDELAY},
2943 {"portgroup", EDIF_TOK_PORTGROUP},
2944 {"portimplementation", EDIF_TOK_PORTIMPLEMENTATION},
2945 {"portinstance", EDIF_TOK_PORTINSTANCE},
2946 {"portlist", EDIF_TOK_PORTLIST},
2947 {"portlistalias", EDIF_TOK_PORTLISTALIAS},
2948 {"portmap", EDIF_TOK_PORTMAP},
2949 {"portref", EDIF_TOK_PORTREF},
2950 {"program", EDIF_TOK_PROGRAM},
2951 {"property", EDIF_TOK_PROPERTY},
2952 {"propertydisplay", EDIF_TOK_PROPERTYDISPLAY},
2953 {"protectionframe", EDIF_TOK_PROTECTIONFRAME},
2954 {"pt", EDIF_TOK_PT},
2955 {"rangevector", EDIF_TOK_RANGEVECTOR},
2956 {"rectangle", EDIF_TOK_RECTANGLE},
2957 {"rectanglesize", EDIF_TOK_RECTANGLESIZE},
2958 {"rename", EDIF_TOK_RENAME},
2959 {"resolves", EDIF_TOK_RESOLVES},
2960 {"scale", EDIF_TOK_SCALE},
2961 {"scalex", EDIF_TOK_SCALEX},
2962 {"scaley", EDIF_TOK_SCALEY},
2963 {"section", EDIF_TOK_SECTION},
2964 {"shape", EDIF_TOK_SHAPE},
2965 {"simulate", EDIF_TOK_SIMULATE},
2966 {"simulationinfo", EDIF_TOK_SIMULATIONINFO},
2967 {"singlevalueset", EDIF_TOK_SINGLEVALUESET},
2968 {"site", EDIF_TOK_SITE},
2969 {"socket", EDIF_TOK_SOCKET},
2970 {"socketset", EDIF_TOK_SOCKETSET},
2971 {"status", EDIF_TOK_STATUS},
2972 {"steady", EDIF_TOK_STEADY},
2973 {"string", EDIF_TOK_STRING},
2974 {"stringdisplay", EDIF_TOK_STRINGDISPLAY},
2975 {"strong", EDIF_TOK_STRONG},
2976 {"symbol", EDIF_TOK_SYMBOL},
2977 {"symmetry", EDIF_TOK_SYMMETRY},
2978 {"table", EDIF_TOK_TABLE},
2979 {"tabledefault", EDIF_TOK_TABLEDEFAULT},
2980 {"technology", EDIF_TOK_TECHNOLOGY},
2981 {"textheight", EDIF_TOK_TEXTHEIGHT},
2982 {"timeinterval", EDIF_TOK_TIMEINTERVAL},
2983 {"timestamp", EDIF_TOK_TIMESTAMP},
2984 {"timing", EDIF_TOK_TIMING},
2985 {"transform", EDIF_TOK_TRANSFORM},
2986 {"transition", EDIF_TOK_TRANSITION},
2987 {"trigger", EDIF_TOK_TRIGGER},
2988 {"true", EDIF_TOK_TRUE},
2989 {"unconstrained", EDIF_TOK_UNCONSTRAINED},
2990 {"undefined", EDIF_TOK_UNDEFINED},
2991 {"union", EDIF_TOK_UNION},
2992 {"unit", EDIF_TOK_UNIT},
2993 {"unused", EDIF_TOK_UNUSED},
2994 {"userdata", EDIF_TOK_USERDATA},
2995 {"version", EDIF_TOK_VERSION},
2996 {"view", EDIF_TOK_VIEW},
2997 {"viewlist", EDIF_TOK_VIEWLIST},
2998 {"viewmap", EDIF_TOK_VIEWMAP},
2999 {"viewref", EDIF_TOK_VIEWREF},
3000 {"viewtype", EDIF_TOK_VIEWTYPE},
3001 {"visible", EDIF_TOK_VISIBLE},
3002 {"voltagemap", EDIF_TOK_VOLTAGEMAP},
3003 {"wavevalue", EDIF_TOK_WAVEVALUE},
3004 {"weak", EDIF_TOK_WEAK},
3005 {"weakjoined", EDIF_TOK_WEAKJOINED},
3006 {"when", EDIF_TOK_WHEN},
3007 {"written", EDIF_TOK_WRITTEN}
3009 static int ContextDefSize = sizeof(ContextDef) / sizeof(Context);
3011 * Context follower tables:
3013 * This is pretty ugly, an array is defined for each context
3014 * which has following context levels. Yet another table is used
3015 * to bind these arrays to the originating contexts.
3016 * Arrays are declared as:
3018 * static short f_<Context name>[] = { ... };
3020 * The array entries are the '%token' values for all keywords which
3021 * can be reached from the <Context name> context. Like I said, ugly,
3022 * but it works.
3023 * A negative entry means that the follow can only occur once within
3024 * the specified context.
3026 static short f_NULL[] = {EDIF_TOK_EDIF};
3027 static short f_Edif[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_EDIFVERSION,
3028 EDIF_TOK_EDIFLEVEL, EDIF_TOK_KEYWORDMAP,
3029 -EDIF_TOK_STATUS, EDIF_TOK_EXTERNAL,
3030 EDIF_TOK_LIBRARY, EDIF_TOK_DESIGN, EDIF_TOK_COMMENT,
3031 EDIF_TOK_USERDATA};
3032 static short f_AcLoad[] = {EDIF_TOK_MNM, EDIF_TOK_E, EDIF_TOK_MINOMAXDISPLAY};
3033 static short f_After[] = {EDIF_TOK_MNM, EDIF_TOK_E, EDIF_TOK_FOLLOW,
3034 EDIF_TOK_MAINTAIN, EDIF_TOK_LOGICASSIGN,
3035 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3036 static short f_Annotate[] = {EDIF_TOK_STRINGDISPLAY};
3037 static short f_Apply[] = {EDIF_TOK_CYCLE, EDIF_TOK_LOGICINPUT,
3038 EDIF_TOK_LOGICOUTPUT, EDIF_TOK_COMMENT,
3039 EDIF_TOK_USERDATA};
3040 static short f_Arc[] = {EDIF_TOK_PT};
3041 static short f_Array[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME};
3042 static short f_ArrayMacro[] = {EDIF_TOK_PLUG};
3043 static short f_ArrayRelatedInfo[] = {EDIF_TOK_BASEARRAY, EDIF_TOK_ARRAYSITE,
3044 EDIF_TOK_ARRAYMACRO, EDIF_TOK_COMMENT,
3045 EDIF_TOK_USERDATA};
3046 static short f_ArraySite[] = {EDIF_TOK_SOCKET};
3047 static short f_AtLeast[] = {EDIF_TOK_E};
3048 static short f_AtMost[] = {EDIF_TOK_E};
3049 static short f_Becomes[] = {EDIF_TOK_NAME, EDIF_TOK_LOGICLIST,
3050 EDIF_TOK_LOGICONEOF};
3052 static short f_Between[] = {EDIF_TOK_ATLEAST, EDIF_TOK_GREATERTHAN,
3053 EDIF_TOK_ATMOST, EDIF_TOK_LESSTHAN};
3055 static short f_Boolean[] = {EDIF_TOK_FALSE, EDIF_TOK_TRUE,
3056 EDIF_TOK_BOOLEANDISPLAY, EDIF_TOK_BOOLEAN};
3057 static short f_BooleanDisplay[] = {EDIF_TOK_FALSE, EDIF_TOK_TRUE,
3058 EDIF_TOK_DISPLAY};
3059 static short f_BooleanMap[] = {EDIF_TOK_FALSE, EDIF_TOK_TRUE};
3060 static short f_BorderPattern[] = {EDIF_TOK_BOOLEAN};
3061 static short f_BoundingBox[] = {EDIF_TOK_RECTANGLE};
3062 static short f_Cell[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_CELLTYPE,
3063 -EDIF_TOK_STATUS, -EDIF_TOK_VIEWMAP, EDIF_TOK_VIEW,
3064 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA,
3065 EDIF_TOK_PROPERTY};
3066 static short f_CellRef[] = {EDIF_TOK_NAME, EDIF_TOK_LIBRARYREF};
3067 static short f_Change[] = {EDIF_TOK_NAME, EDIF_TOK_PORTREF, EDIF_TOK_PORTLIST,
3068 EDIF_TOK_BECOMES, EDIF_TOK_TRANSITION};
3069 static short f_Circle[] = {EDIF_TOK_PT, EDIF_TOK_PROPERTY};
3070 static short f_Color[] = {EDIF_TOK_E};
3071 static short f_CommentGraphics[] = {EDIF_TOK_ANNOTATE, EDIF_TOK_FIGURE,
3072 EDIF_TOK_INSTANCE, -EDIF_TOK_BOUNDINGBOX,
3073 EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT,
3074 EDIF_TOK_USERDATA};
3075 static short f_Compound[] = {EDIF_TOK_NAME};
3076 static short f_ConnectLocation[] = {EDIF_TOK_FIGURE};
3077 static short f_Contents[] = {EDIF_TOK_INSTANCE, EDIF_TOK_OFFPAGECONNECTOR,
3078 EDIF_TOK_FIGURE, EDIF_TOK_SECTION, EDIF_TOK_NET,
3079 EDIF_TOK_NETBUNDLE, EDIF_TOK_PAGE,
3080 EDIF_TOK_COMMENTGRAPHICS,
3081 EDIF_TOK_PORTIMPLEMENTATION,
3082 EDIF_TOK_TIMING, EDIF_TOK_SIMULATE,
3083 EDIF_TOK_WHEN, EDIF_TOK_FOLLOW,
3084 EDIF_TOK_LOGICPORT, -EDIF_TOK_BOUNDINGBOX,
3085 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3086 static short f_Criticality[] = {EDIF_TOK_INTEGERDISPLAY};
3087 static short f_CurrentMap[] = {EDIF_TOK_MNM, EDIF_TOK_E};
3088 static short f_Curve[] = {EDIF_TOK_ARC, EDIF_TOK_PT};
3089 static short f_Cycle[] = {EDIF_TOK_DURATION};
3090 static short f_DataOrigin[] = {EDIF_TOK_VERSION};
3091 static short f_DcFanInLoad[] = {EDIF_TOK_E, EDIF_TOK_NUMBERDISPLAY};
3092 static short f_DcFanOutLoad[] = {EDIF_TOK_E, EDIF_TOK_NUMBERDISPLAY};
3093 static short f_DcMaxFanIn[] = {EDIF_TOK_E, EDIF_TOK_NUMBERDISPLAY};
3094 static short f_DcMaxFanOut[] = {EDIF_TOK_E, EDIF_TOK_NUMBERDISPLAY};
3095 static short f_Delay[] = {EDIF_TOK_MNM, EDIF_TOK_E};
3096 static short f_Delta[] = {EDIF_TOK_PT};
3097 static short f_Design[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_CELLREF,
3098 EDIF_TOK_STATUS, EDIF_TOK_COMMENT,
3099 EDIF_TOK_PROPERTY, EDIF_TOK_USERDATA};
3100 static short f_Designator[] = {EDIF_TOK_STRINGDISPLAY};
3101 static short f_Difference[] = {EDIF_TOK_FIGUREGROUPREF, EDIF_TOK_INTERSECTION,
3102 EDIF_TOK_UNION, EDIF_TOK_DIFFERENCE,
3103 EDIF_TOK_INVERSE, EDIF_TOK_OVERSIZE};
3104 static short f_Display[] = {EDIF_TOK_NAME, EDIF_TOK_FIGUREGROUPOVERRIDE,
3105 EDIF_TOK_JUSTIFY, EDIF_TOK_ORIENTATION,
3106 EDIF_TOK_ORIGIN};
3107 static short f_Dominates[] = {EDIF_TOK_NAME};
3108 static short f_Dot[] = {EDIF_TOK_PT, EDIF_TOK_PROPERTY};
3109 static short f_Duration[] = {EDIF_TOK_E};
3110 static short f_EnclosureDistance[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3111 EDIF_TOK_FIGUREGROUPOBJECT,
3112 EDIF_TOK_LESSTHAN, EDIF_TOK_GREATERTHAN,
3113 EDIF_TOK_ATMOST, EDIF_TOK_ATLEAST,
3114 EDIF_TOK_EXACTLY, EDIF_TOK_BETWEEN,
3115 EDIF_TOK_SINGLEVALUESET,
3116 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3117 static short f_Entry[] = {EDIF_TOK_MATCH, EDIF_TOK_CHANGE, EDIF_TOK_STEADY,
3118 EDIF_TOK_LOGICREF, EDIF_TOK_PORTREF,
3119 EDIF_TOK_NOCHANGE, EDIF_TOK_TABLE,
3120 EDIF_TOK_DELAY, EDIF_TOK_LOADDELAY};
3121 static short f_Exactly[] = {EDIF_TOK_E};
3122 static short f_External[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3123 EDIF_TOK_EDIFLEVEL, EDIF_TOK_TECHNOLOGY,
3124 -EDIF_TOK_STATUS, EDIF_TOK_CELL, EDIF_TOK_COMMENT,
3125 EDIF_TOK_USERDATA};
3126 static short f_Fabricate[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME};
3127 static short f_Figure[] = {EDIF_TOK_NAME, EDIF_TOK_FIGUREGROUPOVERRIDE,
3128 EDIF_TOK_CIRCLE, EDIF_TOK_DOT, EDIF_TOK_OPENSHAPE,
3129 EDIF_TOK_PATH, EDIF_TOK_POLYGON,
3130 EDIF_TOK_RECTANGLE, EDIF_TOK_SHAPE,
3131 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3132 static short f_FigureArea[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3133 EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_LESSTHAN,
3134 EDIF_TOK_GREATERTHAN, EDIF_TOK_ATMOST,
3135 EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY,
3136 EDIF_TOK_BETWEEN, EDIF_TOK_SINGLEVALUESET,
3137 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3138 static short f_FigureGroup[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3139 -EDIF_TOK_CORNERTYPE, -EDIF_TOK_ENDTYPE,
3140 -EDIF_TOK_PATHWIDTH, -EDIF_TOK_BORDERWIDTH,
3141 -EDIF_TOK_COLOR, -EDIF_TOK_FILLPATTERN,
3142 -EDIF_TOK_BORDERPATTERN, -EDIF_TOK_TEXTHEIGHT,
3143 -EDIF_TOK_VISIBLE, EDIF_TOK_INCLUDEFIGUREGROUP,
3144 EDIF_TOK_COMMENT, EDIF_TOK_PROPERTY,
3145 EDIF_TOK_USERDATA};
3146 static short f_FigureGroupObject[] = {EDIF_TOK_NAME,
3147 EDIF_TOK_FIGUREGROUPOBJECT,
3148 EDIF_TOK_INTERSECTION, EDIF_TOK_UNION,
3149 EDIF_TOK_DIFFERENCE, EDIF_TOK_INVERSE,
3150 EDIF_TOK_OVERSIZE};
3151 static short f_FigureGroupOverride[] = {EDIF_TOK_NAME, -EDIF_TOK_CORNERTYPE,
3152 -EDIF_TOK_ENDTYPE, -EDIF_TOK_PATHWIDTH,
3153 -EDIF_TOK_BORDERWIDTH, -EDIF_TOK_COLOR,
3154 -EDIF_TOK_FILLPATTERN,
3155 -EDIF_TOK_TEXTHEIGHT,
3156 -EDIF_TOK_BORDERPATTERN,
3157 EDIF_TOK_VISIBLE, EDIF_TOK_COMMENT,
3158 EDIF_TOK_PROPERTY, EDIF_TOK_USERDATA};
3159 static short f_FigureGroupRef[] = {EDIF_TOK_NAME, EDIF_TOK_LIBRARYREF};
3160 static short f_FigurePerimeter[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3161 EDIF_TOK_FIGUREGROUPOBJECT,
3162 EDIF_TOK_LESSTHAN, EDIF_TOK_GREATERTHAN,
3163 EDIF_TOK_ATMOST, EDIF_TOK_ATLEAST,
3164 EDIF_TOK_EXACTLY, EDIF_TOK_BETWEEN,
3165 EDIF_TOK_SINGLEVALUESET, EDIF_TOK_COMMENT,
3166 EDIF_TOK_USERDATA};
3167 static short f_FigureWidth[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3168 EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_LESSTHAN,
3169 EDIF_TOK_GREATERTHAN, EDIF_TOK_ATMOST,
3170 EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY,
3171 EDIF_TOK_BETWEEN, EDIF_TOK_SINGLEVALUESET,
3172 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3173 static short f_FillPattern[] = {EDIF_TOK_BOOLEAN};
3174 static short f_Follow[] = {EDIF_TOK_NAME, EDIF_TOK_PORTREF, EDIF_TOK_TABLE,
3175 EDIF_TOK_DELAY, EDIF_TOK_LOADDELAY};
3176 static short f_ForbiddenEvent[] = {EDIF_TOK_TIMEINTERVAL, EDIF_TOK_EVENT};
3177 static short f_GlobalPortRef[] = {EDIF_TOK_NAME};
3178 static short f_GreaterThan[] = {EDIF_TOK_E};
3179 static short f_GridMap[] = {EDIF_TOK_E};
3180 static short f_IncludeFigureGroup[] = {EDIF_TOK_FIGUREGROUPREF,
3181 EDIF_TOK_INTERSECTION, EDIF_TOK_UNION,
3182 EDIF_TOK_DIFFERENCE, EDIF_TOK_INVERSE,
3183 EDIF_TOK_OVERSIZE};
3184 static short f_Instance[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY,
3185 EDIF_TOK_VIEWREF, EDIF_TOK_VIEWLIST,
3186 -EDIF_TOK_TRANSFORM, EDIF_TOK_PARAMETERASSIGN,
3187 EDIF_TOK_PORTINSTANCE, EDIF_TOK_TIMING,
3188 -EDIF_TOK_DESIGNATOR, EDIF_TOK_PROPERTY,
3189 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3190 static short f_InstanceBackAnnotate[] = {EDIF_TOK_INSTANCEREF,
3191 -EDIF_TOK_DESIGNATOR, EDIF_TOK_TIMING,
3192 EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT};
3193 static short f_InstanceGroup[] = {EDIF_TOK_INSTANCEREF};
3194 static short f_InstanceMap[] = {EDIF_TOK_INSTANCEREF, EDIF_TOK_INSTANCEGROUP,
3195 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3196 static short f_InstanceRef[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER,
3197 EDIF_TOK_INSTANCEREF, EDIF_TOK_VIEWREF};
3198 static short f_Integer[] = {EDIF_TOK_INTEGERDISPLAY, EDIF_TOK_INTEGER};
3199 static short f_IntegerDisplay[] = {EDIF_TOK_DISPLAY};
3200 static short f_Interface[] = {EDIF_TOK_PORT, EDIF_TOK_PORTBUNDLE,
3201 -EDIF_TOK_SYMBOL, -EDIF_TOK_PROTECTIONFRAME,
3202 -EDIF_TOK_ARRAYRELATEDINFO, EDIF_TOK_PARAMETER,
3203 EDIF_TOK_JOINED, EDIF_TOK_MUSTJOIN,
3204 EDIF_TOK_WEAKJOINED, EDIF_TOK_PERMUTABLE,
3205 EDIF_TOK_TIMING, EDIF_TOK_SIMULATE,
3206 -EDIF_TOK_DESIGNATOR, EDIF_TOK_PROPERTY,
3207 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3208 static short f_InterFigureGroupSpacing[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3209 EDIF_TOK_FIGUREGROUPOBJECT,
3210 EDIF_TOK_LESSTHAN,
3211 EDIF_TOK_GREATERTHAN,
3212 EDIF_TOK_ATMOST,
3213 EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY,
3214 EDIF_TOK_BETWEEN,
3215 EDIF_TOK_SINGLEVALUESET,
3216 EDIF_TOK_COMMENT,
3217 EDIF_TOK_USERDATA};
3218 static short f_Intersection[] = {EDIF_TOK_FIGUREGROUPREF,
3219 EDIF_TOK_INTERSECTION, EDIF_TOK_UNION,
3220 EDIF_TOK_DIFFERENCE, EDIF_TOK_INVERSE,
3221 EDIF_TOK_OVERSIZE};
3222 static short f_IntraFigureGroupSpacing[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3223 EDIF_TOK_FIGUREGROUPOBJECT,
3224 EDIF_TOK_LESSTHAN,
3225 EDIF_TOK_GREATERTHAN,
3226 EDIF_TOK_ATMOST, EDIF_TOK_ATLEAST,
3227 EDIF_TOK_EXACTLY, EDIF_TOK_BETWEEN,
3228 EDIF_TOK_SINGLEVALUESET,
3229 EDIF_TOK_COMMENT,
3230 EDIF_TOK_USERDATA};
3231 static short f_Inverse[] = {EDIF_TOK_FIGUREGROUPREF, EDIF_TOK_INTERSECTION,
3232 EDIF_TOK_UNION, EDIF_TOK_DIFFERENCE,
3233 EDIF_TOK_INVERSE, EDIF_TOK_OVERSIZE};
3234 static short f_Joined[] = {EDIF_TOK_PORTREF, EDIF_TOK_PORTLIST,
3235 EDIF_TOK_GLOBALPORTREF};
3236 static short f_KeywordDisplay[] = {EDIF_TOK_DISPLAY};
3237 static short f_KeywordMap[] = {EDIF_TOK_KEYWORDLEVEL, EDIF_TOK_COMMENT};
3238 static short f_LessThan[] = {EDIF_TOK_E};
3239 static short f_Library[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_EDIFLEVEL,
3240 EDIF_TOK_TECHNOLOGY, -EDIF_TOK_STATUS,
3241 EDIF_TOK_CELL, EDIF_TOK_COMMENT,
3242 EDIF_TOK_USERDATA};
3243 static short f_LibraryRef[] = {EDIF_TOK_NAME};
3244 static short f_ListOfNets[] = {EDIF_TOK_NET};
3245 static short f_ListOfPorts[] = {EDIF_TOK_PORT, EDIF_TOK_PORTBUNDLE};
3246 static short f_LoadDelay[] = {EDIF_TOK_MNM, EDIF_TOK_E, EDIF_TOK_MINOMAXDISPLAY};
3247 static short f_LogicAssign[] = {EDIF_TOK_NAME, EDIF_TOK_PORTREF,
3248 EDIF_TOK_LOGICREF, EDIF_TOK_TABLE,
3249 EDIF_TOK_DELAY, EDIF_TOK_LOADDELAY};
3250 static short f_LogicInput[] = {EDIF_TOK_PORTLIST, EDIF_TOK_PORTREF,
3251 EDIF_TOK_NAME, EDIF_TOK_LOGICWAVEFORM};
3252 static short f_LogicList[] = {EDIF_TOK_NAME, EDIF_TOK_LOGICONEOF,
3253 EDIF_TOK_IGNORE};
3254 static short f_LogicMapInput[] = {EDIF_TOK_LOGICREF};
3255 static short f_LogicMapOutput[] = {EDIF_TOK_LOGICREF};
3256 static short f_LogicOneOf[] = {EDIF_TOK_NAME, EDIF_TOK_LOGICLIST};
3257 static short f_LogicOutput[] = {EDIF_TOK_PORTLIST, EDIF_TOK_PORTREF,
3258 EDIF_TOK_NAME, EDIF_TOK_LOGICWAVEFORM};
3259 static short f_LogicPort[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3260 EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT,
3261 EDIF_TOK_USERDATA};
3262 static short f_LogicRef[] = {EDIF_TOK_NAME, EDIF_TOK_LIBRARYREF};
3263 static short f_LogicValue[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3264 -EDIF_TOK_VOLTAGEMAP, -EDIF_TOK_CURRENTMAP,
3265 -EDIF_TOK_BOOLEANMAP, -EDIF_TOK_COMPOUND,
3266 -EDIF_TOK_WEAK ,-EDIF_TOK_STRONG,
3267 -EDIF_TOK_DOMINATES, -EDIF_TOK_LOGICMAPOUTPUT,
3268 -EDIF_TOK_LOGICMAPINPUT,
3269 -EDIF_TOK_ISOLATED, EDIF_TOK_RESOLVES,
3270 EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT,
3271 EDIF_TOK_USERDATA};
3272 static short f_LogicWaveform[] = {EDIF_TOK_NAME, EDIF_TOK_LOGICLIST,
3273 EDIF_TOK_LOGICONEOF, EDIF_TOK_IGNORE};
3274 static short f_Maintain[] = {EDIF_TOK_NAME, EDIF_TOK_PORTREF, EDIF_TOK_DELAY,
3275 EDIF_TOK_LOADDELAY};
3276 static short f_Match[] = {EDIF_TOK_NAME, EDIF_TOK_PORTREF, EDIF_TOK_PORTLIST,
3277 EDIF_TOK_LOGICLIST, EDIF_TOK_LOGICONEOF};
3278 static short f_Member[] = {EDIF_TOK_NAME};
3279 static short f_MiNoMax[] = {EDIF_TOK_MNM, EDIF_TOK_E, EDIF_TOK_MINOMAXDISPLAY,
3280 EDIF_TOK_MINOMAX};
3281 static short f_MiNoMaxDisplay[] = {EDIF_TOK_MNM, EDIF_TOK_E, EDIF_TOK_DISPLAY};
3282 static short f_Mnm[] = {EDIF_TOK_E, EDIF_TOK_UNDEFINED,
3283 EDIF_TOK_UNCONSTRAINED};
3284 static short f_MultipleValueSet[] = {EDIF_TOK_RANGEVECTOR};
3285 static short f_MustJoin[] = {EDIF_TOK_PORTREF, EDIF_TOK_PORTLIST,
3286 EDIF_TOK_WEAKJOINED, EDIF_TOK_JOINED};
3287 static short f_Name[] = {EDIF_TOK_DISPLAY};
3288 static short f_Net[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, -EDIF_TOK_CRITICALITY,
3289 EDIF_TOK_NETDELAY, EDIF_TOK_FIGURE, EDIF_TOK_NET,
3290 EDIF_TOK_INSTANCE, EDIF_TOK_COMMENTGRAPHICS,
3291 EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT,
3292 EDIF_TOK_USERDATA, EDIF_TOK_JOINED, EDIF_TOK_ARRAY};
3293 static short f_NetBackAnnotate[] = {EDIF_TOK_NETREF, EDIF_TOK_NETDELAY,
3294 -EDIF_TOK_CRITICALITY, EDIF_TOK_PROPERTY,
3295 EDIF_TOK_COMMENT};
3296 static short f_NetBundle[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY,
3297 EDIF_TOK_LISTOFNETS, EDIF_TOK_FIGURE,
3298 EDIF_TOK_COMMENTGRAPHICS, EDIF_TOK_PROPERTY,
3299 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3300 static short f_NetDelay[] = {EDIF_TOK_DERIVATION, EDIF_TOK_DELAY,
3301 EDIF_TOK_TRANSITION, EDIF_TOK_BECOMES};
3302 static short f_NetGroup[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, EDIF_TOK_NETREF};
3303 static short f_NetMap[] = {EDIF_TOK_NETREF, EDIF_TOK_NETGROUP,
3304 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3305 static short f_NetRef[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, EDIF_TOK_NETREF,
3306 EDIF_TOK_INSTANCEREF, EDIF_TOK_VIEWREF};
3307 static short f_NonPermutable[] = {EDIF_TOK_PORTREF, EDIF_TOK_PERMUTABLE};
3308 static short f_NotAllowed[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3309 EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_COMMENT,
3310 EDIF_TOK_USERDATA};
3311 static short f_NotchSpacing[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3312 EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_LESSTHAN,
3313 EDIF_TOK_GREATERTHAN, EDIF_TOK_ATMOST,
3314 EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY,
3315 EDIF_TOK_BETWEEN, EDIF_TOK_SINGLEVALUESET,
3316 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3317 static short f_Number[] = {EDIF_TOK_E, EDIF_TOK_NUMBERDISPLAY, EDIF_TOK_NUMBER};
3318 static short f_NumberDefinition[] = {EDIF_TOK_SCALE, -EDIF_TOK_GRIDMAP,
3319 EDIF_TOK_COMMENT};
3320 static short f_NumberDisplay[] = {EDIF_TOK_E, EDIF_TOK_DISPLAY};
3321 static short f_OffPageConnector[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3322 -EDIF_TOK_UNUSED, EDIF_TOK_PROPERTY,
3323 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3324 static short f_OffsetEvent[] = {EDIF_TOK_EVENT, EDIF_TOK_E};
3325 static short f_OpenShape[] = {EDIF_TOK_CURVE, EDIF_TOK_PROPERTY};
3326 static short f_Origin[] = {EDIF_TOK_PT};
3327 static short f_OverhangDistance[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3328 EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_LESSTHAN,
3329 EDIF_TOK_GREATERTHAN, EDIF_TOK_ATMOST,
3330 EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY,
3331 EDIF_TOK_BETWEEN, EDIF_TOK_SINGLEVALUESET,
3332 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3333 static short f_OverlapDistance[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3334 EDIF_TOK_FIGUREGROUPOBJECT, EDIF_TOK_LESSTHAN,
3335 EDIF_TOK_GREATERTHAN, EDIF_TOK_ATMOST,
3336 EDIF_TOK_ATLEAST, EDIF_TOK_EXACTLY,
3337 EDIF_TOK_BETWEEN, EDIF_TOK_SINGLEVALUESET,
3338 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3339 static short f_Oversize[] = {EDIF_TOK_FIGUREGROUPREF, EDIF_TOK_INTERSECTION,
3340 EDIF_TOK_UNION, EDIF_TOK_DIFFERENCE,
3341 EDIF_TOK_INVERSE, EDIF_TOK_OVERSIZE,
3342 EDIF_TOK_CORNERTYPE};
3343 static short f_Page[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY,
3344 EDIF_TOK_INSTANCE, EDIF_TOK_NET, EDIF_TOK_NETBUNDLE,
3345 EDIF_TOK_COMMENTGRAPHICS, EDIF_TOK_PORTIMPLEMENTATION,
3346 -EDIF_TOK_PAGESIZE, -EDIF_TOK_BOUNDINGBOX,
3347 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3348 static short f_PageSize[] = {EDIF_TOK_RECTANGLE};
3349 static short f_Parameter[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY,
3350 EDIF_TOK_BOOLEAN, EDIF_TOK_INTEGER,
3351 EDIF_TOK_MINOMAX, EDIF_TOK_NUMBER,
3352 EDIF_TOK_POINT, EDIF_TOK_STRING};
3353 static short f_ParameterAssign[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER,
3354 EDIF_TOK_BOOLEAN, EDIF_TOK_INTEGER,
3355 EDIF_TOK_MINOMAX, EDIF_TOK_NUMBER, EDIF_TOK_POINT,
3356 EDIF_TOK_STRING};
3357 static short f_ParameterDisplay[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER,
3358 EDIF_TOK_DISPLAY};
3359 static short f_Path[] = {EDIF_TOK_POINTLIST, EDIF_TOK_PROPERTY};
3360 static short f_PathDelay[] = {EDIF_TOK_DELAY, EDIF_TOK_EVENT};
3361 static short f_Permutable[] = {EDIF_TOK_PORTREF, EDIF_TOK_PERMUTABLE,
3362 EDIF_TOK_NONPERMUTABLE};
3363 static short f_PhysicalDesignRule[] = {EDIF_TOK_FIGUREWIDTH,
3364 EDIF_TOK_FIGUREAREA,
3365 EDIF_TOK_RECTANGLESIZE,
3366 EDIF_TOK_FIGUREPERIMETER,
3367 EDIF_TOK_OVERLAPDISTANCE,
3368 EDIF_TOK_OVERHANGDISTANCE,
3369 EDIF_TOK_ENCLOSUREDISTANCE,
3370 EDIF_TOK_INTERFIGUREGROUPSPACING,
3371 EDIF_TOK_NOTCHSPACING,
3372 EDIF_TOK_INTRAFIGUREGROUPSPACING,
3373 EDIF_TOK_NOTALLOWED,
3374 EDIF_TOK_FIGUREGROUP, EDIF_TOK_COMMENT,
3375 EDIF_TOK_USERDATA};
3376 static short f_Plug[] = {EDIF_TOK_SOCKETSET};
3377 static short f_Point[] = {EDIF_TOK_PT, EDIF_TOK_POINTDISPLAY,
3378 EDIF_TOK_POINT};
3379 static short f_PointDisplay[] = {EDIF_TOK_PT, EDIF_TOK_DISPLAY};
3380 static short f_PointList[] = {EDIF_TOK_PT};
3381 static short f_Polygon[] = {EDIF_TOK_POINTLIST, EDIF_TOK_PROPERTY};
3382 static short f_Port[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY,
3383 -EDIF_TOK_DIRECTION, -EDIF_TOK_UNUSED,
3384 EDIF_TOK_PORTDELAY, -EDIF_TOK_DESIGNATOR,
3385 -EDIF_TOK_DCFANINLOAD, -EDIF_TOK_DCFANOUTLOAD,
3386 -EDIF_TOK_DCMAXFANIN, -EDIF_TOK_DCMAXFANOUT,
3387 -EDIF_TOK_ACLOAD, EDIF_TOK_PROPERTY,
3388 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3389 static short f_PortBackAnnotate[] = {EDIF_TOK_PORTREF, -EDIF_TOK_DESIGNATOR,
3390 EDIF_TOK_PORTDELAY, -EDIF_TOK_DCFANINLOAD,
3391 -EDIF_TOK_DCFANOUTLOAD,
3392 -EDIF_TOK_DCMAXFANIN,
3393 -EDIF_TOK_DCMAXFANOUT, -EDIF_TOK_ACLOAD,
3394 EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT};
3395 static short f_PortBundle[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_ARRAY,
3396 EDIF_TOK_LISTOFPORTS, EDIF_TOK_PROPERTY,
3397 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3398 static short f_PortDelay[] = {EDIF_TOK_DERIVATION, EDIF_TOK_DELAY,
3399 EDIF_TOK_LOADDELAY, EDIF_TOK_TRANSITION,
3400 EDIF_TOK_BECOMES};
3401 static short f_PortGroup[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER,
3402 EDIF_TOK_PORTREF};
3403 static short f_PortImplementation[] = {EDIF_TOK_PORTREF, EDIF_TOK_NAME, EDIF_TOK_MEMBER,
3404 -EDIF_TOK_CONNECTLOCATION,
3405 EDIF_TOK_FIGURE, EDIF_TOK_INSTANCE,
3406 EDIF_TOK_COMMENTGRAPHICS,
3407 EDIF_TOK_PROPERTYDISPLAY,
3408 EDIF_TOK_KEYWORDDISPLAY,
3409 EDIF_TOK_PROPERTY,
3410 EDIF_TOK_USERDATA, EDIF_TOK_COMMENT};
3411 static short f_PortInstance[] = {EDIF_TOK_PORTREF, EDIF_TOK_NAME,
3412 EDIF_TOK_MEMBER, -EDIF_TOK_UNUSED,
3413 EDIF_TOK_PORTDELAY, -EDIF_TOK_DESIGNATOR,
3414 -EDIF_TOK_DCFANINLOAD,
3415 -EDIF_TOK_DCFANOUTLOAD, -EDIF_TOK_DCMAXFANIN,
3416 -EDIF_TOK_DCMAXFANOUT, -EDIF_TOK_ACLOAD,
3417 EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT,
3418 EDIF_TOK_USERDATA};
3419 static short f_PortList[] = {EDIF_TOK_PORTREF, EDIF_TOK_NAME,
3420 EDIF_TOK_MEMBER};
3421 static short f_PortListAlias[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3422 EDIF_TOK_ARRAY, EDIF_TOK_PORTLIST};
3423 static short f_PortMap[] = {EDIF_TOK_PORTREF, EDIF_TOK_PORTGROUP,
3424 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3425 static short f_PortRef[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER,
3426 EDIF_TOK_PORTREF, EDIF_TOK_INSTANCEREF,
3427 EDIF_TOK_VIEWREF};
3428 static short f_Program[] = {EDIF_TOK_VERSION};
3429 static short f_Property[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_BOOLEAN,
3430 EDIF_TOK_INTEGER, EDIF_TOK_MINOMAX,
3431 EDIF_TOK_NUMBER, EDIF_TOK_POINT, EDIF_TOK_STRING,
3432 -EDIF_TOK_OWNER, -EDIF_TOK_UNIT,
3433 EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT};
3434 static short f_PropertyDisplay[] = {EDIF_TOK_NAME, EDIF_TOK_DISPLAY};
3435 static short f_ProtectionFrame[] = {EDIF_TOK_PORTIMPLEMENTATION,
3436 EDIF_TOK_FIGURE, EDIF_TOK_INSTANCE,
3437 EDIF_TOK_COMMENTGRAPHICS,
3438 -EDIF_TOK_BOUNDINGBOX,
3439 EDIF_TOK_PROPERTYDISPLAY,
3440 EDIF_TOK_KEYWORDDISPLAY,
3441 EDIF_TOK_PARAMETERDISPLAY,
3442 EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT,
3443 EDIF_TOK_USERDATA};
3444 static short f_RangeVector[] = {EDIF_TOK_LESSTHAN, EDIF_TOK_GREATERTHAN,
3445 EDIF_TOK_ATMOST, EDIF_TOK_ATLEAST,
3446 EDIF_TOK_EXACTLY, EDIF_TOK_BETWEEN,
3447 EDIF_TOK_SINGLEVALUESET};
3448 static short f_Rectangle[] = {EDIF_TOK_PT, EDIF_TOK_PROPERTY};
3449 static short f_RectangleSize[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME,
3450 EDIF_TOK_FIGUREGROUPOBJECT,
3451 EDIF_TOK_RANGEVECTOR,
3452 EDIF_TOK_MULTIPLEVALUESET,EDIF_TOK_COMMENT,
3453 EDIF_TOK_USERDATA};
3454 static short f_Rename[] = {EDIF_TOK_NAME, EDIF_TOK_STRINGDISPLAY};
3455 static short f_Resolves[] = {EDIF_TOK_NAME};
3456 static short f_Scale[] = {EDIF_TOK_E, EDIF_TOK_UNIT};
3457 static short f_Section[] = {EDIF_TOK_SECTION, EDIF_TOK_INSTANCE};
3458 static short f_Shape[] = {EDIF_TOK_CURVE, EDIF_TOK_PROPERTY};
3459 static short f_Simulate[] = {EDIF_TOK_NAME, EDIF_TOK_PORTLISTALIAS,
3460 EDIF_TOK_WAVEVALUE, EDIF_TOK_APPLY,
3461 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA};
3462 static short f_SimulationInfo[] = {EDIF_TOK_LOGICVALUE, EDIF_TOK_COMMENT,
3463 EDIF_TOK_USERDATA};
3464 static short f_SingleValueSet[] = {EDIF_TOK_LESSTHAN, EDIF_TOK_GREATERTHAN,
3465 EDIF_TOK_ATMOST, EDIF_TOK_ATLEAST,
3466 EDIF_TOK_EXACTLY, EDIF_TOK_BETWEEN};
3467 static short f_Site[] = {EDIF_TOK_VIEWREF, EDIF_TOK_TRANSFORM};
3468 static short f_Socket[] = {EDIF_TOK_SYMMETRY};
3469 static short f_SocketSet[] = {EDIF_TOK_SYMMETRY, EDIF_TOK_SITE};
3470 static short f_Status[] = {EDIF_TOK_WRITTEN, EDIF_TOK_COMMENT,
3471 EDIF_TOK_USERDATA};
3472 static short f_Steady[] = {EDIF_TOK_NAME, EDIF_TOK_MEMBER, EDIF_TOK_PORTREF,
3473 EDIF_TOK_PORTLIST, EDIF_TOK_DURATION,
3474 EDIF_TOK_TRANSITION, EDIF_TOK_BECOMES};
3475 static short f_String[] = {EDIF_TOK_STRINGDISPLAY, EDIF_TOK_STRING};
3476 static short f_StringDisplay[] = {EDIF_TOK_DISPLAY};
3477 static short f_Strong[] = {EDIF_TOK_NAME};
3478 static short f_Symbol[] = {EDIF_TOK_PORTIMPLEMENTATION, EDIF_TOK_FIGURE,
3479 EDIF_TOK_INSTANCE, EDIF_TOK_COMMENTGRAPHICS,
3480 EDIF_TOK_ANNOTATE, -EDIF_TOK_PAGESIZE,
3481 -EDIF_TOK_BOUNDINGBOX, EDIF_TOK_PROPERTYDISPLAY,
3482 EDIF_TOK_KEYWORDDISPLAY, EDIF_TOK_PARAMETERDISPLAY,
3483 EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT,
3484 EDIF_TOK_USERDATA};
3485 static short f_Symmetry[] = {EDIF_TOK_TRANSFORM};
3486 static short f_Table[] = {EDIF_TOK_ENTRY, EDIF_TOK_TABLEDEFAULT};
3487 static short f_TableDefault[] = {EDIF_TOK_LOGICREF, EDIF_TOK_PORTREF,
3488 EDIF_TOK_NOCHANGE, EDIF_TOK_TABLE,
3489 EDIF_TOK_DELAY, EDIF_TOK_LOADDELAY};
3490 static short f_Technology[] = {EDIF_TOK_NUMBERDEFINITION, EDIF_TOK_FIGUREGROUP,
3491 EDIF_TOK_FABRICATE, -EDIF_TOK_SIMULATIONINFO,
3492 EDIF_TOK_COMMENT, EDIF_TOK_USERDATA,
3493 -EDIF_TOK_PHYSICALDESIGNRULE};
3494 static short f_TimeInterval[] = {EDIF_TOK_EVENT, EDIF_TOK_OFFSETEVENT,
3495 EDIF_TOK_DURATION};
3496 static short f_Timing[] = {EDIF_TOK_DERIVATION, EDIF_TOK_PATHDELAY,
3497 EDIF_TOK_FORBIDDENEVENT, EDIF_TOK_COMMENT,
3498 EDIF_TOK_USERDATA};
3499 static short f_Transform[] = {EDIF_TOK_SCALEX, EDIF_TOK_SCALEY, EDIF_TOK_DELTA,
3500 EDIF_TOK_ORIENTATION, EDIF_TOK_ORIGIN};
3501 static short f_Transition[] = {EDIF_TOK_NAME, EDIF_TOK_LOGICLIST,
3502 EDIF_TOK_LOGICONEOF};
3503 static short f_Trigger[] = {EDIF_TOK_CHANGE, EDIF_TOK_STEADY,
3504 EDIF_TOK_INITIAL};
3505 static short f_Union[] = {EDIF_TOK_FIGUREGROUPREF, EDIF_TOK_INTERSECTION,
3506 EDIF_TOK_UNION, EDIF_TOK_DIFFERENCE,
3507 EDIF_TOK_INVERSE, EDIF_TOK_OVERSIZE};
3508 static short f_View[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_VIEWTYPE,
3509 EDIF_TOK_INTERFACE, -EDIF_TOK_STATUS,
3510 -EDIF_TOK_CONTENTS, EDIF_TOK_COMMENT,
3511 EDIF_TOK_PROPERTY, EDIF_TOK_USERDATA};
3512 static short f_ViewList[] = {EDIF_TOK_VIEWREF, EDIF_TOK_VIEWLIST};
3513 static short f_ViewMap[] = {EDIF_TOK_PORTMAP, EDIF_TOK_PORTBACKANNOTATE,
3514 EDIF_TOK_INSTANCEMAP,
3515 EDIF_TOK_INSTANCEBACKANNOTATE, EDIF_TOK_NETMAP,
3516 EDIF_TOK_NETBACKANNOTATE, EDIF_TOK_COMMENT,
3517 EDIF_TOK_USERDATA};
3518 static short f_ViewRef[] = {EDIF_TOK_NAME, EDIF_TOK_CELLREF};
3519 static short f_Visible[] = {EDIF_TOK_FALSE, EDIF_TOK_TRUE};
3520 static short f_VoltageMap[] = {EDIF_TOK_MNM, EDIF_TOK_E};
3521 static short f_WaveValue[] = {EDIF_TOK_NAME, EDIF_TOK_RENAME, EDIF_TOK_E,
3522 EDIF_TOK_LOGICWAVEFORM};
3523 static short f_Weak[] = {EDIF_TOK_NAME};
3524 static short f_WeakJoined[] = {EDIF_TOK_PORTREF, EDIF_TOK_PORTLIST,
3525 EDIF_TOK_JOINED};
3526 static short f_When[] = {EDIF_TOK_TRIGGER, EDIF_TOK_AFTER,
3527 EDIF_TOK_FOLLOW, EDIF_TOK_MAINTAIN,
3528 EDIF_TOK_LOGICASSIGN, EDIF_TOK_COMMENT,
3529 EDIF_TOK_USERDATA};
3530 static short f_Written[] = {EDIF_TOK_TIMESTAMP, EDIF_TOK_AUTHOR,
3531 EDIF_TOK_PROGRAM, EDIF_TOK_DATAORIGIN,
3532 EDIF_TOK_PROPERTY, EDIF_TOK_COMMENT,
3533 EDIF_TOK_USERDATA};
3535 * Context binding table:
3537 * This binds context follower arrays to their originating context.
3539 typedef struct Binder {
3540 short *Follower; /* pointer to follower array */
3541 short Origin; /* '%token' value of origin */
3542 short FollowerSize; /* size of follower array */
3543 } Binder;
3544 #define BE(f,o) {f,o,sizeof(f)/sizeof(short)}
3545 static Binder BinderDef[] = {
3546 BE(f_NULL, 0),
3547 BE(f_Edif, EDIF_TOK_EDIF),
3548 BE(f_AcLoad, EDIF_TOK_ACLOAD),
3549 BE(f_After, EDIF_TOK_AFTER),
3550 BE(f_Annotate, EDIF_TOK_ANNOTATE),
3551 BE(f_Apply, EDIF_TOK_APPLY),
3552 BE(f_Arc, EDIF_TOK_ARC),
3553 BE(f_Array, EDIF_TOK_ARRAY),
3554 BE(f_ArrayMacro, EDIF_TOK_ARRAYMACRO),
3555 BE(f_ArrayRelatedInfo, EDIF_TOK_ARRAYRELATEDINFO),
3556 BE(f_ArraySite, EDIF_TOK_ARRAYSITE),
3557 BE(f_AtLeast, EDIF_TOK_ATLEAST),
3558 BE(f_AtMost, EDIF_TOK_ATMOST),
3559 BE(f_Becomes, EDIF_TOK_BECOMES),
3560 BE(f_Boolean, EDIF_TOK_BOOLEAN),
3561 BE(f_BooleanDisplay, EDIF_TOK_BOOLEANDISPLAY),
3562 BE(f_BooleanMap, EDIF_TOK_BOOLEANMAP),
3563 BE(f_BorderPattern, EDIF_TOK_BORDERPATTERN),
3564 BE(f_BoundingBox, EDIF_TOK_BOUNDINGBOX),
3565 BE(f_Cell, EDIF_TOK_CELL),
3566 BE(f_CellRef, EDIF_TOK_CELLREF),
3567 BE(f_Change, EDIF_TOK_CHANGE),
3568 BE(f_Circle, EDIF_TOK_CIRCLE),
3569 BE(f_Color, EDIF_TOK_COLOR),
3570 BE(f_CommentGraphics, EDIF_TOK_COMMENTGRAPHICS),
3571 BE(f_Compound, EDIF_TOK_COMPOUND),
3572 BE(f_ConnectLocation, EDIF_TOK_CONNECTLOCATION),
3573 BE(f_Contents, EDIF_TOK_CONTENTS),
3574 BE(f_Criticality, EDIF_TOK_CRITICALITY),
3575 BE(f_CurrentMap, EDIF_TOK_CURRENTMAP),
3576 BE(f_Curve, EDIF_TOK_CURVE),
3577 BE(f_Cycle, EDIF_TOK_CYCLE),
3578 BE(f_DataOrigin, EDIF_TOK_DATAORIGIN),
3579 BE(f_DcFanInLoad, EDIF_TOK_DCFANINLOAD),
3580 BE(f_DcFanOutLoad, EDIF_TOK_DCFANOUTLOAD),
3581 BE(f_DcMaxFanIn, EDIF_TOK_DCMAXFANIN),
3582 BE(f_DcMaxFanOut, EDIF_TOK_DCMAXFANOUT),
3583 BE(f_Delay, EDIF_TOK_DELAY),
3584 BE(f_Delta, EDIF_TOK_DELTA),
3585 BE(f_Design, EDIF_TOK_DESIGN),
3586 BE(f_Designator, EDIF_TOK_DESIGNATOR),
3587 BE(f_Difference, EDIF_TOK_DIFFERENCE),
3588 BE(f_Display, EDIF_TOK_DISPLAY),
3589 BE(f_Dominates, EDIF_TOK_DOMINATES),
3590 BE(f_Dot, EDIF_TOK_DOT),
3591 BE(f_Duration, EDIF_TOK_DURATION),
3592 BE(f_EnclosureDistance, EDIF_TOK_ENCLOSUREDISTANCE),
3593 BE(f_Entry, EDIF_TOK_ENTRY),
3594 BE(f_Exactly, EDIF_TOK_EXACTLY),
3595 BE(f_External, EDIF_TOK_EXTERNAL),
3596 BE(f_Fabricate, EDIF_TOK_FABRICATE),
3597 BE(f_Figure, EDIF_TOK_FIGURE),
3598 BE(f_FigureArea, EDIF_TOK_FIGUREAREA),
3599 BE(f_FigureGroup, EDIF_TOK_FIGUREGROUP),
3600 BE(f_FigureGroupObject, EDIF_TOK_FIGUREGROUPOBJECT),
3601 BE(f_FigureGroupOverride, EDIF_TOK_FIGUREGROUPOVERRIDE),
3602 BE(f_FigureGroupRef, EDIF_TOK_FIGUREGROUPREF),
3603 BE(f_FigurePerimeter, EDIF_TOK_FIGUREPERIMETER),
3604 BE(f_FigureWidth, EDIF_TOK_FIGUREWIDTH),
3605 BE(f_FillPattern, EDIF_TOK_FILLPATTERN),
3606 BE(f_Follow, EDIF_TOK_FOLLOW),
3607 BE(f_ForbiddenEvent, EDIF_TOK_FORBIDDENEVENT),
3608 BE(f_GlobalPortRef, EDIF_TOK_GLOBALPORTREF),
3609 BE(f_GreaterThan, EDIF_TOK_GREATERTHAN),
3610 BE(f_GridMap, EDIF_TOK_GRIDMAP),
3611 BE(f_IncludeFigureGroup, EDIF_TOK_INCLUDEFIGUREGROUP),
3612 BE(f_Instance, EDIF_TOK_INSTANCE),
3613 BE(f_InstanceBackAnnotate, EDIF_TOK_INSTANCEBACKANNOTATE),
3614 BE(f_InstanceGroup, EDIF_TOK_INSTANCEGROUP),
3615 BE(f_InstanceMap, EDIF_TOK_INSTANCEMAP),
3616 BE(f_InstanceRef, EDIF_TOK_INSTANCEREF),
3617 BE(f_Integer, EDIF_TOK_INTEGER),
3618 BE(f_IntegerDisplay, EDIF_TOK_INTEGERDISPLAY),
3619 BE(f_InterFigureGroupSpacing, EDIF_TOK_INTERFIGUREGROUPSPACING),
3620 BE(f_Interface, EDIF_TOK_INTERFACE),
3621 BE(f_Intersection, EDIF_TOK_INTERSECTION),
3622 BE(f_IntraFigureGroupSpacing, EDIF_TOK_INTRAFIGUREGROUPSPACING),
3623 BE(f_Inverse, EDIF_TOK_INVERSE),
3624 BE(f_Joined, EDIF_TOK_JOINED),
3625 BE(f_KeywordDisplay, EDIF_TOK_KEYWORDDISPLAY),
3626 BE(f_KeywordMap, EDIF_TOK_KEYWORDMAP),
3627 BE(f_LessThan, EDIF_TOK_LESSTHAN),
3628 BE(f_Library, EDIF_TOK_LIBRARY),
3629 BE(f_LibraryRef, EDIF_TOK_LIBRARYREF),
3630 BE(f_ListOfNets, EDIF_TOK_LISTOFNETS),
3631 BE(f_ListOfPorts, EDIF_TOK_LISTOFPORTS),
3632 BE(f_LoadDelay, EDIF_TOK_LOADDELAY),
3633 BE(f_LogicAssign, EDIF_TOK_LOGICASSIGN),
3634 BE(f_LogicInput, EDIF_TOK_LOGICINPUT),
3635 BE(f_LogicList, EDIF_TOK_LOGICLIST),
3636 BE(f_LogicMapInput, EDIF_TOK_LOGICMAPINPUT),
3637 BE(f_LogicMapOutput, EDIF_TOK_LOGICMAPOUTPUT),
3638 BE(f_LogicOneOf, EDIF_TOK_LOGICONEOF),
3639 BE(f_LogicOutput, EDIF_TOK_LOGICOUTPUT),
3640 BE(f_LogicPort, EDIF_TOK_LOGICPORT),
3641 BE(f_LogicRef, EDIF_TOK_LOGICREF),
3642 BE(f_LogicValue, EDIF_TOK_LOGICVALUE),
3643 BE(f_LogicWaveform, EDIF_TOK_LOGICWAVEFORM),
3644 BE(f_Maintain, EDIF_TOK_MAINTAIN),
3645 BE(f_Match, EDIF_TOK_MATCH),
3646 BE(f_Member, EDIF_TOK_MEMBER),
3647 BE(f_MiNoMax, EDIF_TOK_MINOMAX),
3648 BE(f_MiNoMaxDisplay, EDIF_TOK_MINOMAXDISPLAY),
3649 BE(f_Mnm, EDIF_TOK_MNM),
3650 BE(f_MultipleValueSet, EDIF_TOK_MULTIPLEVALUESET),
3651 BE(f_MustJoin, EDIF_TOK_MUSTJOIN),
3652 BE(f_Name, EDIF_TOK_NAME),
3653 BE(f_Net, EDIF_TOK_NET),
3654 BE(f_NetBackAnnotate, EDIF_TOK_NETBACKANNOTATE),
3655 BE(f_NetBundle, EDIF_TOK_NETBUNDLE),
3656 BE(f_NetDelay, EDIF_TOK_NETDELAY),
3657 BE(f_NetGroup, EDIF_TOK_NETGROUP),
3658 BE(f_NetMap, EDIF_TOK_NETMAP),
3659 BE(f_NetRef, EDIF_TOK_NETREF),
3660 BE(f_NonPermutable, EDIF_TOK_NONPERMUTABLE),
3661 BE(f_NotAllowed, EDIF_TOK_NOTALLOWED),
3662 BE(f_NotchSpacing, EDIF_TOK_NOTCHSPACING),
3663 BE(f_Number, EDIF_TOK_NUMBER),
3664 BE(f_NumberDefinition, EDIF_TOK_NUMBERDEFINITION),
3665 BE(f_NumberDisplay, EDIF_TOK_NUMBERDISPLAY),
3666 BE(f_OffPageConnector, EDIF_TOK_OFFPAGECONNECTOR),
3667 BE(f_OffsetEvent, EDIF_TOK_OFFSETEVENT),
3668 BE(f_OpenShape, EDIF_TOK_OPENSHAPE),
3669 BE(f_Origin, EDIF_TOK_ORIGIN),
3670 BE(f_OverhangDistance, EDIF_TOK_OVERHANGDISTANCE),
3671 BE(f_OverlapDistance, EDIF_TOK_OVERLAPDISTANCE),
3672 BE(f_Oversize, EDIF_TOK_OVERSIZE),
3673 BE(f_Page, EDIF_TOK_PAGE),
3674 BE(f_PageSize, EDIF_TOK_PAGESIZE),
3675 BE(f_Parameter, EDIF_TOK_PARAMETER),
3676 BE(f_ParameterAssign, EDIF_TOK_PARAMETERASSIGN),
3677 BE(f_ParameterDisplay, EDIF_TOK_PARAMETERDISPLAY),
3678 BE(f_Path, EDIF_TOK_PATH),
3679 BE(f_PathDelay, EDIF_TOK_PATHDELAY),
3680 BE(f_Permutable, EDIF_TOK_PERMUTABLE),
3681 BE(f_PhysicalDesignRule, EDIF_TOK_PHYSICALDESIGNRULE),
3682 BE(f_Plug, EDIF_TOK_PLUG),
3683 BE(f_Point, EDIF_TOK_POINT),
3684 BE(f_PointDisplay, EDIF_TOK_POINTDISPLAY),
3685 BE(f_PointList, EDIF_TOK_POINTLIST),
3686 BE(f_Polygon, EDIF_TOK_POLYGON),
3687 BE(f_Port, EDIF_TOK_PORT),
3688 BE(f_PortBackAnnotate, EDIF_TOK_PORTBACKANNOTATE),
3689 BE(f_PortBundle, EDIF_TOK_PORTBUNDLE),
3690 BE(f_PortDelay, EDIF_TOK_PORTDELAY),
3691 BE(f_PortGroup, EDIF_TOK_PORTGROUP),
3692 BE(f_PortImplementation, EDIF_TOK_PORTIMPLEMENTATION),
3693 BE(f_PortInstance, EDIF_TOK_PORTINSTANCE),
3694 BE(f_PortList, EDIF_TOK_PORTLIST),
3695 BE(f_PortListAlias, EDIF_TOK_PORTLISTALIAS),
3696 BE(f_PortMap, EDIF_TOK_PORTMAP),
3697 BE(f_PortRef, EDIF_TOK_PORTREF),
3698 BE(f_Program, EDIF_TOK_PROGRAM),
3699 BE(f_Property, EDIF_TOK_PROPERTY),
3700 BE(f_PropertyDisplay, EDIF_TOK_PROPERTYDISPLAY),
3701 BE(f_ProtectionFrame, EDIF_TOK_PROTECTIONFRAME),
3702 BE(f_RangeVector, EDIF_TOK_RANGEVECTOR),
3703 BE(f_Rectangle, EDIF_TOK_RECTANGLE),
3704 BE(f_RectangleSize, EDIF_TOK_RECTANGLESIZE),
3705 BE(f_Rename, EDIF_TOK_RENAME),
3706 BE(f_Resolves, EDIF_TOK_RESOLVES),
3707 BE(f_Scale, EDIF_TOK_SCALE),
3708 BE(f_Section, EDIF_TOK_SECTION),
3709 BE(f_Shape, EDIF_TOK_SHAPE),
3710 BE(f_Simulate, EDIF_TOK_SIMULATE),
3711 BE(f_SimulationInfo, EDIF_TOK_SIMULATIONINFO),
3712 BE(f_SingleValueSet, EDIF_TOK_SINGLEVALUESET),
3713 BE(f_Site, EDIF_TOK_SITE),
3714 BE(f_Socket, EDIF_TOK_SOCKET),
3715 BE(f_SocketSet, EDIF_TOK_SOCKETSET),
3716 BE(f_Status, EDIF_TOK_STATUS),
3717 BE(f_Steady, EDIF_TOK_STEADY),
3718 BE(f_String, EDIF_TOK_STRING),
3719 BE(f_StringDisplay, EDIF_TOK_STRINGDISPLAY),
3720 BE(f_Strong, EDIF_TOK_STRONG),
3721 BE(f_Symbol, EDIF_TOK_SYMBOL),
3722 BE(f_Symmetry, EDIF_TOK_SYMMETRY),
3723 BE(f_Table, EDIF_TOK_TABLE),
3724 BE(f_TableDefault, EDIF_TOK_TABLEDEFAULT),
3725 BE(f_Technology, EDIF_TOK_TECHNOLOGY),
3726 BE(f_TimeInterval, EDIF_TOK_TIMEINTERVAL),
3727 BE(f_Timing, EDIF_TOK_TIMING),
3728 BE(f_Transform, EDIF_TOK_TRANSFORM),
3729 BE(f_Transition, EDIF_TOK_TRANSITION),
3730 BE(f_Trigger, EDIF_TOK_TRIGGER),
3731 BE(f_Union, EDIF_TOK_UNION),
3732 BE(f_View, EDIF_TOK_VIEW),
3733 BE(f_ViewList, EDIF_TOK_VIEWLIST),
3734 BE(f_ViewMap, EDIF_TOK_VIEWMAP),
3735 BE(f_ViewRef, EDIF_TOK_VIEWREF),
3736 BE(f_Visible, EDIF_TOK_VISIBLE),
3737 BE(f_VoltageMap, EDIF_TOK_VOLTAGEMAP),
3738 BE(f_WaveValue, EDIF_TOK_WAVEVALUE),
3739 BE(f_Weak, EDIF_TOK_WEAK),
3740 BE(f_WeakJoined, EDIF_TOK_WEAKJOINED),
3741 BE(f_When, EDIF_TOK_WHEN),
3742 BE(f_Written, EDIF_TOK_WRITTEN)
3744 static int BinderDefSize = sizeof(BinderDef) / sizeof(Binder);
3746 * Keyword table:
3748 * This hash table holds all strings which may have to be matched
3749 * to. WARNING: it is assumed that there is no overlap of the 'token'
3750 * and 'context' strings.
3752 typedef struct Keyword {
3753 struct Keyword *Next; /* pointer to next entry */
3754 char *String; /* pointer to associated string */
3755 } Keyword;
3756 #define KEYWORD_HASH 127 /* hash table size */
3757 static Keyword *KeywordTable[KEYWORD_HASH];
3759 * Enter keyword:
3761 * The passed string is entered into the keyword hash table.
3763 static void EnterKeyword(char * str)
3766 * Locals.
3768 register Keyword *key;
3769 register unsigned int hsh;
3770 register char *cp;
3772 * Create the hash code, and add an entry to the table.
3774 for (hsh = 0, cp = str; *cp; hsh += hsh + *cp++);
3775 hsh %= KEYWORD_HASH;
3776 key = (Keyword *) Malloc(sizeof(Keyword));
3777 key->Next = KeywordTable[hsh];
3778 (KeywordTable[hsh] = key)->String = str;
3781 * Find keyword:
3783 * The passed string is located within the keyword table. If an
3784 * entry exists, then the value of the keyword string is returned. This
3785 * is real useful for doing string comparisons by pointer value later.
3786 * If there is no match, a NULL is returned.
3788 static char *FindKeyword(char * str)
3791 * Locals.
3793 register Keyword *wlk,*owk;
3794 register unsigned int hsh;
3795 register char *cp;
3796 char lower[IDENT_LENGTH + 1];
3798 * Create a lower case copy of the string.
3800 for (cp = lower; *str;)
3801 if (isupper( (int) *str))
3802 *cp++ = tolower( (int) *str++);
3803 else
3804 *cp++ = *str++;
3805 *cp = '\0';
3807 * Search the hash table for a match.
3809 for (hsh = 0, cp = lower; *cp; hsh += hsh + *cp++);
3810 hsh %= KEYWORD_HASH;
3811 for (owk = NULL, wlk = KeywordTable[hsh]; wlk; wlk = (owk = wlk)->Next)
3812 if (!strcmp(wlk->String,lower)){
3814 * Readjust the LRU.
3816 if (owk){
3817 owk->Next = wlk->Next;
3818 wlk->Next = KeywordTable[hsh];
3819 KeywordTable[hsh] = wlk;
3821 return (wlk->String);
3823 return (NULL);
3826 * Token hash table.
3828 #define TOKEN_HASH 51
3829 static Token *TokenHash[TOKEN_HASH];
3831 * Find token:
3833 * A pointer to the token of the passed code is returned. If
3834 * no such beastie is present a NULL is returned instead.
3836 static Token *FindToken(register int cod)
3839 * Locals.
3841 register Token *wlk,*owk;
3842 register unsigned int hsh;
3844 * Search the hash table for a matching token.
3846 hsh = cod % TOKEN_HASH;
3847 for (owk = NULL, wlk = TokenHash[hsh]; wlk; wlk = (owk = wlk)->Next)
3848 if (cod == wlk->Code){
3849 if (owk){
3850 owk->Next = wlk->Next;
3851 wlk->Next = TokenHash[hsh];
3852 TokenHash[hsh] = wlk;
3854 break;
3856 return (wlk);
3859 * Context hash table.
3861 #define CONTEXT_HASH 127
3862 static Context *ContextHash[CONTEXT_HASH];
3864 * Find context:
3866 * A pointer to the context of the passed code is returned. If
3867 * no such beastie is present a NULL is returned instead.
3869 static Context *FindContext(register int cod)
3872 * Locals.
3874 register Context *wlk,*owk;
3875 register unsigned int hsh;
3877 * Search the hash table for a matching context.
3879 hsh = cod % CONTEXT_HASH;
3880 for (owk = NULL, wlk = ContextHash[hsh]; wlk; wlk = (owk = wlk)->Next)
3881 if (cod == wlk->Code){
3882 if (owk){
3883 owk->Next = wlk->Next;
3884 wlk->Next = ContextHash[hsh];
3885 ContextHash[hsh] = wlk;
3887 break;
3889 return (wlk);
3892 * Token stacking variables.
3894 #ifdef DEBUG
3895 #define TS_DEPTH 8
3896 #define TS_MASK (TS_DEPTH - 1)
3897 static unsigned int TSP = 0; /* token stack pointer */
3898 static char *TokenStack[TS_DEPTH]; /* token name strings */
3899 static short TokenType[TS_DEPTH]; /* token types */
3901 * Stack:
3903 * Add a token to the debug stack. The passed string and type are
3904 * what is to be pushed.
3906 static Stack(char * str, int typ)
3909 * Free any previous string, then push.
3911 if (TokenStack[TSP & TS_MASK])
3912 Free(TokenStack[TSP & TS_MASK]);
3913 TokenStack[TSP & TS_MASK] = strcpy((char *)Malloc(strlen(str) + 1),str);
3914 TokenType[TSP & TS_MASK] = typ;
3915 TSP += 1;
3918 * Dump stack:
3920 * This displays the last set of accumulated tokens.
3922 static DumpStack()
3925 * Locals.
3927 register int i;
3928 register Context *cxt;
3929 register Token *tok;
3930 register char *nam;
3932 * Run through the list displaying the oldest first.
3934 fprintf(Error,"\n\n");
3935 for (i = 0; i < TS_DEPTH; i += 1)
3936 if (TokenStack[(TSP + i) & TS_MASK]){
3938 * Get the type name string.
3940 if (cxt = FindContext(TokenType[(TSP + i) & TS_MASK]))
3941 nam = cxt->Name;
3942 else if (tok = FindToken(TokenType[(TSP + i) & TS_MASK]))
3943 nam = tok->Name;
3944 else switch (TokenType[(TSP + i) & TS_MASK]){
3945 case IDENT: nam = "IDENT"; break;
3946 case INT: nam = "INT"; break;
3947 case KEYWORD: nam = "KEYWORD"; break;
3948 case STR: nam = "STR"; break;
3949 default: nam = "?"; break;
3952 * Now print the token state.
3954 fprintf(Error,"%2d %-16.16s '%s'\n",TS_DEPTH - i,nam,
3955 TokenStack[(TSP + i) & TS_MASK]);
3957 fprintf(Error,"\n");
3959 #else
3960 #define Stack(s,t)
3961 #endif /* DEBUG */
3963 * Parser state variables.
3965 static FILE *Input = NULL; /* input stream */
3966 static FILE *Error = NULL; /* error stream */
3967 static char *InFile; /* file name on the input stream */
3968 static long LineNumber; /* current input line number */
3969 static ContextCar *CSP = NULL; /* top of context stack */
3970 static char yytext[IDENT_LENGTH + 1]; /* token buffer */
3971 static char CharBuf[IDENT_LENGTH + 1]; /* garbage buffer */
3973 * yyerror:
3975 * Standard error reporter, it prints out the passed string
3976 * preceeded by the current filename and line number.
3978 static void yyerror(const char *ers)
3980 #ifdef DEBUG
3981 DumpStack();
3982 #endif /* DEBUG */
3983 fprintf(Error,"%s, line %ld: %s\n",InFile,LineNumber,ers);
3986 * String bucket definitions.
3988 #define BUCKET_SIZE 64
3989 typedef struct Bucket {
3990 struct Bucket *Next; /* pointer to next bucket */
3991 int Index; /* pointer to next free slot */
3992 char Data[BUCKET_SIZE]; /* string data */
3993 } Bucket;
3994 static Bucket *CurrentBucket = NULL; /* string bucket list */
3995 static int StringSize = 0; /* current string length */
3997 * Push string:
3999 * This adds the passed charater to the current string bucket.
4001 static void PushString(char chr)
4004 * Locals.
4006 register Bucket *bck;
4008 * Make sure there is room for the push.
4010 if ((bck = CurrentBucket)->Index >= BUCKET_SIZE){
4011 bck = (Bucket *) Malloc(sizeof(Bucket));
4012 bck->Next = CurrentBucket;
4013 (CurrentBucket = bck)->Index = 0;
4016 * Push the character.
4018 bck->Data[bck->Index++] = chr;
4019 StringSize += 1;
4022 * Form string:
4024 * This converts the current string bucket into a real live string,
4025 * whose pointer is returned.
4027 static char *FormString()
4030 * Locals.
4032 register Bucket *bck;
4033 register char *cp;
4035 * Allocate space for the string, set the pointer at the end.
4037 cp = (char *) Malloc(StringSize + 1);
4039 cp += StringSize;
4040 *cp-- = '\0';
4042 * Yank characters out of the bucket.
4044 for (bck = CurrentBucket; bck->Index || bck->Next;){
4045 if (!bck->Index){
4046 CurrentBucket = bck->Next;
4047 Free(bck);
4048 bck = CurrentBucket;
4050 *cp-- = bck->Data[--bck->Index];
4052 /* reset buffer size to zero */
4053 StringSize =0;
4054 return (cp + 1);
4057 * Parse EDIF:
4059 * This builds the context tree and then calls the real parser.
4060 * It is passed two file streams, the first is where the input comes
4061 * from; the second is where error messages get printed.
4063 void ParseEDIF(char* filename,FILE* err)
4066 * Locals.
4068 register int i;
4069 static int ContextDefined = 1;
4071 * Set up the file state to something useful.
4073 InFile = filename;
4074 Input = fopen(filename,"r");
4075 Error = err;
4076 LineNumber = 1;
4078 * Define both the enabled token and context strings.
4080 if (ContextDefined){
4081 for (i = TokenDefSize; i--; EnterKeyword(TokenDef[i].Name)){
4082 register unsigned int hsh;
4083 hsh = TokenDef[i].Code % TOKEN_HASH;
4084 TokenDef[i].Next = TokenHash[hsh];
4085 TokenHash[hsh] = &TokenDef[i];
4087 for (i = ContextDefSize; i--; EnterKeyword(ContextDef[i].Name)){
4088 register unsigned int hsh;
4089 hsh = ContextDef[i].Code % CONTEXT_HASH;
4090 ContextDef[i].Next = ContextHash[hsh];
4091 ContextHash[hsh] = &ContextDef[i];
4094 * Build the context tree.
4096 for (i = BinderDefSize; i--;){
4097 register Context *cxt;
4098 register int j;
4100 * Define the current context to have carriers bound to it.
4102 cxt = FindContext(BinderDef[i].Origin);
4103 for (j = BinderDef[i].FollowerSize; j--;){
4104 register ContextCar *cc;
4106 * Add carriers to the current context.
4108 cc = (ContextCar *) Malloc(sizeof(ContextCar));
4109 cc->Next = cxt->Context;
4110 (cxt->Context = cc)->Context =
4111 FindContext(ABS(BinderDef[i].Follower[j]));
4112 cc->u.Single = BinderDef[i].Follower[j] < 0;
4116 * Build the token tree.
4118 for (i = TieDefSize; i--;){
4119 register Context *cxt;
4120 register int j;
4122 * Define the current context to have carriers bound to it.
4124 cxt = FindContext(TieDef[i].Origin);
4125 for (j = TieDef[i].EnableSize; j--;){
4126 register TokenCar *tc;
4128 * Add carriers to the current context.
4130 tc = (TokenCar *) Malloc(sizeof(TokenCar));
4131 tc->Next = cxt->Token;
4132 (cxt->Token = tc)->Token = FindToken(TieDef[i].Enable[j]);
4136 * Put a bogus context on the stack which has 'EDIF' as its
4137 * follower.
4139 CSP = (ContextCar *) Malloc(sizeof(ContextCar));
4140 CSP->Next = NULL;
4141 CSP->Context = FindContext(0);
4142 CSP->u.Used = NULL;
4143 ContextDefined = 0;
4146 * Create an initial, empty string bucket.
4148 CurrentBucket = (Bucket *) Malloc(sizeof(Bucket));
4149 CurrentBucket->Next = 0;
4150 CurrentBucket->Index = 0;
4152 * Fill the token stack with NULLs if debugging is enabled.
4154 #ifdef DEBUG
4155 for (i = TS_DEPTH; i--; TokenStack[i] = NULL)
4156 if (TokenStack[i])
4157 Free(TokenStack[i]);
4158 TSP = 0;
4159 #endif /* DEBUG */
4161 * Go parse things!
4163 edifparse();
4166 * Match token:
4168 * The passed string is looked up in the current context's token
4169 * list to see if it is enabled. If so the token value is returned,
4170 * if not then zero.
4172 static int MatchToken(register char * str)
4175 * Locals.
4177 register TokenCar *wlk,*owk;
4179 * Convert the string to the proper form, then search the token
4180 * carrier list for a match.
4182 str = FindKeyword(str);
4183 for (owk = NULL, wlk = CSP->Context->Token; wlk; wlk = (owk = wlk)->Next)
4184 if (str == wlk->Token->Name){
4185 if (owk){
4186 owk->Next = wlk->Next;
4187 wlk->Next = CSP->Context->Token;
4188 CSP->Context->Token = wlk;
4190 return (wlk->Token->Code);
4192 return (0);
4195 * Match context:
4197 * If the passed keyword string is within the current context, the
4198 * new context is pushed and token value is returned. A zero otherwise.
4200 static int MatchContext(register char * str)
4203 * Locals.
4205 register ContextCar *wlk,*owk;
4207 * See if the context is present.
4209 str = FindKeyword(str);
4210 for (owk = NULL, wlk = CSP->Context->Context; wlk; wlk = (owk = wlk)->Next)
4211 if (str == wlk->Context->Name){
4212 if (owk){
4213 owk->Next = wlk->Next;
4214 wlk->Next = CSP->Context->Context;
4215 CSP->Context->Context = wlk;
4218 * If a single context, make sure it isn't already used.
4220 if (wlk->u.Single){
4221 register UsedCar *usc;
4222 for (usc = CSP->u.Used; usc; usc = usc->Next)
4223 if (usc->Code == wlk->Context->Code)
4224 break;
4225 if (usc){
4226 sprintf(CharBuf,"'%s' is used more than once within '%s'",
4227 str,CSP->Context->Name);
4228 yyerror(CharBuf);
4229 } else {
4230 usc = (UsedCar *) Malloc(sizeof(UsedCar));
4231 usc->Next = CSP->u.Used;
4232 (CSP->u.Used = usc)->Code = wlk->Context->Code;
4236 * Push the new context.
4238 owk = (ContextCar *) Malloc(sizeof(ContextCar));
4239 owk->Next = CSP;
4240 (CSP = owk)->Context = wlk->Context;
4241 owk->u.Used = NULL;
4242 return (wlk->Context->Code);
4244 return (0);
4247 * PopC:
4249 * This pops the current context.
4251 static void PopC()
4254 * Locals.
4256 register UsedCar *usc;
4257 register ContextCar *csp;
4259 * Release single markers and pop context.
4261 while ( (usc = CSP->u.Used) ){
4262 CSP->u.Used = usc->Next;
4263 Free(usc);
4265 csp = CSP->Next;
4266 Free(CSP);
4267 CSP = csp;
4270 * Lexical analyzer states.
4272 #define L_START 0
4273 #define L_INT 1
4274 #define L_IDENT 2
4275 #define L_KEYWORD 3
4276 #define L_STRING 4
4277 #define L_KEYWORD2 5
4278 #define L_ASCIICHAR 6
4279 #define L_ASCIICHAR2 7
4281 * yylex:
4283 * This is the lexical analyzer called by the YACC/BISON parser.
4284 * It returns a pretty restricted set of token types and does the
4285 * context movement when acceptable keywords are found. The token
4286 * value returned is a NULL terminated string to allocated storage
4287 * (ie - it should get released some time) with some restrictions.
4288 * The token value for integers is strips a leading '+' if present.
4289 * String token values have the leading and trailing '"'-s stripped.
4290 * '%' conversion characters in string values are passed converted.
4291 * The '(' and ')' characters do not have a token value.
4293 static int yylex()
4296 * Locals.
4298 register int c,s,l;
4300 * Keep on sucking up characters until we find something which
4301 * explicitly forces us out of this function.
4303 for (s = L_START, l = 0; 1;){
4304 yytext[l++] = c = Getc(Input);
4305 switch (s){
4307 * Starting state, look for something resembling a token.
4309 case L_START:
4310 if (isdigit(c) || c == '-')
4311 s = L_INT;
4312 else if (isalpha(c) || c == '&')
4313 s = L_IDENT;
4314 else if (isspace(c)){
4315 if (c == '\n')
4316 LineNumber += 1;
4317 l = 0;
4318 } else if (c == '('){
4319 l = 0;
4320 s = L_KEYWORD;
4321 } else if (c == '"')
4322 s = L_STRING;
4323 else if (c == '+'){
4324 l = 0; /* strip '+' */
4325 s = L_INT;
4326 } else if (c == EOF)
4327 return ('\0');
4328 else {
4329 yytext[1] = '\0';
4330 Stack(yytext,c);
4331 return (c);
4333 break;
4335 * Suck up the integer digits.
4337 case L_INT:
4338 if (isdigit(c))
4339 break;
4340 Ungetc(c);
4341 yytext[--l] = '\0';
4342 yylval.s = strcpy((char *)Malloc(l + 1),yytext);
4343 Stack(yytext,EDIF_TOK_INT);
4344 return (EDIF_TOK_INT);
4346 * Grab an identifier, see if the current context enables
4347 * it with a specific token value.
4349 case L_IDENT:
4350 if (isalpha(c) || isdigit(c) || c == '_')
4351 break;
4352 Ungetc(c);
4353 yytext[--l] = '\0';
4354 if (CSP->Context->Token && (c = MatchToken(yytext))){
4355 Stack(yytext,c);
4356 return (c);
4358 yylval.s = strcpy((char *)Malloc(l + 1),yytext);
4359 Stack(yytext, EDIF_TOK_IDENT);
4360 return (EDIF_TOK_IDENT);
4362 * Scan until you find the start of an identifier, discard
4363 * any whitespace found. On no identifier, return a '('.
4365 case L_KEYWORD:
4366 if (isalpha(c) || c == '&'){
4367 s = L_KEYWORD2;
4368 break;
4369 } else if (isspace(c)){
4370 l = 0;
4371 break;
4373 Ungetc(c);
4374 Stack("(",'(');
4375 return ('(');
4377 * Suck up the keyword identifier, if it matches the set of
4378 * allowable contexts then return its token value and push
4379 * the context, otherwise just return the identifier string.
4381 case L_KEYWORD2:
4382 if (isalpha(c) || isdigit(c) || c == '_')
4383 break;
4384 Ungetc(c);
4385 yytext[--l] = '\0';
4386 if ( (c = MatchContext(yytext)) ){
4387 Stack(yytext,c);
4388 return (c);
4390 yylval.s = strcpy((char *)Malloc(l + 1),yytext);
4391 Stack(yytext, EDIF_TOK_KEYWORD);
4392 return (EDIF_TOK_KEYWORD);
4394 * Suck up string characters but once resolved they should
4395 * be deposited in the string bucket because they can be
4396 * arbitrarily long.
4398 case L_STRING:
4399 if (c == '\n')
4400 LineNumber += 1;
4401 else if (c == '\r')
4403 else if (c == '"' || c == EOF){
4404 yylval.s = FormString();
4405 Stack(yylval.s, EDIF_TOK_STR);
4406 return (EDIF_TOK_STR);
4407 } else if (c == '%')
4408 s = L_ASCIICHAR;
4409 else
4410 PushString(c);
4411 l = 0;
4412 break;
4414 * Skip white space and look for integers to be pushed
4415 * as characters.
4417 case L_ASCIICHAR:
4418 if (isdigit(c)){
4419 s = L_ASCIICHAR2;
4420 break;
4421 } else if (c == '%' || c == EOF)
4422 s = L_STRING;
4423 else if (c == '\n')
4424 LineNumber += 1;
4425 l = 0;
4426 break;
4428 * Convert the accumulated integer into a char and push.
4430 case L_ASCIICHAR2:
4431 if (isdigit(c))
4432 break;
4433 Ungetc(c);
4434 yytext[--l] = '\0';
4435 PushString(atoi(yytext));
4436 s = L_ASCIICHAR;
4437 l = 0;
4438 break;