Skip to content

Commit 269f743

Browse files
committed
merge hdl#10
1 parent 216ce76 commit 269f743

File tree

4 files changed

+51
-51
lines changed

4 files changed

+51
-51
lines changed

hdlparse/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"""Parse Verilog and VHDL files"""
2+
__version__ = '1.1.0'

hdlparse/minilexer.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# -*- coding: utf-8 -*-
22
# Copyright © 2017 Kevin Thibedeau
33
# Distributed under the terms of the MIT license
4+
"""Minimalistic lexer engine inspired by the PyPigments RegexLexer"""
45
import re
56
import logging
67

7-
"""Minimalistic lexer engine inspired by the PyPigments RegexLexer"""
8-
9-
__version__ = '1.0.7'
108

119
log = logging.getLogger(__name__)
12-
handler = logging.StreamHandler()
13-
handler.setFormatter(logging.Formatter('%(name)s - %(levelname)s - %(message)s'))
14-
log.addHandler(handler)
10+
11+
if not log.handlers: # only add the handler if no handlers are already registered
12+
handler = logging.StreamHandler()
13+
handler.setFormatter(logging.Formatter('%(name)s - %(levelname)s - %(message)s'))
14+
log.addHandler(handler)
1515

1616

17-
class MiniLexer(object):
17+
class MiniLexer():
1818
"""Simple lexer state machine with regex matching rules"""
1919

2020
def __init__(self, tokens, flags=re.MULTILINE):
@@ -53,7 +53,7 @@ def run(self, text):
5353
text (str): Text to apply lexer to
5454
5555
Yields:
56-
A sequence of lexer matches.
56+
A sequence of lexer matches
5757
"""
5858

5959
stack = ['root']
@@ -66,7 +66,7 @@ def run(self, text):
6666
m = pat.match(text, pos)
6767
if m:
6868
if action:
69-
log.debug(f"Match: {m.group().strip()} -> {action}")
69+
log.debug("Match: %s -> %s", m.group().strip(), action)
7070

7171
yield (pos, m.end() - 1), action, m.groups()
7272

setup.cfg

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[metadata]
2+
name = hdlparse
3+
author = Kevin Thibedeau
4+
author_email = [email protected]
5+
url = http://kevinpt.github.io/hdlparse
6+
download_url = http://kevinpt.github.io/hdlparse
7+
description = HDL parser
8+
long_description = file: README.rst
9+
description_file = README.rst
10+
version = attr: hdlparse.__version__
11+
license = MIT
12+
keywords = HDL parser
13+
classifiers =
14+
Development Status :: 5 - Production/Stable
15+
Operating System :: OS Independent
16+
Intended Audience :: Developers
17+
Topic :: Text Processing :: General
18+
Natural Language :: English
19+
Programming Language :: Python :: 3
20+
License :: OSI Approved :: MIT License
21+
22+
[options]
23+
packages = hdlparse
24+
py_modules =
25+
install_requires =
26+
include_package_data = True
27+
28+
[pycodestyle]
29+
max_line_length = 120
30+
ignore = E501
31+
32+
[pydocstyle]
33+
ignore = D100,D102,D103,D105,D202,D203,D213,D400,D405,D406,D407,D413,D415
34+
35+
[pylint]
36+
disable =
37+
C0103,C0301,C0103,C0116,R0201,R0801,R0903,R0912,R0913,R0914,R0915,W0702
38+
ignore-docstrings = yes
39+
output-format = colorized

setup.py

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,3 @@
11
from setuptools import setup
22

3-
# Use README.rst for the long description
4-
with open('README.rst') as fh:
5-
long_description = fh.read()
6-
7-
# Scan the script for the version string
8-
version_file = 'hdlparse/minilexer.py'
9-
version = None
10-
with open(version_file) as fh:
11-
try:
12-
version = [line.split('=')[1].strip().strip("'") for line in fh if
13-
line.startswith('__version__')][0]
14-
except IndexError:
15-
pass
16-
17-
if version is None:
18-
raise RuntimeError('Unable to find version string in file: {0}'.format(version_file))
19-
20-
setup(name='hdlparse',
21-
version=version,
22-
author='Kevin Thibedeau',
23-
author_email='[email protected]',
24-
url='http://kevinpt.github.io/hdlparse',
25-
download_url='http://kevinpt.github.io/hdlparse',
26-
description='HDL parser',
27-
long_description=long_description,
28-
platforms=['Any'],
29-
install_requires=[],
30-
packages=['hdlparse'],
31-
py_modules=[],
32-
include_package_data=True,
33-
34-
keywords='HDL parser',
35-
license='MIT',
36-
classifiers=['Development Status :: 5 - Production/Stable',
37-
'Operating System :: OS Independent',
38-
'Intended Audience :: Developers',
39-
'Topic :: Text Processing :: General',
40-
'Natural Language :: English',
41-
'Programming Language :: Python :: 3',
42-
'License :: OSI Approved :: MIT License'
43-
]
44-
)
3+
setup()

0 commit comments

Comments
 (0)