forked from github/CodeSearchNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser_cli.py
More file actions
25 lines (19 loc) · 746 Bytes
/
Copy pathparser_cli.py
File metadata and controls
25 lines (19 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""
Usage:
parser_cli.py [options] INPUT_FILEPATH
Options:
-h --help
--language LANGUAGE Language
"""
import json
from docopt import docopt
from tree_sitter import Language
from language_data import LANGUAGE_METADATA
from process import DataProcessor
if __name__ == '__main__':
args = docopt(__doc__)
DataProcessor.PARSER.set_language(Language('/src/build/py-tree-sitter-languages.so', args['--language']))
processor = DataProcessor(language=args['--language'],
language_parser=LANGUAGE_METADATA[args['--language']]['language_parser'])
functions = processor.process_single_file(args['INPUT_FILEPATH'])
print(json.dumps(functions, indent=2))