Skip to content

Commit 9670b59

Browse files
committed
refactoring
1 parent bc6f812 commit 9670b59

6 files changed

+23
-4
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ python:
44
- "3.3"
55
install:
66
install:
7-
- pip install -e . --use-mirrors
8-
- pip install -r dev_requirements.txt --use-mirrors
7+
- pip install -e .
8+
- pip install -r dev_requirements.txt
99
- python setup.py install
1010

1111
script:

Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.PHONY: all tests pep8 pylint deps test-deps publish
2+
13
all: extensive pylint
24
extensive: tests pep8
35

@@ -9,3 +11,10 @@ pep8:
911

1012
pylint:
1113
pylint --rcfile pylintrc lizard.py lizard_ext
14+
15+
deps:
16+
pip install -r dev_requirements.txt
17+
18+
publish:
19+
python setup.py sdist bdist_wheel register upload
20+

dev_requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
pep8
22
pylint
3+
nose

lizard.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from fnmatch import fnmatch
3131
import hashlib
3232

33-
VERSION = "1.8.1"
33+
VERSION = "1.8.2"
3434

3535
DEFAULT_CCN_THRESHOLD = 15
3636

@@ -330,8 +330,8 @@ def generate_tokens(source_code, addition=''):
330330
'*=', '/=', '^=', '&=', '|=']
331331
token_pattern = re.compile(
332332
r"(?:\w+" +
333-
addition +
334333
r"|/\*.*?\*/" +
334+
addition +
335335
r"|\"(?:\\.|[^\"])*\"" +
336336
r"|\'(?:\\.|[^\'])*?\'" +
337337
r"|//" + _until_end +

test/testJavaScript.py

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ class Test_tokenizing_JavaScript(unittest.TestCase):
1111

1212
def check_tokens(self, expect, source):
1313
tokens = list(JavaScriptReader.generate_tokens(source))
14+
if expect != tokens:
15+
print tokens
1416
self.assertEqual(expect, tokens)
1517

1618
def test_tokenizing_javascript_regular_expression(self):
@@ -25,6 +27,8 @@ def test_should_not_confuse_division_as_regx(self):
2527
def test_tokenizing_javascript_regular_expression(self):
2628
self.check_tokens(['a', '=', '/ab/'], 'a=/ab/')
2729

30+
def test_tokenizing_javascript_comments(self):
31+
self.check_tokens(['/**a/*/'], '''/**a/*/''')
2832

2933
class Test_parser_for_JavaScript(unittest.TestCase):
3034

test/testTokenizer.py

+5
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,8 @@ def test_with_c_comments(self):
103103
tokens = generate_tokens('/*abc\n*/ t')
104104
self.assertTrue('t' in tokens)
105105

106+
def test_with_c_comments_with_backslash_in_it(self):
107+
comment = '/**a/*/'
108+
tokens = generate_tokens(comment)
109+
self.assertListEqual([comment], tokens)
110+

0 commit comments

Comments
 (0)