Skip to main content

Facilitate tree-sitter-epics parsing in python

Project description

PY-TREE-SITTER-EPICS

Based on Tree sitter , tree-sitter-epics and Py-tree-sitter, this module is used to serialize any EPICS files into a Python object usable in a script.

⚠️ For now it is only developped for EPICS CA database but it will support more files in the future.

Installation

The module is available on Pypi. This package currently only works with Python >3.10. The library dependencis is tree-sitter-epics

pip3 install py-tree-sitter-epics

You may need to use this line

pip3 install py-tree-sitter-epics --break-system-packages

Using

This example show how to use the module. It is parsing a file building a python object containing all the fields, infos and links to finally displaying all those infos.

from py_tree_sitter_epics import epicsdb

with Path.open("/tmp/myExample.db") as file:
        code = file.read()
#build the parser
db_parser = epicsdb.DbParser()
#parse the code
db_parser.parse(code)
#build record list from the parser
record_list = db_parser.build_records_list()
for record in reccord_list:
    #print a complete result
    record.print_to_text()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_tree_sitter_epics-0.1.6.tar.gz (228.1 kB view hashes)

Uploaded Source

Built Distribution

py_tree_sitter_epics-0.1.6-py3-none-any.whl (266.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page