From 29503614cc9ae79eaaf9e1fbbf4df3e6361a3955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1n=20D=C3=A9nes?= Date: Sat, 2 Jan 2021 18:38:57 +0100 Subject: [PATCH] Change indirection and preprocessing symbols --- src/footprints/pad.js | 2 +- src/pcbs.js | 4 ++-- src/prepare.js | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/footprints/pad.js b/src/footprints/pad.js index de51da9..d170537 100644 --- a/src/footprints/pad.js +++ b/src/footprints/pad.js @@ -8,7 +8,7 @@ module.exports = { back: true, text: '', align: 'left', - mirrored: '!mirrored' + mirrored: '=mirrored' }, body: p => { diff --git a/src/pcbs.js b/src/pcbs.js index 15eab05..dcd9385 100644 --- a/src/pcbs.js +++ b/src/pcbs.js @@ -173,7 +173,7 @@ const footprint = exports._footprint = (config, name, points, point, net_indexer for (const net_ref of (fp.nets || [])) { let net = nets[net_ref] a.sane(net, `${name}.nets.${net_ref}`, 'string')() - if (net.startsWith('!') && point) { + if (net.startsWith('=') && point) { const indirect = net.substring(1) net = point.meta[indirect] a.sane(net, `${name}.nets.${net_ref} --> ${point.meta.name}.${indirect}`, 'string')() @@ -187,7 +187,7 @@ const footprint = exports._footprint = (config, name, points, point, net_indexer for (const param of (Object.keys(fp.params || {}))) { let value = params[param] === undefined ? fp.params[param] : params[param] if (value === undefined) throw new Error(`Field "${name}.params.${param}" is missing!`) - if (a.type(value)() == 'string' && value.startsWith('!') && point) { + if (a.type(value)() == 'string' && value.startsWith('=') && point) { const indirect = value.substring(1) value = point.meta[indirect] if (value === undefined) throw new Error(`Field "${name}.params.${param} --> ${point.meta.name}.${indirect}" is missing!`) diff --git a/src/prepare.js b/src/prepare.js index 3f9937f..a27fed9 100644 --- a/src/prepare.js +++ b/src/prepare.js @@ -1,7 +1,7 @@ const u = require('./utils') const a = require('./assert') -const unnest = exports.unnest = (config) => { +const unnest = exports.unnest = config => { if (a.type(config)() !== 'object') return config const result = {} for (const [key, val] of Object.entries(config)) { @@ -14,7 +14,7 @@ const _extend = exports._extend = (to, from) => { const to_type = a.type(to)() const from_type = a.type(from)() if (from === undefined || from === null) return to - if (from === '!!unset') return undefined + if (from === '$unset') return undefined if (to_type != from_type) return from if (from_type == 'object') { const res = u.deepcopy(to) @@ -47,21 +47,21 @@ const _inherit = exports._inherit = (config, root, breadcrumbs) => { for (const [key, val] of Object.entries(config)) { breadcrumbs.push(key) let newval = _inherit(val, root, breadcrumbs) - if (newval && newval.extends !== undefined) { - let candidates = u.deepcopy(newval.extends) + if (newval && newval.$extends !== undefined) { + let candidates = u.deepcopy(newval.$extends) if (a.type(candidates)() !== 'array') candidates = [candidates] const list = [newval] while (candidates.length) { const path = candidates.shift() const other = u.deepcopy(u.deep(root, path)) - a.assert(other, `"${path}" (reached from "${breadcrumbs.join('.')}.extends") does not name a valid inheritance target!`) - let parents = other.extends || [] + a.assert(other, `"${path}" (reached from "${breadcrumbs.join('.')}.$extends") does not name a valid inheritance target!`) + let parents = other.$extends || [] if (a.type(parents)() !== 'array') parents = [parents] candidates = candidates.concat(parents) list.unshift(other) } newval = extend.apply(this, list) - delete newval.extends + delete newval.$extends } result[key] = newval breadcrumbs.pop() @@ -69,4 +69,4 @@ const _inherit = exports._inherit = (config, root, breadcrumbs) => { return result } -const inherit = exports.inherit = (config) => _inherit(config, config, []) +const inherit = exports.inherit = config => _inherit(config, config, [])