{"id":15568839,"url":"https://github.com/jayvdb/plstok","last_synced_at":"2025-04-05T04:41:54.646Z","repository":{"id":71577868,"uuid":"45227652","full_name":"jayvdb/plstok","owner":"jayvdb","description":"plsql parser","archived":false,"fork":false,"pushed_at":"2016-02-22T01:08:56.000Z","size":84,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-10T12:42:59.797Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://web.archive.org/web/20070818235915/http://home.swbell.net/mck9/pls/index.html","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jayvdb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-30T03:46:20.000Z","updated_at":"2016-10-07T11:09:23.000Z","dependencies_parsed_at":"2023-02-27T20:15:39.605Z","dependency_job_id":null,"html_url":"https://github.com/jayvdb/plstok","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayvdb%2Fplstok","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayvdb%2Fplstok/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayvdb%2Fplstok/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayvdb%2Fplstok/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jayvdb","download_url":"https://codeload.github.com/jayvdb/plstok/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289393,"owners_count":20914464,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T17:21:07.738Z","updated_at":"2025-04-05T04:41:54.621Z","avatar_url":"https://github.com/jayvdb.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Free PL/SQL Utilities\n---------------------\n\nThis project is the home of some free utilities for managing PL/SQL source code by Scott McKellar \u003cmck9@swbell.net\u003e.\nThe source comes from Wayback Machine: https://web.archive.org/web/20010706235240/http://home.swbell.net/mck9/pls/index.html\n\nThe earlier and latter captures on Wayback Machine are identical until the last version archived on 18 August 2007 : https://web.archive.org/web/20070818235915/http://home.swbell.net/mck9/pls/index.html\n\nThese utilities are available in the form of C source code, distributed\nunder the terms of the GNU General Public License.  If you have an ISO C\ncompiler, and know how to use it, you can download the code and compile it\nfor your environment.  You can also modify the code to suit your own tastes\nand needs.\n\nAt the core of these utilities lies 'plstok', a\ntokenizer or lexical analyzer for PL/SQL code.  Plstok is more significant\nthan the utilities themselves, because you can incorporate it into tools of \nyour own devising.  Given plstok, most of the utilities below so far were \ntrivial to write.  The exception -- and the reason for developing plstok\nin the first place -- is plsb, a beautifier for PL/SQL source code.\n\nOracle 8 uses additional reserved words not recognized by plstok, which was\nwritten for Oracle 7.  In large part you could probably adapt these utilities\nfor Oracle 8 simply by editing plstok.h to include the new reserved words. \nThere may remain some forms of Oracle 8 syntax which are not properly \nhandled, especially by plsb.\n\nUtilities Available\n~~~~~~~~~~~~~~~~~~~\n\nThe tools currently available include:\n\n* ttok -- a demo and test driver for the tokenizer, plstok.\n* plscap -- raises reserved words to upper case, and changes identifiers to lower case.\n* plscount -- counts PL/SQL tokens.\n* plsenull -- finds constructs which attempt to test for equality (or inequality) to NULL.\n* plsqlf -- finds string or character literals which contain embedded line feeds.\n* plsb -- reformats PL/SQL source code to apply consistent use of indentation and white space (still under development).\n\n\nOn the Use of Text Files\n~~~~~~~~~~~~~~~~~~~~~~~~\nThe PL/SQL utilities presented here treat PL/SQL source code as text files.\n\nIn real life, of course, Oracle stores the code in the database.  You're\nexpected to edit it with Procedure Builder or some such tool.  Oracle doesn't\nmake it easy to access the code with text-based tools like sed or grep,\nno matter how useful it would be to do so.\n\nSo why am I sticking with the text-based approach?\n\n* To keep things simple.  I can concentrate on the problems of lexical\nand semantic analysis without being distracted by embedded SQL and GUI\ninterfaces.\n\n* To keep things portable.  I'm not confining myself to a particular\nenvironment.\n\n* To keep things free.  I don't have Oracle at home in the basement.  To\ndevelop tools which access the database I would have to use my employer's \nsystem, and then I wouldn't legally be able to release the source code\nas open software.\n\n\nOn my job, I developed a suite of utilities for fetching and compiling \nPL/SQL modules from the Unix command line.  (I can't release these utilities\nbecause I wrote them on company time; they are the intellectual property of \nmy employer.)  As a result I can manage our PL/SQL as a collection of text \nfiles.  Using grep I can quickly find, for example, all calls to \nsuch-and-such a procedure.\n\nHence the utilities offered here are a good fit for my own environment.\nIf your environment is not text-based like mine is, there are three ways\nto use these utilities:\n\n\n* Convert your PL/SQL code in and out of text format as needed.  For\nexample, use the export and import facilities of Procedure Builder.  This\napproach will be cumbersome for large numbers of files.\n\n* Write your own utilities for fetching and compiling PL/SQL source\ncode from the database, as I did.\n\n* Adapt my source code for your own environment.  Plstok lets you install\na callback function to read source code from something other than a text \nfile -- such a database.\n\n\nCompiling\n~~~~~~~~~\n\nCompile each of the C files in the 'plstok' package\nand whatever C files are specific for a given utility.  Link them.  That's\nit.\n\nHow you do that depends on your system.  Since there's nothing very \ncomplicated about the builds, I haven't tried to provide a makefile (which \nwould likely need to be customized for your system anyway).\n\nHowever, there is one small complication.  By default, the code includes\na lot of debugging assertions.  In addition, the memory management layer\ndisplays a brief report of memory usage at the end of a run.\n\nTo disable the debugging code and the memory usage report, compile all\nmodules with the macro NDEBUG #defined.  Compilers generally provide a way\nto #define a macro without changing the source code.  In Unix, for example,\nuse the -DNDEBUG option.\n\nIf you compile with NDEBUG #defined, then you needn't include the myassert\nmodule in the link.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayvdb%2Fplstok","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjayvdb%2Fplstok","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayvdb%2Fplstok/lists"}