kicad 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/kicad/ast.rb +59 -0
- data/lib/kicad/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e944bc881b0e7a99b42b633c9df21024d42b2e30e7b457ffa6ca1a796588c04e
|
4
|
+
data.tar.gz: 3e85ea51ff84ceeb5568caf53bb7c52b0e63a4dc5b1e9f2d477ac436e7227482
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c89b5bae3031b0d8e20ac110a32332aa9fa28d4165fffd11c83babc20a147118df8b605563eda7ce20bd564beccfcdd9e5291f473ac038bec9c19fa55a189e00
|
7
|
+
data.tar.gz: b790349787e1c3badd597ffc4be397e472f41c55c2a7c189552bc9373ad2132102f71dbc20ec52291344bda9706f52cddfb9589d74b0357c82573b45bfc8260a
|
data/lib/kicad/ast.rb
CHANGED
@@ -16,6 +16,19 @@ module KiCad
|
|
16
16
|
")\n"
|
17
17
|
end
|
18
18
|
|
19
|
+
# A replacement for a Node#emit that wants descendents compacted
|
20
|
+
def emit_compacting depth = 0
|
21
|
+
"\t"*depth + emit_compact + "\n"
|
22
|
+
end
|
23
|
+
|
24
|
+
def emit_compact
|
25
|
+
'(' +
|
26
|
+
[ @values.map{|v| String === v ? v.inspect : v.to_s },
|
27
|
+
@children.map{|c| c.emit_compact() }
|
28
|
+
].flatten*' ' +
|
29
|
+
')'
|
30
|
+
end
|
31
|
+
|
19
32
|
# Define setter and getter methods for each value type this class allows
|
20
33
|
def self.value_types vts
|
21
34
|
i = 1 # @values[0] is always the class symbol
|
@@ -87,12 +100,21 @@ module KiCad
|
|
87
100
|
end
|
88
101
|
|
89
102
|
class Generator < Node
|
103
|
+
def emit depth = 0
|
104
|
+
emit_compacting depth
|
105
|
+
end
|
90
106
|
end
|
91
107
|
|
92
108
|
class GeneratorVersion < Node
|
109
|
+
def emit depth = 0
|
110
|
+
emit_compacting depth
|
111
|
+
end
|
93
112
|
end
|
94
113
|
|
95
114
|
class Version < Node
|
115
|
+
def emit depth = 0
|
116
|
+
emit_compacting depth
|
117
|
+
end
|
96
118
|
end
|
97
119
|
|
98
120
|
# Uncomment or add whatever class you need to customise:
|
@@ -100,6 +122,10 @@ module KiCad
|
|
100
122
|
# Position Identifier
|
101
123
|
class At < Node
|
102
124
|
value_types :x => Float, :y => Float, :angle => Float
|
125
|
+
|
126
|
+
def emit depth = 0
|
127
|
+
emit_compacting depth
|
128
|
+
end
|
103
129
|
end
|
104
130
|
|
105
131
|
# Coordinate Point List
|
@@ -115,6 +141,10 @@ module KiCad
|
|
115
141
|
# Stroke Definition
|
116
142
|
class Stroke < Node
|
117
143
|
child_types :width, :type, :color
|
144
|
+
|
145
|
+
def emit depth = 0
|
146
|
+
emit_compacting depth
|
147
|
+
end
|
118
148
|
end
|
119
149
|
|
120
150
|
class Width < Node
|
@@ -132,10 +162,26 @@ module KiCad
|
|
132
162
|
# Text Effects
|
133
163
|
class Effects < Node
|
134
164
|
child_types :font, :justify, :hide
|
165
|
+
|
166
|
+
def emit depth = 0
|
167
|
+
if @children.size <= 1
|
168
|
+
emit_compacting depth
|
169
|
+
else
|
170
|
+
super
|
171
|
+
end
|
172
|
+
end
|
135
173
|
end
|
136
174
|
|
137
175
|
class Font < Node
|
138
176
|
child_types :face, :size, :thickness, :bold, :italic, :line_spacing
|
177
|
+
|
178
|
+
def emit depth = 0
|
179
|
+
if @children.size <= 1
|
180
|
+
emit_compacting depth
|
181
|
+
else
|
182
|
+
super
|
183
|
+
end
|
184
|
+
end
|
139
185
|
end
|
140
186
|
|
141
187
|
class Face < Node
|
@@ -232,6 +278,11 @@ module KiCad
|
|
232
278
|
|
233
279
|
class Fill < Node
|
234
280
|
value_types :fill => [:no, :yes]
|
281
|
+
child_types :type
|
282
|
+
|
283
|
+
def emit depth = 0
|
284
|
+
emit_compacting depth
|
285
|
+
end
|
235
286
|
end
|
236
287
|
|
237
288
|
class Arc < Node
|
@@ -366,10 +417,18 @@ module KiCad
|
|
366
417
|
class PinNumbers < Node
|
367
418
|
# This is a child node, not as documented (a value in https://dev-docs.kicad.org/en/file-formats/sexpr-intro/)
|
368
419
|
child_types :hide
|
420
|
+
|
421
|
+
def emit depth = 0
|
422
|
+
emit_compacting depth
|
423
|
+
end
|
369
424
|
end
|
370
425
|
|
371
426
|
class PinNames < Node
|
372
427
|
child_types :offset, :hide
|
428
|
+
|
429
|
+
def emit depth = 0
|
430
|
+
emit_compacting depth
|
431
|
+
end
|
373
432
|
end
|
374
433
|
|
375
434
|
class InBom < Node
|
data/lib/kicad/version.rb
CHANGED