al1-ce / jsppext Goto Github PK
View Code? Open in Web Editor NEWExtension to js++ compiler
License: MIT License
Extension to js++ compiler
License: MIT License
Syntax:
"-s|--suffix" to set suffix, defaults to none? defaults to jspp?
-s "" or -s \0 to set to none
As for v.0.10.0 of js++ compiler there's no async functionality intergrated.
Proposal:
Integrate async injection into compiler extension.
How:
Assume we have function that we want to make async, let's call it "sleep". And we call it at some moment and we need to await it. Then we write this code: await(sleep(5000));
.
Jsppext changes await(sleep(5000));
to await sleep(5000);
with matching regex \bawait\b\s*?\((.*?)\)\s*?;
.
Then it''s going through all functions while looking if there's await keyword inside. If it's there, then add async to function. Do that again with async / await keywords while checking if function is already async.
Then search all functions within included modules with function\s*((?:[^\(\)\s])+?)\s*\(.*?\)
regex for any signature of awaited function. Check if it's already async, if not add async keyword, add function to completed list.
Limitations:
Await signature must be always await(/func/);
.
If threre's more then one instance of awaited function it might fail. It's going to make all functions with that name async, which might lead to some probable unexpected results.
No top level awaits. Yes top level awaits since jspp compiles into folded function which is going to be picked up and made async.
'
being replaced by `
. If you want to use '
inside of string, escape it \'
. Same for `
external something;
affecting modules. Put external statements on top of file (before imports), if there's no imports import std;
, otherwise external statement going to be picked up inside of module.Parse Error: Line 19: Unexpected token ... (G:\sily-jspp-example\src\lib\sily\std\getopt.jpp)
FAILED (1) errors and (0) warnings
Implements:
visibility alias name = symbol;
)module name;
at top of file)import modulename: symbol;
)void main()
then execute itA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.