1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Usage:
|
4 | # ./count.sh <function name>
|
5 |
|
6 | set -o nounset
|
7 | set -o pipefail
|
8 | set -o errexit
|
9 |
|
10 | _count() {
|
11 | grep -v '_test.py$' | xargs wc -l | sort -n
|
12 | }
|
13 |
|
14 | # 8700 lines for tokenizer -> tokens -> parser -> homogeneous nodes ->
|
15 | # transformer -> ast -> compiler -> byte code
|
16 | all() {
|
17 | echo COMMON
|
18 | echo opy_main.py | _count
|
19 | echo
|
20 |
|
21 | echo GRAMMAR
|
22 | echo py27.grammar | _count
|
23 | echo
|
24 |
|
25 | # ast is generated
|
26 | echo COMPILER2
|
27 | ls compiler2/*.py | grep -v ast.py | _count
|
28 | echo
|
29 |
|
30 | echo STDLIB
|
31 | echo lib/*.py | _count
|
32 | echo
|
33 |
|
34 | echo GENERATED CODE
|
35 | wc -l compiler2/ast.py
|
36 | echo
|
37 |
|
38 | echo BYTERUN
|
39 | ls byterun/*.py | grep -v 'test' | _count
|
40 | echo
|
41 |
|
42 | echo MISC
|
43 | echo {misc,tools}/*.py | _count
|
44 | echo
|
45 |
|
46 | echo UNIT TESTS
|
47 | echo */*_test.py | xargs wc -l | sort -n
|
48 | echo
|
49 |
|
50 | echo SCRIPTS
|
51 | echo *.sh */*.sh | xargs ls | grep -v '^old/' | _count
|
52 | echo
|
53 | }
|
54 |
|
55 | ovm() {
|
56 | wc -l opy/*/ovm*.py
|
57 | }
|
58 |
|
59 | "$@"
|