OILS / opy / count.sh View on Github | oilshell.org

59 lines, 38 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# ./count.sh <function name>
5
6set -o nounset
7set -o pipefail
8set -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
16all() {
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
55ovm() {
56 wc -l opy/*/ovm*.py
57}
58
59"$@"