- --- In firstname.lastname@example.org, "tmswhite2011" <tom.white.md@...> wrote:
> (1) All variables names externally pre-defined
> (2) All allowable function names externally pre-defined - ideally with some degree of syntax checking (my functions tend to have 0, 1, 2, 3, or unlimited numbers of arguments, and I have about 100 of them)
> (3) All math operators and Math functions
> (4) Ideally, properly assess whether left and right hand parts are string, numeric, or date (so can provide warnings if try to multiply two strings, for example)
> (5) Strict enforcement of other syntax elements (e.g. to start, I probably want to avoid arrays, dot notation on variables, any variable assignment or new object creation)
> (6) Good error reporting if there are syntax errors.
> JSLint seems to do all of this and more. My question is whether I can fairly easily modify it to enforce this more limited set of functionality.
> In case you are interested, I'm trying to build an equation parser into the open-source LimeSurvey tool. Each survey question has an associated variable name. The equation parser must only allow variables that have been pre-defined, and only allow functions that are pre-configured within LimeSurvey (to avoid scripting attacks).
> So, can JSLint do what I want, or do I need to modify/ extend it.
> If JSLint is too powerful a tool for my stated needs, can anyone recommend an alternative?
If you decide to modify JSLint, you are on your own. You will get no support from me.