Added some preliminary support for v6 SCHs
- Currently just loads the files - No save implemented - Seems to be enough to generate some trivial BoMs
This commit is contained in:
parent
93f57ff6c6
commit
25d036f8fa
|
|
@ -0,0 +1,685 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# [[[cog import cog; cog.outl('"""\n%s\n"""' % file('README.rst').read()) ]]]
|
||||
"""
|
||||
S-expression parser for Python
|
||||
==============================
|
||||
|
||||
`sexpdata` is a simple S-expression parser/serializer. It has
|
||||
simple `load` and `dump` functions like `pickle`, `json` or `PyYAML`
|
||||
module.
|
||||
|
||||
>>> from sexpdata import loads, dumps
|
||||
>>> loads('("a" "b")')
|
||||
['a', 'b']
|
||||
>>> print(dumps(['a', 'b']))
|
||||
("a" "b")
|
||||
|
||||
|
||||
You can install `sexpdata` from PyPI_::
|
||||
|
||||
pip install sexpdata
|
||||
|
||||
|
||||
Links:
|
||||
|
||||
* `Documentation (at Read the Docs) <http://sexpdata.readthedocs.org/>`_
|
||||
* `Repository (at GitHub) <https://github.com/tkf/sexpdata>`_
|
||||
* `Issue tracker (at GitHub) <https://github.com/tkf/sexpdata/issues>`_
|
||||
* `PyPI <http://pypi.python.org/pypi/sexpdata>`_
|
||||
* `Travis CI <https://travis-ci.org/#!/tkf/sexpdata>`_
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
`sexpdata` is licensed under the terms of the BSD 2-Clause License.
|
||||
See the source code for more information.
|
||||
|
||||
"""
|
||||
# [[[end]]]
|
||||
|
||||
# Copyright (c) 2012 Takafumi Arakaki
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
|
||||
# Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
|
||||
# Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
__version__ = '0.0.4.dev1'
|
||||
__author__ = 'Takafumi Arakaki'
|
||||
__license__ = 'BSD License'
|
||||
__all__ = [
|
||||
# API functions:
|
||||
'load', 'loads', 'dump', 'dumps',
|
||||
# Utility functions:
|
||||
'car', 'cdr',
|
||||
# S-expression classes:
|
||||
'Symbol', 'String', 'Quoted',
|
||||
]
|
||||
|
||||
import re
|
||||
from string import whitespace
|
||||
import functools
|
||||
|
||||
BRACKETS = {'(': ')', '[': ']'}
|
||||
|
||||
|
||||
# ** Generic errors
|
||||
|
||||
class SExpData(Exception):
|
||||
pass
|
||||
|
||||
|
||||
# ** Python 3 compatibility
|
||||
|
||||
try:
|
||||
unicode
|
||||
PY3 = False
|
||||
except NameError:
|
||||
basestring = unicode = str # Python 3
|
||||
PY3 = True
|
||||
|
||||
|
||||
def uformat(s, *args, **kwds):
|
||||
"""Alias of ``unicode(s).format(...)``."""
|
||||
return tounicode(s).format(*args, **kwds)
|
||||
|
||||
|
||||
# ** Utility
|
||||
|
||||
def tounicode(string):
|
||||
"""
|
||||
Decode `string` if it is not unicode. Do nothing in Python 3.
|
||||
"""
|
||||
if not isinstance(string, unicode):
|
||||
string = unicode(string, 'utf-8')
|
||||
return string
|
||||
|
||||
|
||||
def return_as(converter):
|
||||
"""
|
||||
Decorator to convert result of a function.
|
||||
|
||||
It is just a function composition. The following two codes are
|
||||
equivalent.
|
||||
|
||||
Using `@return_as`::
|
||||
|
||||
@return_as(converter)
|
||||
def generator(args):
|
||||
...
|
||||
|
||||
result = generator(args)
|
||||
|
||||
Manually do the same::
|
||||
|
||||
def generator(args):
|
||||
...
|
||||
|
||||
result = converter(generator(args))
|
||||
|
||||
Example:
|
||||
|
||||
>>> @return_as(list)
|
||||
... def f():
|
||||
... for i in range(3):
|
||||
... yield i
|
||||
...
|
||||
>>> f() # this gives a list, not an iterator
|
||||
[0, 1, 2]
|
||||
|
||||
"""
|
||||
def wrapper(generator):
|
||||
@functools.wraps(generator)
|
||||
def func(*args, **kwds):
|
||||
return converter(generator(*args, **kwds))
|
||||
return func
|
||||
return wrapper
|
||||
|
||||
|
||||
# ** Interface
|
||||
|
||||
def load(filelike, **kwds):
|
||||
"""
|
||||
Load object from S-expression stored in `filelike`.
|
||||
|
||||
:arg filelike: A text stream object.
|
||||
|
||||
See :func:`loads` for valid keyword arguments.
|
||||
|
||||
>>> import io
|
||||
>>> fp = io.StringIO()
|
||||
>>> sexp = [Symbol('a'), Symbol('b')] # let's dump and load this object
|
||||
>>> dump(sexp, fp)
|
||||
>>> _ = fp.seek(0)
|
||||
>>> load(fp) == sexp
|
||||
True
|
||||
|
||||
"""
|
||||
return loads(filelike.read(), **kwds)
|
||||
|
||||
|
||||
def loads(string, **kwds):
|
||||
"""
|
||||
Load object from S-expression `string`.
|
||||
|
||||
:arg string: String containing an S-expression.
|
||||
:type nil: str or None
|
||||
:keyword nil: A symbol interpreted as an empty list.
|
||||
Default is ``'nil'``.
|
||||
:type true: str or None
|
||||
:keyword true: A symbol interpreted as True.
|
||||
Default is ``'t'``.
|
||||
:type false: str or None
|
||||
:keyword false: A symbol interpreted as False.
|
||||
Default is ``None``.
|
||||
:type line_comment: str
|
||||
:keyword line_comment: Beginning of line comment.
|
||||
Default is ``';'``.
|
||||
|
||||
>>> loads('(a b)')
|
||||
[Symbol('a'), Symbol('b')]
|
||||
>>> loads('a')
|
||||
Symbol('a')
|
||||
>>> loads('(a \'b)')
|
||||
[Symbol('a'), Quoted(Symbol('b'))]
|
||||
>>> loads('(a \'(b))')
|
||||
[Symbol('a'), Quoted([Symbol('b')])]
|
||||
>>> loads('''
|
||||
... ;; This is a line comment.
|
||||
... 'a' 'b') ; this is also a comment.
|
||||
... ''')
|
||||
['a', 'b']
|
||||
>>> loads('''
|
||||
... # This is a line comment.
|
||||
... ('a' 'b') # this is also a comment.
|
||||
... ''', line_comment='#')
|
||||
['a', 'b']
|
||||
|
||||
``nil`` is converted to an empty list by default. You can use
|
||||
keyword argument `nil` to change what symbol must be interpreted
|
||||
as nil:
|
||||
|
||||
>>> loads('nil')
|
||||
[]
|
||||
>>> loads('null', nil='null')
|
||||
[]
|
||||
>>> loads('nil', nil=None)
|
||||
Symbol('nil')
|
||||
|
||||
``t`` is converted to True by default. You can use keyword
|
||||
argument `true` to change what symbol must be converted to True.:
|
||||
|
||||
>>> loads('t')
|
||||
True
|
||||
>>> loads('#t', true='#t')
|
||||
True
|
||||
>>> loads('t', true=None)
|
||||
Symbol('t')
|
||||
|
||||
No symbol is converted to False by default. You can use keyword
|
||||
argument `false` to convert a symbol to False.
|
||||
|
||||
>>> loads('#f')
|
||||
Symbol('#f')
|
||||
>>> loads('#f', false='#f')
|
||||
False
|
||||
>>> loads('nil', false='nil', nil=None)
|
||||
False
|
||||
|
||||
"""
|
||||
obj = parse(string, **kwds)
|
||||
if len(obj) != 1:
|
||||
raise SExpData("Not an s-expression file")
|
||||
return obj[0]
|
||||
|
||||
|
||||
def dump(obj, filelike, **kwds):
|
||||
"""
|
||||
Write `obj` as an S-expression into given stream `filelike`.
|
||||
|
||||
:arg obj: A Python object.
|
||||
:arg filelike: A text stream object.
|
||||
|
||||
See :func:`dumps` for valid keyword arguments.
|
||||
|
||||
>>> import io
|
||||
>>> fp = io.StringIO()
|
||||
>>> dump([Symbol('a'), Symbol('b')], fp)
|
||||
>>> print(fp.getvalue())
|
||||
(a b)
|
||||
|
||||
"""
|
||||
filelike.write(unicode(dumps(obj)))
|
||||
|
||||
|
||||
def dumps(obj, **kwds):
|
||||
"""
|
||||
Convert python object into an S-expression.
|
||||
|
||||
:arg obj: A Python object.
|
||||
:type str_as: ``'symbol'`` or ``'string'``
|
||||
:keyword str_as: How string should be interpreted.
|
||||
Default is ``'string'``.
|
||||
:type tuple_as: ``'list'`` or ``'array'``
|
||||
:keyword tuple_as: How tuple should be interpreted.
|
||||
Default is ``'list'``.
|
||||
:type true_as: str
|
||||
:keyword true_as: How True should be interpreted.
|
||||
Default is ``'t'``
|
||||
:type false_as: str
|
||||
:keyword false_as: How False should be interpreted.
|
||||
Default is ``'()'``
|
||||
:type none_as: str
|
||||
:keyword none_as: How None should be interpreted.
|
||||
Default is ``'()'``
|
||||
|
||||
Basic usage:
|
||||
|
||||
>>> print(dumps(['a', 'b']))
|
||||
('a' 'b')
|
||||
>>> print(dumps(['a', 'b'], str_as='symbol'))
|
||||
(a b)
|
||||
>>> print(dumps(dict(a=1)))
|
||||
(:a 1)
|
||||
>>> print(dumps([None, True, False, ()]))
|
||||
(() t () ())
|
||||
>>> print(dumps([None, True, False, ()],
|
||||
... none_as='null', true_as='#t', false_as='#f'))
|
||||
(null #t #f ())
|
||||
>>> print(dumps(('a', 'b')))
|
||||
('a' 'b')
|
||||
>>> print(dumps(('a', 'b'), tuple_as='array'))
|
||||
['a' 'b']
|
||||
|
||||
More verbose usage:
|
||||
|
||||
>>> print(dumps([Symbol('a'), Symbol('b')]))
|
||||
(a b)
|
||||
>>> print(dumps(Symbol('a')))
|
||||
a
|
||||
>>> print(dumps([Symbol('a'), Quoted(Symbol('b'))]))
|
||||
(a 'b)
|
||||
>>> print(dumps([Symbol('a'), Quoted([Symbol('b')])]))
|
||||
(a '(b))
|
||||
|
||||
"""
|
||||
return tosexp(obj, **kwds)
|
||||
|
||||
|
||||
def car(obj):
|
||||
"""
|
||||
Alias of ``obj[0]``.
|
||||
|
||||
>>> car(loads('(a . b)'))
|
||||
Symbol('a')
|
||||
>>> car(loads('(a b)'))
|
||||
Symbol('a')
|
||||
|
||||
"""
|
||||
return obj[0]
|
||||
|
||||
|
||||
def cdr(obj):
|
||||
"""
|
||||
`cdr`-like function.
|
||||
|
||||
>>> cdr(loads('(a . b)'))
|
||||
Symbol('b')
|
||||
>>> cdr(loads('(a b)'))
|
||||
[Symbol('b')]
|
||||
>>> cdr(loads('(a . (b))'))
|
||||
[Symbol('b')]
|
||||
>>> cdr(loads('(a)'))
|
||||
[]
|
||||
>>> cdr(loads('(a . nil)'))
|
||||
[]
|
||||
|
||||
"""
|
||||
# This is very lazy implementation. Probably the best way to do
|
||||
# it is to define `Cons` S-expression class.
|
||||
if len(obj) > 2:
|
||||
dot = obj[1]
|
||||
if isinstance(dot, Symbol) and dot.value() == '.':
|
||||
return obj[2]
|
||||
return obj[1:]
|
||||
|
||||
|
||||
# ** Core
|
||||
|
||||
def tosexp(obj, str_as='string', tuple_as='list',
|
||||
true_as='t', false_as='()', none_as='()'):
|
||||
"""
|
||||
Convert an object to an S-expression (`dumps` is just calling this).
|
||||
|
||||
See this table for comparison of lispy languages, to support them
|
||||
as much as possible:
|
||||
`Lisp: Common Lisp, Scheme/Racket, Clojure, Emacs Lisp - Hyperpolyglot
|
||||
<http://hyperpolyglot.org/lisp>`_
|
||||
|
||||
"""
|
||||
def _tosexp(x):
|
||||
tosexp(x, str_as=str_as, tuple_as=tuple_as, true_as=true_as, false_as=false_as, none_as=none_as)
|
||||
|
||||
if isinstance(obj, list):
|
||||
return Bracket(obj, '(').tosexp(_tosexp)
|
||||
elif isinstance(obj, tuple):
|
||||
if tuple_as == 'list':
|
||||
return Bracket(obj, '(').tosexp(_tosexp)
|
||||
elif tuple_as == 'array':
|
||||
return Bracket(obj, '[').tosexp(_tosexp)
|
||||
else:
|
||||
raise ValueError(uformat("tuple_as={0!r} is not valid", tuple_as))
|
||||
elif obj is True: # must do this before ``isinstance(obj, int)``
|
||||
return true_as
|
||||
elif obj is False:
|
||||
return false_as
|
||||
elif obj is None:
|
||||
return none_as
|
||||
elif isinstance(obj, (int, float)):
|
||||
return str(obj)
|
||||
elif isinstance(obj, basestring):
|
||||
if str_as == 'symbol':
|
||||
return obj
|
||||
elif str_as == 'string':
|
||||
return String(obj).tosexp()
|
||||
else:
|
||||
raise ValueError(uformat("str_as={0!r} is not valid", str_as))
|
||||
elif isinstance(obj, dict):
|
||||
return _tosexp(dict_to_plist(obj))
|
||||
elif isinstance(obj, SExpBase):
|
||||
return obj.tosexp(_tosexp)
|
||||
else:
|
||||
raise TypeError(uformat(
|
||||
"Object of type '{0}' cannot be converted by `tosexp`. "
|
||||
"It's value is '{1!r}'", type(obj), obj))
|
||||
|
||||
|
||||
@return_as(list)
|
||||
def dict_to_plist(obj):
|
||||
for key in obj:
|
||||
yield Symbol(uformat(":{0}", key))
|
||||
yield obj[key]
|
||||
|
||||
|
||||
class SExpBase(object):
|
||||
|
||||
def __init__(self, val):
|
||||
self._val = val
|
||||
|
||||
def __repr__(self):
|
||||
return uformat("{0}({1!r})", self.__class__.__name__, self._val)
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, self.__class__):
|
||||
return self._val == other._val
|
||||
else:
|
||||
return False
|
||||
|
||||
def value(self):
|
||||
return self._val
|
||||
|
||||
def tosexp(self, tosexp=tosexp):
|
||||
"""
|
||||
Decode this object into an S-expression string.
|
||||
|
||||
:arg tosexp: A function to be used when converting sub S-expression.
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@classmethod
|
||||
def quote(cls, string):
|
||||
for (s, q) in cls._lisp_quoted_specials:
|
||||
string = string.replace(s, q)
|
||||
return tounicode(string)
|
||||
|
||||
@classmethod
|
||||
def unquote(cls, string):
|
||||
return cls._lisp_quoted_to_raw.get(string, string)
|
||||
|
||||
|
||||
class Symbol(SExpBase):
|
||||
|
||||
_lisp_quoted_specials = [
|
||||
('\\', '\\\\'), # must come first to avoid doubly quoting "\"
|
||||
("'", r"\'"), ("`", r"\`"), ('"', r'\"'),
|
||||
('(', r'\('), (')', r'\)'), ('[', r'\['), (']', r'\]'),
|
||||
(' ', r'\ '), ('.', r'\.'), (',', r'\,'), ('?', r'\?'),
|
||||
(';', r'\;'), ('#', r'\#'),
|
||||
]
|
||||
|
||||
_lisp_quoted_to_raw = dict((q, r) for (r, q) in _lisp_quoted_specials)
|
||||
|
||||
def tosexp(self, tosexp=None):
|
||||
return self.quote(self._val)
|
||||
|
||||
|
||||
class String(SExpBase):
|
||||
|
||||
_lisp_quoted_specials = [ # from Pymacs
|
||||
('\\', '\\\\'), # must come first to avoid doubly quoting "\"
|
||||
('"', '\\"'), ('\b', '\\b'), ('\f', '\\f'),
|
||||
('\n', '\\n'), ('\r', '\\r'), ('\t', '\\t')]
|
||||
|
||||
_lisp_quoted_to_raw = dict((q, r) for (r, q) in _lisp_quoted_specials)
|
||||
|
||||
def tosexp(self, tosexp=None):
|
||||
return uformat('"{0}"', self.quote(self._val))
|
||||
|
||||
|
||||
class Quoted(SExpBase):
|
||||
|
||||
def tosexp(self, tosexp=tosexp):
|
||||
return uformat("'{0}", tosexp(self._val))
|
||||
|
||||
|
||||
class Bracket(SExpBase):
|
||||
|
||||
def __init__(self, val, bra):
|
||||
assert bra in BRACKETS # FIXME: raise an appropriate error
|
||||
super(Bracket, self).__init__(val)
|
||||
self._bra = bra
|
||||
|
||||
def __repr__(self):
|
||||
return uformat("{0}({1!r}, {2!r})",
|
||||
self.__class__.__name__, self._val, self._bra)
|
||||
|
||||
def tosexp(self, tosexp=tosexp):
|
||||
bra = self._bra
|
||||
ket = BRACKETS[self._bra]
|
||||
c = ' '.join(tosexp(v) for v in self._val)
|
||||
return uformat("{0}{1}{2}", bra, c, ket)
|
||||
|
||||
|
||||
def bracket(val, bra):
|
||||
if bra == '(':
|
||||
return val
|
||||
else:
|
||||
return Bracket(val, bra)
|
||||
|
||||
|
||||
class ExpectClosingBracket(Exception):
|
||||
|
||||
def __init__(self, got, expect):
|
||||
super(ExpectClosingBracket, self).__init__(uformat(
|
||||
"Not enough closing brackets. "
|
||||
"Expected {0!r} to be the last letter in the sexp. "
|
||||
"Got: {1!r}", expect, got))
|
||||
|
||||
|
||||
class ExpectNothing(Exception):
|
||||
|
||||
def __init__(self, got):
|
||||
super(ExpectNothing, self).__init__(uformat(
|
||||
"Too many closing brackets. "
|
||||
"Expected no character left in the sexp. "
|
||||
"Got: {0!r}", got))
|
||||
|
||||
|
||||
class Parser(object):
|
||||
|
||||
closing_brackets = set(BRACKETS.values())
|
||||
_atom_end_basic = set(BRACKETS) | set(closing_brackets) | set('"\'') | set(whitespace)
|
||||
_atom_end_basic_or_escape_regexp = "|".join(map(re.escape,
|
||||
_atom_end_basic | set('\\')))
|
||||
quote_or_escape_re = re.compile(r'"|\\')
|
||||
|
||||
def __init__(self, string, string_to=None, nil='nil', true='t', false=None,
|
||||
line_comment=';'):
|
||||
self.string = string
|
||||
self.nil = nil
|
||||
self.true = true
|
||||
self.false = false
|
||||
self.string_to = (lambda x: x) if string_to is None else string_to
|
||||
self.line_comment = line_comment
|
||||
self.atom_end = set([line_comment]) | self._atom_end_basic
|
||||
self.atom_end_or_escape_re = re.compile("{0}|{1}".format(self._atom_end_basic_or_escape_regexp,
|
||||
re.escape(line_comment)))
|
||||
|
||||
def parse_str(self, i):
|
||||
string = self.string
|
||||
chars = []
|
||||
append = chars.append
|
||||
search = self.quote_or_escape_re.search
|
||||
|
||||
assert string[i] == '"' # never fail
|
||||
while True:
|
||||
i += 1
|
||||
match = search(string, i)
|
||||
end = match.start()
|
||||
append(string[i:end])
|
||||
c = match.group()
|
||||
if c == '"':
|
||||
i = end + 1
|
||||
break
|
||||
elif c == '\\':
|
||||
i = end + 1
|
||||
append(String.unquote(c + string[i]))
|
||||
else:
|
||||
raise ExpectClosingBracket('"', None)
|
||||
return (i, ''.join(chars))
|
||||
|
||||
def parse_atom(self, i):
|
||||
string = self.string
|
||||
chars = []
|
||||
append = chars.append
|
||||
search = self.atom_end_or_escape_re.search
|
||||
atom_end = self.atom_end
|
||||
|
||||
while True:
|
||||
match = search(string, i)
|
||||
if not match:
|
||||
append(string[i:])
|
||||
i = len(string)
|
||||
break
|
||||
end = match.start()
|
||||
append(string[i:end])
|
||||
c = match.group()
|
||||
if c in atom_end:
|
||||
i = end # this is different from str
|
||||
break
|
||||
elif c == '\\':
|
||||
i = end + 1
|
||||
append(Symbol.unquote(c + string[i]))
|
||||
i += 1
|
||||
else:
|
||||
raise ExpectClosingBracket('"', None)
|
||||
return (i, self.atom(''.join(chars)))
|
||||
|
||||
def atom(self, token):
|
||||
if token == self.nil:
|
||||
return []
|
||||
if token == self.true:
|
||||
return True
|
||||
if token == self.false:
|
||||
return False
|
||||
try:
|
||||
return int(token)
|
||||
except ValueError:
|
||||
try:
|
||||
return float(token)
|
||||
except ValueError:
|
||||
return Symbol(token)
|
||||
|
||||
def parse_sexp(self, i):
|
||||
string = self.string
|
||||
len_string = len(self.string)
|
||||
sexp = []
|
||||
append = sexp.append
|
||||
while i < len_string:
|
||||
c = string[i]
|
||||
if c == '"':
|
||||
(i, subsexp) = self.parse_str(i)
|
||||
append(self.string_to(subsexp))
|
||||
elif c in whitespace:
|
||||
i += 1
|
||||
continue
|
||||
elif c in BRACKETS:
|
||||
close = BRACKETS[c]
|
||||
(i, subsexp) = self.parse_sexp(i + 1)
|
||||
append(bracket(subsexp, c))
|
||||
try:
|
||||
nc = string[i]
|
||||
except IndexError:
|
||||
nc = None
|
||||
if nc != close:
|
||||
raise ExpectClosingBracket(nc, close)
|
||||
i += 1
|
||||
elif c in self.closing_brackets:
|
||||
break
|
||||
elif c == "'":
|
||||
(i, subsexp) = self.parse_sexp(i + 1)
|
||||
append(Quoted(subsexp[0]))
|
||||
sexp.extend(subsexp[1:])
|
||||
elif c == self.line_comment:
|
||||
i = string.find('\n', i) + 1
|
||||
if i <= 0:
|
||||
i = len_string
|
||||
break
|
||||
else:
|
||||
(i, subsexp) = self.parse_atom(i)
|
||||
append(subsexp)
|
||||
return (i, sexp)
|
||||
|
||||
def parse(self):
|
||||
(i, sexp) = self.parse_sexp(0)
|
||||
if i < len(self.string):
|
||||
raise ExpectNothing(self.string[i:])
|
||||
return sexp
|
||||
|
||||
|
||||
def parse(string, **kwds):
|
||||
"""
|
||||
Parse s-expression.
|
||||
|
||||
>>> parse('(a b)')
|
||||
[[Symbol('a'), Symbol('b')]]
|
||||
>>> parse('a')
|
||||
[Symbol('a')]
|
||||
>>> parse('(a \'b)')
|
||||
[[Symbol('a'), Quoted(Symbol('b'))]]
|
||||
>>> parse('(a \'(b))')
|
||||
[[Symbol('a'), Quoted([Symbol('b')])]]
|
||||
|
||||
"""
|
||||
return Parser(string, **kwds).parse()
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -27,7 +27,8 @@ from .misc import (PLOT_ERROR, MISSING_TOOL, CMD_EESCHEMA_DO, URL_EESCHEMA_DO, C
|
|||
W_KIAUTO)
|
||||
from .error import PlotError, KiPlotConfigurationError, config_error, trace_dump
|
||||
from .pre_base import BasePreFlight
|
||||
from .kicad.v5_sch import Schematic, SchFileError
|
||||
from .kicad.v5_sch import Schematic, SchFileError, SchError
|
||||
from .kicad.v6_sch import SchematicV6
|
||||
from .kicad.config import KiConfError
|
||||
from . import log
|
||||
|
||||
|
|
@ -246,6 +247,14 @@ def load_sch():
|
|||
GS.check_sch()
|
||||
# We can't yet load the new format
|
||||
if GS.sch_file[-9:] == 'kicad_sch':
|
||||
GS.sch = SchematicV6()
|
||||
try:
|
||||
GS.sch.load(GS.sch_file, GS.sch_basename)
|
||||
except SchError as e:
|
||||
trace_dump()
|
||||
logger.error('While loading `{}`'.format(GS.sch_file))
|
||||
logger.error(str(e))
|
||||
exit(CORRUPTED_SCH)
|
||||
return # pragma: no cover (Ki6)
|
||||
GS.sch = Schematic()
|
||||
load_any_sch(GS.sch, GS.sch_file, GS.sch_basename)
|
||||
|
|
|
|||
|
|
@ -213,6 +213,7 @@ W_NOGLOBALS = '(W072) '
|
|||
W_EMPTREP = '(W073) '
|
||||
W_BADCHARS = '(W074) '
|
||||
W_DATEFORMAT = '(W075) '
|
||||
W_UNKFLD = '(W076) '
|
||||
|
||||
|
||||
class Rect(object):
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
(kicad_sch (version 20211123) (generator eeschema)
|
||||
|
||||
(uuid 3b838d52-596d-4e4d-a6ac-e4c8e7621137)
|
||||
|
||||
(paper "A4")
|
||||
|
||||
(lib_symbols
|
||||
(symbol "Device:R" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board yes)
|
||||
(property "Reference" "R" (id 0) (at 2.032 0 90)
|
||||
(effects (font (size 1.27 1.27)))
|
||||
)
|
||||
(property "Value" "R" (id 1) (at 0 0 90)
|
||||
(effects (font (size 1.27 1.27)))
|
||||
)
|
||||
(property "Footprint" "" (id 2) (at -1.778 0 90)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "~" (id 3) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "ki_keywords" "R res resistor" (id 4) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "ki_description" "Resistor" (id 5) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "ki_fp_filters" "R_*" (id 6) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(symbol "R_0_1"
|
||||
(rectangle (start -1.016 -2.54) (end 1.016 2.54)
|
||||
(stroke (width 0.254) (type default) (color 0 0 0 0))
|
||||
(fill (type none))
|
||||
)
|
||||
)
|
||||
(symbol "R_1_1"
|
||||
(pin passive line (at 0 3.81 270) (length 1.27)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "1" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
(pin passive line (at 0 -3.81 90) (length 1.27)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "2" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(symbol (lib_id "Device:R") (at 139.7 80.01 0)
|
||||
(in_bom yes) (on_board yes)
|
||||
(uuid 00000000-0000-0000-0000-00005f3bbcff)
|
||||
(property "Reference" "R3" (id 0) (at 141.478 78.8416 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
)
|
||||
(property "Value" "1m" (id 1) (at 141.478 81.153 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
)
|
||||
(property "Footprint" "" (id 2) (at 137.922 80.01 90)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "~" (id 3) (at 139.7 80.01 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(pin "1" (uuid c8dca1a6-f09a-4305-804d-2295b5448f55))
|
||||
(pin "2" (uuid 4dec140a-3f2f-4b17-b6f0-89a0fc1cf30b))
|
||||
)
|
||||
)
|
||||
|
|
@ -0,0 +1,455 @@
|
|||
(kicad_sch (version 20211123) (generator eeschema)
|
||||
|
||||
(uuid 5b2b5c7d-f943-4634-9f0a-e9561705c49d)
|
||||
|
||||
(paper "A4")
|
||||
|
||||
(lib_symbols
|
||||
(symbol "74xx:74LS04" (in_bom yes) (on_board yes)
|
||||
(property "Reference" "U" (id 0) (at 0 1.27 0)
|
||||
(effects (font (size 1.27 1.27)))
|
||||
)
|
||||
(property "Value" "74LS04" (id 1) (at 0 -1.27 0)
|
||||
(effects (font (size 1.27 1.27)))
|
||||
)
|
||||
(property "Footprint" "" (id 2) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "http://www.ti.com/lit/gpn/sn74LS04" (id 3) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "ki_locked" "" (id 4) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)))
|
||||
)
|
||||
(property "ki_keywords" "TTL not inv" (id 5) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "ki_description" "Hex Inverter" (id 6) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "ki_fp_filters" "DIP*W7.62mm* SSOP?14* TSSOP?14*" (id 7) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(symbol "74LS04_1_0"
|
||||
(polyline
|
||||
(pts
|
||||
(xy -3.81 3.81)
|
||||
(xy -3.81 -3.81)
|
||||
(xy 3.81 0)
|
||||
(xy -3.81 3.81)
|
||||
)
|
||||
(stroke (width 0.254) (type default) (color 0 0 0 0))
|
||||
(fill (type background))
|
||||
)
|
||||
(pin input line (at -7.62 0 0) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "1" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
(pin output inverted (at 7.62 0 180) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "2" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
)
|
||||
(symbol "74LS04_2_0"
|
||||
(polyline
|
||||
(pts
|
||||
(xy -3.81 3.81)
|
||||
(xy -3.81 -3.81)
|
||||
(xy 3.81 0)
|
||||
(xy -3.81 3.81)
|
||||
)
|
||||
(stroke (width 0.254) (type default) (color 0 0 0 0))
|
||||
(fill (type background))
|
||||
)
|
||||
(pin input line (at -7.62 0 0) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "3" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
(pin output inverted (at 7.62 0 180) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "4" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
)
|
||||
(symbol "74LS04_3_0"
|
||||
(polyline
|
||||
(pts
|
||||
(xy -3.81 3.81)
|
||||
(xy -3.81 -3.81)
|
||||
(xy 3.81 0)
|
||||
(xy -3.81 3.81)
|
||||
)
|
||||
(stroke (width 0.254) (type default) (color 0 0 0 0))
|
||||
(fill (type background))
|
||||
)
|
||||
(pin input line (at -7.62 0 0) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "5" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
(pin output inverted (at 7.62 0 180) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "6" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
)
|
||||
(symbol "74LS04_4_0"
|
||||
(polyline
|
||||
(pts
|
||||
(xy -3.81 3.81)
|
||||
(xy -3.81 -3.81)
|
||||
(xy 3.81 0)
|
||||
(xy -3.81 3.81)
|
||||
)
|
||||
(stroke (width 0.254) (type default) (color 0 0 0 0))
|
||||
(fill (type background))
|
||||
)
|
||||
(pin output inverted (at 7.62 0 180) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "8" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
(pin input line (at -7.62 0 0) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "9" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
)
|
||||
(symbol "74LS04_5_0"
|
||||
(polyline
|
||||
(pts
|
||||
(xy -3.81 3.81)
|
||||
(xy -3.81 -3.81)
|
||||
(xy 3.81 0)
|
||||
(xy -3.81 3.81)
|
||||
)
|
||||
(stroke (width 0.254) (type default) (color 0 0 0 0))
|
||||
(fill (type background))
|
||||
)
|
||||
(pin output inverted (at 7.62 0 180) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "10" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
(pin input line (at -7.62 0 0) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "11" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
)
|
||||
(symbol "74LS04_6_0"
|
||||
(polyline
|
||||
(pts
|
||||
(xy -3.81 3.81)
|
||||
(xy -3.81 -3.81)
|
||||
(xy 3.81 0)
|
||||
(xy -3.81 3.81)
|
||||
)
|
||||
(stroke (width 0.254) (type default) (color 0 0 0 0))
|
||||
(fill (type background))
|
||||
)
|
||||
(pin output inverted (at 7.62 0 180) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "12" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
(pin input line (at -7.62 0 0) (length 3.81)
|
||||
(name "~" (effects (font (size 1.27 1.27))))
|
||||
(number "13" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
)
|
||||
(symbol "74LS04_7_0"
|
||||
(pin power_in line (at 0 12.7 270) (length 5.08)
|
||||
(name "VCC" (effects (font (size 1.27 1.27))))
|
||||
(number "14" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
(pin power_in line (at 0 -12.7 90) (length 5.08)
|
||||
(name "GND" (effects (font (size 1.27 1.27))))
|
||||
(number "7" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
)
|
||||
(symbol "74LS04_7_1"
|
||||
(rectangle (start -5.08 7.62) (end 5.08 -7.62)
|
||||
(stroke (width 0.254) (type default) (color 0 0 0 0))
|
||||
(fill (type background))
|
||||
)
|
||||
)
|
||||
)
|
||||
(symbol "power:GND" (power) (pin_names (offset 0)) (in_bom yes) (on_board yes)
|
||||
(property "Reference" "#PWR" (id 0) (at 0 -6.35 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Value" "GND" (id 1) (at 0 -3.81 0)
|
||||
(effects (font (size 1.27 1.27)))
|
||||
)
|
||||
(property "Footprint" "" (id 2) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "" (id 3) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "ki_keywords" "power-flag" (id 4) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "ki_description" "Power symbol creates a global label with name \"GND\" , ground" (id 5) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(symbol "GND_0_1"
|
||||
(polyline
|
||||
(pts
|
||||
(xy 0 0)
|
||||
(xy 0 -1.27)
|
||||
(xy 1.27 -1.27)
|
||||
(xy 0 -2.54)
|
||||
(xy -1.27 -1.27)
|
||||
(xy 0 -1.27)
|
||||
)
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(fill (type none))
|
||||
)
|
||||
)
|
||||
(symbol "GND_1_1"
|
||||
(pin power_in line (at 0 0 270) (length 0) hide
|
||||
(name "GND" (effects (font (size 1.27 1.27))))
|
||||
(number "1" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
)
|
||||
)
|
||||
(symbol "power:VCC" (power) (pin_names (offset 0)) (in_bom yes) (on_board yes)
|
||||
(property "Reference" "#PWR" (id 0) (at 0 -3.81 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Value" "VCC" (id 1) (at 0 3.81 0)
|
||||
(effects (font (size 1.27 1.27)))
|
||||
)
|
||||
(property "Footprint" "" (id 2) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "" (id 3) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "ki_keywords" "power-flag" (id 4) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "ki_description" "Power symbol creates a global label with name \"VCC\"" (id 5) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(symbol "VCC_0_1"
|
||||
(polyline
|
||||
(pts
|
||||
(xy -0.762 1.27)
|
||||
(xy 0 2.54)
|
||||
)
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(fill (type none))
|
||||
)
|
||||
(polyline
|
||||
(pts
|
||||
(xy 0 0)
|
||||
(xy 0 2.54)
|
||||
)
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(fill (type none))
|
||||
)
|
||||
(polyline
|
||||
(pts
|
||||
(xy 0 2.54)
|
||||
(xy 0.762 1.27)
|
||||
)
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(fill (type none))
|
||||
)
|
||||
)
|
||||
(symbol "VCC_1_1"
|
||||
(pin power_in line (at 0 0 90) (length 0) hide
|
||||
(name "VCC" (effects (font (size 1.27 1.27))))
|
||||
(number "1" (effects (font (size 1.27 1.27))))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(wire (pts (xy 104.14 63.5) (xy 106.68 63.5))
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid 10109f84-4940-47f8-8640-91f185ac9bc1)
|
||||
)
|
||||
(wire (pts (xy 175.26 63.5) (xy 177.8 63.5))
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid 47baf4b1-0938-497d-88f9-671136aa8be7)
|
||||
)
|
||||
(wire (pts (xy 121.92 63.5) (xy 124.46 63.5))
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid 55e740a3-0735-4744-896e-2bf5437093b9)
|
||||
)
|
||||
(wire (pts (xy 157.48 63.5) (xy 160.02 63.5))
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid c022004a-c968-410e-b59e-fbab0e561e9d)
|
||||
)
|
||||
(wire (pts (xy 193.04 63.5) (xy 195.58 63.5))
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid e615f7aa-337e-474d-9615-2ad82b1c44ca)
|
||||
)
|
||||
(wire (pts (xy 85.09 63.5) (xy 88.9 63.5))
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid ef8fe2ac-6a7f-4682-9418-b801a1b10a3b)
|
||||
)
|
||||
(wire (pts (xy 139.7 63.5) (xy 142.24 63.5))
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(uuid f4f99e3d-7269-4f6a-a759-16ad2a258779)
|
||||
)
|
||||
|
||||
(hierarchical_label "IN" (shape input) (at 85.09 63.5 180)
|
||||
(effects (font (size 1.27 1.27)) (justify right))
|
||||
(uuid 4fb02e58-160a-4a39-9f22-d0c75e82ee72)
|
||||
)
|
||||
(hierarchical_label "OUT" (shape output) (at 195.58 63.5 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
(uuid 77ed3941-d133-4aef-a9af-5a39322d14eb)
|
||||
)
|
||||
|
||||
(symbol (lib_id "74xx:74LS04") (at 96.52 63.5 0)
|
||||
(in_bom yes) (on_board yes)
|
||||
(uuid 00000000-0000-0000-0000-00005f34307a)
|
||||
(property "Reference" "U1" (id 0) (at 96.52 55.4482 0))
|
||||
(property "Value" "74LS04" (id 1) (at 96.52 57.7596 0))
|
||||
(property "Footprint" "" (id 2) (at 96.52 63.5 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "http://www.ti.com/lit/gpn/sn74LS04" (id 3) (at 96.52 63.5 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(pin "1" (uuid f1e9ac99-f8d4-4d05-beb3-290dccb8d277))
|
||||
(pin "2" (uuid 014c98b2-ac35-4831-825d-74c6fa5ddc67))
|
||||
)
|
||||
|
||||
(symbol (lib_id "74xx:74LS04") (at 114.3 63.5 0)
|
||||
(in_bom yes) (on_board yes)
|
||||
(uuid 00000000-0000-0000-0000-00005f344a0e)
|
||||
(property "Reference" "U1" (id 0) (at 114.3 55.4482 0))
|
||||
(property "Value" "74LS04" (id 1) (at 114.3 57.7596 0))
|
||||
(property "Footprint" "" (id 2) (at 114.3 63.5 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "http://www.ti.com/lit/gpn/sn74LS04" (id 3) (at 114.3 63.5 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(pin "3" (uuid c1630947-26ec-4031-96dd-f1cdf939d3a7))
|
||||
(pin "4" (uuid e2858b6c-d9d5-4bfd-a26d-d7110c9ff81c))
|
||||
)
|
||||
|
||||
(symbol (lib_id "74xx:74LS04") (at 132.08 63.5 0)
|
||||
(in_bom yes) (on_board yes)
|
||||
(uuid 00000000-0000-0000-0000-00005f345e39)
|
||||
(property "Reference" "U1" (id 0) (at 132.08 55.4482 0))
|
||||
(property "Value" "74LS04" (id 1) (at 132.08 57.7596 0))
|
||||
(property "Footprint" "" (id 2) (at 132.08 63.5 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "http://www.ti.com/lit/gpn/sn74LS04" (id 3) (at 132.08 63.5 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(pin "5" (uuid 9a609661-5895-4db4-a600-14bffdacc16e))
|
||||
(pin "6" (uuid f6c777f1-b4a6-4529-9b29-67dfedcb1744))
|
||||
)
|
||||
|
||||
(symbol (lib_id "74xx:74LS04") (at 149.86 63.5 0)
|
||||
(in_bom yes) (on_board yes)
|
||||
(uuid 00000000-0000-0000-0000-00005f346e8b)
|
||||
(property "Reference" "U1" (id 0) (at 149.86 55.4482 0))
|
||||
(property "Value" "74LS04" (id 1) (at 149.86 57.7596 0))
|
||||
(property "Footprint" "" (id 2) (at 149.86 63.5 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "http://www.ti.com/lit/gpn/sn74LS04" (id 3) (at 149.86 63.5 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(pin "8" (uuid 47d49bdd-bacb-468f-bcfb-647fd9ccff38))
|
||||
(pin "9" (uuid 71c84a4a-5d81-46df-a82f-84ff433708b7))
|
||||
)
|
||||
|
||||
(symbol (lib_id "74xx:74LS04") (at 167.64 63.5 0)
|
||||
(in_bom yes) (on_board yes)
|
||||
(uuid 00000000-0000-0000-0000-00005f348270)
|
||||
(property "Reference" "U1" (id 0) (at 167.64 55.4482 0))
|
||||
(property "Value" "74LS04" (id 1) (at 167.64 57.7596 0))
|
||||
(property "Footprint" "" (id 2) (at 167.64 63.5 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "http://www.ti.com/lit/gpn/sn74LS04" (id 3) (at 167.64 63.5 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(pin "10" (uuid 01fec0dc-78cf-4a7d-851f-e24a9edd4a86))
|
||||
(pin "11" (uuid 92e30d01-6115-49a3-bead-4b8b74d533c9))
|
||||
)
|
||||
|
||||
(symbol (lib_id "74xx:74LS04") (at 185.42 63.5 0)
|
||||
(in_bom yes) (on_board yes)
|
||||
(uuid 00000000-0000-0000-0000-00005f348d95)
|
||||
(property "Reference" "U1" (id 0) (at 185.42 55.4482 0))
|
||||
(property "Value" "74LS04" (id 1) (at 185.42 57.7596 0))
|
||||
(property "Footprint" "" (id 2) (at 185.42 63.5 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "http://www.ti.com/lit/gpn/sn74LS04" (id 3) (at 185.42 63.5 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(pin "12" (uuid b9a8ff4c-342a-4f44-bfb4-1b1895e9679b))
|
||||
(pin "13" (uuid 29941c34-ddd5-4a9c-bdef-5bf81398f604))
|
||||
)
|
||||
|
||||
(symbol (lib_id "74xx:74LS04") (at 139.7 88.9 0)
|
||||
(in_bom yes) (on_board yes)
|
||||
(uuid 00000000-0000-0000-0000-00005f34a12f)
|
||||
(property "Reference" "U1" (id 0) (at 145.542 87.7316 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
)
|
||||
(property "Value" "74LS04" (id 1) (at 145.542 90.043 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left))
|
||||
)
|
||||
(property "Footprint" "" (id 2) (at 139.7 88.9 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "http://www.ti.com/lit/gpn/sn74LS04" (id 3) (at 139.7 88.9 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(pin "14" (uuid bf0862f0-7b4d-4da4-a5e8-91a9bdbee56f))
|
||||
(pin "7" (uuid 0639e567-d45a-4c84-98fa-a167b211ae20))
|
||||
)
|
||||
|
||||
(symbol (lib_id "power:VCC") (at 139.7 76.2 0)
|
||||
(in_bom yes) (on_board yes)
|
||||
(uuid 00000000-0000-0000-0000-00005f34bc05)
|
||||
(property "Reference" "#PWR01" (id 0) (at 139.7 80.01 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Value" "VCC" (id 1) (at 140.081 71.8058 0))
|
||||
(property "Footprint" "" (id 2) (at 139.7 76.2 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "" (id 3) (at 139.7 76.2 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(pin "1" (uuid 0030af45-9cbd-4108-9b0f-2e3885996ada))
|
||||
)
|
||||
|
||||
(symbol (lib_id "power:GND") (at 139.7 101.6 0)
|
||||
(in_bom yes) (on_board yes)
|
||||
(uuid 00000000-0000-0000-0000-00005f34c535)
|
||||
(property "Reference" "#PWR02" (id 0) (at 139.7 107.95 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Value" "GND" (id 1) (at 139.827 105.9942 0))
|
||||
(property "Footprint" "" (id 2) (at 139.7 101.6 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "" (id 3) (at 139.7 101.6 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(pin "1" (uuid 03d3f3dc-57cc-4a5d-b588-5d7b6cd2d907))
|
||||
)
|
||||
|
||||
(sheet (at 114.3 127) (size 25.4 12.7) (fields_autoplaced)
|
||||
(stroke (width 0) (type solid) (color 0 0 0 0))
|
||||
(fill (color 0 0 0 0.0000))
|
||||
(uuid 00000000-0000-0000-0000-00005f3bb8bb)
|
||||
(property "Sheet name" "Deeper test" (id 0) (at 114.3 126.2884 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left bottom))
|
||||
)
|
||||
(property "Sheet file" "deeper.kicad_sch" (id 1) (at 114.3 140.2846 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left top))
|
||||
)
|
||||
)
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue