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
What is the best way to check if block of code is syntactically correct javascript? or if an expression is correct? Without providing all variables etc, just syntax check.
And as a bonus: when parsing, is it possible to identify names of variables that the code is referring to?
And another question: is it possible to provide values of unresolved variables via some callback function from C# (variableName => value)?
BTW i really like the performance of Nil.JS, it's insanely fast compared to even simple expression evaluators in .Net
The text was updated successfully, but these errors were encountered:
I think, the best way is using of Script.Parse with passing value for messageCallback (but be careful, some messages contains grammar mistakes due my mediocre knowledge of English language, corrections are welcome).
Yes, it's possible. Script.Parse returns root of AST of script. You can get all variables, all functions, everything. Also, all variables contains link to VariableDescriptor, which contains links to all instances of every variable.
Yes. You can make you own implementation of NiL.JS.Core.Context and override some methods. See NiL.JS.Core.WithContext for example
An alternative if you are using a JavaScript editor like codemirror is that there are plugins that will check syntax and highlight these in the editor. It works well if this is how you are using Nil.JS
Also callout to nilproject for a reliable and fast JavaScript engine, its an important part of our solution and works well.
What is the best way to check if block of code is syntactically correct javascript? or if an expression is correct? Without providing all variables etc, just syntax check.
And as a bonus: when parsing, is it possible to identify names of variables that the code is referring to?
And another question: is it possible to provide values of unresolved variables via some callback function from C# (variableName => value)?
BTW i really like the performance of Nil.JS, it's insanely fast compared to even simple expression evaluators in .Net
The text was updated successfully, but these errors were encountered: