circuitscript 0.0.14 → 0.0.15
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.
- package/.gitlab-ci.yml +22 -19
- package/__tests__/helpers.ts +12 -0
- package/__tests__/renderData/script1.cst.svg +1 -1
- package/__tests__/renderData/script2.cst.svg +1 -1
- package/__tests__/renderData/script3.cst.svg +1 -1
- package/__tests__/renderData/script4.cst +27 -5
- package/__tests__/renderData/script4.cst.svg +1 -1
- package/__tests__/renderData/script5.cst.svg +1 -1
- package/__tests__/testParse.ts +37 -2
- package/build/src/draw_symbols.js +207 -63
- package/build/src/geometry.js +35 -4
- package/build/src/helpers.js +7 -3
- package/build/src/layout.js +30 -17
- package/build/src/regenerate-tests.js +1 -1
- package/build/src/visitor.js +12 -4
- package/examples/example_arduino_uno.cst +390 -120
- package/examples/lib.cst +25 -28
- package/libs/lib.cst +23 -28
- package/package.json +1 -1
- package/src/draw_symbols.ts +270 -64
- package/src/geometry.ts +46 -5
- package/src/helpers.ts +8 -5
- package/src/layout.ts +42 -21
- package/src/regenerate-tests.ts +1 -1
- package/src/visitor.ts +16 -4
package/src/visitor.ts
CHANGED
|
@@ -1352,8 +1352,8 @@ export class MainVisitor extends ParseTreeVisitor<any> {
|
|
|
1352
1352
|
}
|
|
1353
1353
|
|
|
1354
1354
|
if (instance.typeProp === null){
|
|
1355
|
-
this.print('Instance has no type:', instance.instanceName);
|
|
1356
|
-
|
|
1355
|
+
this.print('Instance has no type:', instance.instanceName, ' assuming connector');
|
|
1356
|
+
instance.typeProp = 'conn';
|
|
1357
1357
|
}
|
|
1358
1358
|
|
|
1359
1359
|
if (instance.parameters.has('refdes')) {
|
|
@@ -1569,8 +1569,20 @@ class ComponentAnnotater {
|
|
|
1569
1569
|
}
|
|
1570
1570
|
|
|
1571
1571
|
getAnnotation(type: string): string | null {
|
|
1572
|
-
|
|
1573
|
-
|
|
1572
|
+
|
|
1573
|
+
// If type is unknown, then allow it to define a new range
|
|
1574
|
+
if (this.counter[type] === undefined && type.length <= 2) {
|
|
1575
|
+
for (const [, value] of Object.entries(ComponentRefDesPrefixes)) {
|
|
1576
|
+
if (value === type) {
|
|
1577
|
+
throw "Refdes prefix is already in use!";
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
if (ComponentRefDesPrefixes[type] === undefined) {
|
|
1582
|
+
// Define new type and start counting
|
|
1583
|
+
ComponentRefDesPrefixes[type] = type;
|
|
1584
|
+
this.counter[type] = 1;
|
|
1585
|
+
}
|
|
1574
1586
|
}
|
|
1575
1587
|
|
|
1576
1588
|
let attempts = 100;
|