npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

plsql-to-ast

v1.1.1

Published

PL/SQL Parser that just works

Downloads

11

Readme

plsql-to-ast: Parse PL/SQL Code to JSON

plsql-to-ast is a powerful tool for parsing complex PL/SQL code and extracting its Abstract Syntax Tree (AST) into a structured JSON format. It's designed to handle various PL/SQL code constructs, including stored procedures, triggers, and functions, making it a versatile solution for analyzing and manipulating PL/SQL codebases.

Features

  • Parse PL/SQL code and generate structured JSON representation of the AST.
  • Handle complex PL/SQL constructs like loops, conditionals, function calls, and more.
  • Option to display errors in the console.
  • Easily integrated into projects through npm installation or command-line usage.

Installation

To install the plsql-to-ast module via npm, use the following command:

npm install plsql-to-ast

Command-Line Usage

plsql-to-ast can be used via the command line to generate JSON output for a provided PL/SQL file. The following options are available:

# Provide a PL/SQL file to generate abstraction (required)
node dist/plsql-to-ast-script.js --sql-file=path/to/your/sql/file.sql

Options:

-f, --sql-file: Provide a PL/SQL file to generate abstraction (required).
-e, --show-errors: Display errors in the console (boolean, default: false).
--help: Display help information.

Module Usage

You can also use plsql-to-ast as a module in your TypeScript project:

import { getASTAsJSON } from "plsql-to-ast";

const query = 'SELECT * FROM \`employees\`;';
const jsonOutput = getASTAsJSON(query);

Examples

SET `var1` = 0;
SET `var2` = 0;

WHILE `var1` < 10 DO
    SET `var2` = 0;
    WHILE `var2` < 5 DO
        INSERT INTO `example_table` (`column1`, `column2`)
        VALUES (`var1`, `var2`);
        
        SET `var2` = `var2` + 1;
    END WHILE;
    
    SET `var1` = `var1` + 1;
END WHILE;

SET `total_records` = `get_total_records`();

SET `avg_value` = `calculate_average_value`(`example_table`.`column2`);

INSERT INTO `summary_table` (`total_records`, `avg_value`)
VALUES (`total_records`, `avg_value`);

SELECT * FROM `summary_table`;

END

Contributions and Feedback

Contributions to the project are welcome! If you encounter any issues or have suggestions for improvements, feel free to open an issue.

Thanks

Thank you for considering plsql-to-ast for your PL/SQL parsing needs. We hope this tool proves valuable in your development and analysis workflows. Happy coding!