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()
classDiagram
    Record--o Link : 0..1
    class Link {
        set_record_name()
        set_type_link()
        create_link()
        string record_name
        string type_link
    }
    class Record {
        set_record_type()
        set_record_name()
        set_description()
        set_fields()
        set_infos()
        set_links_in()
        set_links_out()
        add_link_out()
        add_link_in()
        print_to_text()
        string record_type 
        string record_name 
        string description 
        tuple[string,string] fields 
        string unit
        string description
        string infos
        List<Link> links_in
        List<Link> links_out
    }
    class DbParser {
        +parse()
        +build_fields()
        +build_comment()
        +build_infos()
        +build_records_list()
        parserTree
        tree
        root_node
        tree
    }

   

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.2.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_tree_sitter_epics-0.2.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file py_tree_sitter_epics-0.2.2.tar.gz.

File metadata

  • Download URL: py_tree_sitter_epics-0.2.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.11 Linux/6.12.50

File hashes

Hashes for py_tree_sitter_epics-0.2.2.tar.gz
Algorithm Hash digest
SHA256 ed9c4c02c781a8e954787751eb1f5879b2b3216615675fe170b44a51230fcb62
MD5 1efbd6632b3b10701342db65bdfa0c5a
BLAKE2b-256 23ac6f539425ff193ae1e9463a142a7e6fd9c083c23b3955f3f4e98d00f02981

See more details on using hashes here.

File details

Details for the file py_tree_sitter_epics-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for py_tree_sitter_epics-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a7b1daa2ca89a1988c99412d7c5465404edceeb6b189ba30fdae7f36e6196d49
MD5 381a25062c453d1ac60b49ecfe9dc9f0
BLAKE2b-256 99c964184d14acc91a18358dd5d715f8c6228c0ae34eb98ba36b61e8f696b6c0

See more details on using hashes here.

Supported by

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