RPA Toolkit
Added initial version of kicad library parse rules.
[rpatk.git] / tests / datapatterns / kicad-lib.rpa
1 #!emitnone
2 #!emit header
3 #!emit comp
4 #!emit comp_field
5 #!emit field_header
6 #!emit field_value
7 #!emit field_name
8 #!emit field_x
9 #!emit field_y
10 #!emit field_size
11 #!emit field_orient
12 #!emit field_halign
13 #!emit field_valign
14 #!emit field_visible
15 #!emit field_italic
16 #!emit field_bold
17
18 #!abort header
19 #!abort field_value
20 #!abort field_x
21 #!abort field_y
22 #!abort field_size
23 #!abort field_orient
24 #!abort field_visible
25 #!abort field_halign
26 #!abort field_valign
27 #!abort field_italic
28 #!abort field_bold
29
30
31 EOL             ::= [#xA] | [#xA][#xD]
32 BL              ::= <EOL>+
33 S               ::= ( [#x20] | [#x9] )+
34 DD              ::= [0-9][0-9]
35 DDDD            ::= [0-9][0-9][0-9][0-9]
36
37 datestr         ::= Date
38 date            ::= <DD>/<DD>/<DDDD><S><DD>:<DD>:<DD>
39 lib_header      ::= "EESchema-LIBRARY" <S> Version <S> "2.3" (<S><datestr>: <S> '"' <date> '"' )? <EOL>*
40 lib_encoding    ::= "#encoding utf-8" <EOL>*
41 lib_trailer     ::= "#End Library" <EOL>*
42 comment         ::= '#'(. - <EOL>)* <EOL>* - <lib_trailer>
43
44 comp_name_char  ::= [\-_$\.\%\#\@&\*\+\!0-9A-Za-z]
45 comp_name       ::= [~]<comp_name_char>* | <comp_name_char>+
46 comp_ref        ::= [A-Za-z]+
47 pinname_offs    ::= [0-9]+
48 pinnum_visible  ::= [YN]
49 pinname_visible ::= [YN]
50 num_parts       ::= [0-9]+
51 locked          ::= [LF]
52 power           ::= [PN]
53 field_header    ::= F[0-9]+
54 field_value     ::= '"' (. - (<EOL> | '"'))* '"'
55 field_name      ::= '"' (. - (<EOL> | '"'))* '"'
56 field_x         ::= [\-]?[0-9]+
57 field_y         ::= [\-]?[0-9]+
58 field_size      ::= [0-9]+
59 field_orient    ::= [HV]
60 field_visible   ::= [IV]
61 field_halign    ::= [CLRTB]
62 field_valign    ::= [CLRTB]
63 field_italic    ::= [IN]
64 field_bold      ::= [BN]
65 comp_header     ::= DEF <S> \
66                     <comp_name> <S> \
67                     <comp_ref> <S> \
68                     0 <S> \
69                     <pinname_offs> <S> \
70                     <pinnum_visible> <S> \
71                     <pinname_visible> <S> \
72                     <num_parts> (<S> <locked> <S> <power>)? <S>* <EOL>*
73 comp_field      ::= <field_header> <S> \
74                     <field_value> <S> \
75                     <field_x> <S> \
76                     <field_y> <S> \
77                     <field_size> <S> \
78                     <field_orient> <S> \
79                     <field_visible> <S> \
80                     <field_halign> <S> \
81                     <field_valign> <field_italic> <field_bold> (<S> <field_name>)? <S>* <EOL>*
82
83 fplist_header   ::= $FPLIST <S> *<EOL>*
84 fplist_trailer  ::= $ENDFPLIST <S>* <EOL>*
85 fplist_filter   ::= (. - (<EOL> | <comment> | <fplist_trailer>))+ <EOL>*
86 fplist          ::= <fplist_header> <fplist_filter>* <fplist_trailer>
87
88 comp            ::= <comp_header> \
89                     <comp_field>* \
90                     <fplist>? \
91                     DRAW <S>* <EOL>* \
92                     (((. - <EOL>)* <EOL>*) - ENDDRAW)* \
93                     ENDDRAW <S>* <EOL>* \
94                     ENDDEF <S>* <EOL>*
95
96 lib             ::= <lib_header> \
97                     <lib_encoding> \
98                     (<comment> | <comp>)* \
99                     <lib_trailer>
100
101