You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
If user writes {{ const a = 3 }}, we want to add variable a to sandbox and print nothing. But, if user does {{ a }}, then we want to print the value to the html.
This sounds nice and smooth for example above, but imagine this case
{{(()=>{consta=3;returna;})();}}
We want this to be classified as a value rather than assignment since it outputs 3 in HTML.
There are few ways we can approach this 1. Write more specific RegExp
Easier to code
Hard to maintain
2. Tokenize everything inside JavaScript
Hard to code
Easier than RegExp method to maintain.
The text was updated successfully, but these errors were encountered:
I was thinking about just tokenizing to differentiate rather than going full parsing. If we know whether it is an assignment or value, we can directly run it in VM and get the output.
Yup the snippet mentioned in #23 won't be possible. but I think such cases are fine until we get super mature. We can always scale up when we need, scaling down will be difficult
Currently, we do super hacky things to find whether it is an assignment or a value.
https://github.com/abelljs/abell-renderer/blob/main/src/execute.js#L30-L73
If user writes
{{ const a = 3 }}
, we want to add variable a to sandbox and print nothing. But, if user does {{ a }}, then we want to print the value to the html.This sounds nice and smooth for example above, but imagine this case
We want this to be classified as a value rather than assignment since it outputs 3 in HTML.
There are few ways we can approach this
1. Write more specific RegExp
2. Tokenize everything inside JavaScript
The text was updated successfully, but these errors were encountered: