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.1.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.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_tree_sitter_epics-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 8e6472d35b17a42c0b8ddadf1451058b1fdcef48b7a87b2093ede7216923203c
MD5 71cd6d4f37a5d1e08664f8cd52c0a076
BLAKE2b-256 3338d057213a27506628f91c8efca6212c714046aa436ebd2721532bd6a1faee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_tree_sitter_epics-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4cd6e22470730f2fc22bb9e57f820f31c671de5e9406beddcd4f92469f87f8c2
MD5 9852b97fbec8457909fe214a02a3c1bb
BLAKE2b-256 08578593efa36fe33e3cf5c4bac6ad392fd948fca5029274f80f98f897c60d16

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