Old 06-29-2020, 11:22 AM   #1
Claudiohbsantos
Human being with feelings
 
Join Date: Aug 2014
Location: New York
Posts: 135
Default Reascript Lua API Parser - npm package

I wanted to practice my typescript abilities and created a small tool to parse the reascript lua api from reascripthelp.html generated by Reaper. The tool extracts all functions from the html and returns them as an array of objects that describe the returns and parameters order,types and names, as well as the namespace.

This could be handy for anyone who wants to create snippets for code editors or any other developer tool, since you can automate the scraping of the API when new reaper versions are released.

It can be used as a CLI or as a module in a Javascript/Typescript project.

https://www.npmjs.com/package/reascr...eaper-api-html

I have only eye-balled the results and they seem correct. If you find a use for it and find missing/wrong information please open an issue on github, I haven't been checking my messages here often.the repository is linked on the npm page.

It shouldn't be hard to adapt it to extract eel or python functions if needed. Feel free to submit PRs or ask for features if there is an interest.
__________________
My Reapack Repo - Reapack Extension
Claudiohbsantos is offline   Reply With Quote
Old 06-29-2020, 04:19 PM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,584
Default

Nice !


Though have my own parser for my doc, just like mespotine also has her own ^^

But yours has the advantage of being used via npm / cli simply.

Last edited by X-Raym; 06-29-2020 at 05:09 PM.
X-Raym is offline   Reply With Quote
Old 06-29-2020, 04:28 PM   #3
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 658
Default

Quote:
Originally Posted by X-Raym View Post
ust like mespotine also has his own ^^
.
Her own

And my parsing is actually...ehrmm...handwritten, I suppose.

I'm a traditionalist, can't help it

@Claudiohbsantos
You could add SWELL, WDL, plugin-header und functions-header as well.

Tthe latter can be extracted by the action "[developer] Write C++ API functions header", the other ones are on Justin's server iirc.

This is something, I hadn't the chance to do yet and it involves parsing some header-files as well, but would allow you to make the most complete Reaper-function-doc available.
__________________
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1200 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 06-29-2020, 05:14 PM   #4
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,584
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Her own
Oh yes sorry, it's corrected :P


--
In my case it is more in two parts : a converter to nicely formatted HTML and then a simple HTML parser can do it.

So yes claudio version is more straightforward, as it is more direct from the raw HTML to javascript objects.
X-Raym is offline   Reply With Quote
Old 06-30-2020, 08:06 AM   #5
Claudiohbsantos
Human being with feelings
 
Join Date: Aug 2014
Location: New York
Posts: 135
Default

Yeah, I figured some people here would have their own parsers already. This was mostly sparked by finding the project https://github.com/TypeScriptToLua/TypeScriptToLua . I might try to generate a declarations file to see how well it would work to code in typescript and transpile to Lua. Probably not worth the roundtrip and potential bugs introduced by the trip, but seemed like a fun side project.

@Mespotine
Yeah, I was "parsing" by hand before as well. Mostly just using multiple cursors on sublime/vscode. What it really meant was that my code snippets for autocomplete are probably from sometime around Reaper v5.0 because I could never muster the energy to update them.

And it's an interesting idea to include the other resources, but I'll probably pass on them for now. I don't really use anything other than Lua for my reaper projects so I'm not sure they would see much use.
__________________
My Reapack Repo - Reapack Extension
Claudiohbsantos is offline   Reply With Quote
Old 06-30-2020, 09:51 AM   #6
aRMARa
Human being with feelings
 
Join Date: Jun 2020
Posts: 6
Default Wow

It's amazing that someone is already doing what I was sitting on to do. Now do any of you use vim or nvim for text editing on windows? If so have you created a snippet library for it?
aRMARa is offline   Reply With Quote
Old 07-01-2020, 08:38 AM   #7
Claudiohbsantos
Human being with feelings
 
Join Date: Aug 2014
Location: New York
Posts: 135
Default

@aRMARa

I don't think I've seen vim snippets shared yet, but I haven't been checking the forums often lately. The only one I know of is the sublime package: https://github.com/Breeder/ReaSyntax . Maybe those can be converted?
__________________
My Reapack Repo - Reapack Extension
Claudiohbsantos is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:56 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.