FormCalc Syntax Error Tips

FormCalc has a few possible syntax errors, and they aren’t always easy to decipher. Here’s a tip for when you get the “Syntax error near token ‘%1’ on line %2, column %3.”:

Generally, %1 will contain the token (word) nearest to the error. Please note that the token is not necessarily incorrect, and does not necessarily have anything to do with the error, other than proximity to the problem.

var b = abc(1)
if (b ne 1) then

The script above will generate a 7008 error: “Syntax error near token ‘then’ on line on line x, column y.” The actual error in this case is that the ‘endif’ token is missing from the script. The last correct token is ‘then’ (comments do not count as tokens.)

The way to fix this problem would be to add an ‘endif’ statement to the end of the script.

Learning Resources is putting together more extensive documentation for the syntax error messages which will hopefully be available on the Web shortly after we ship 8.2.

One Response to FormCalc Syntax Error Tips

  1. Duarte Cunha Leão says:

    Showing an error message when there is a syntax error is admissible.But, unlike with JavaScript code, in run-time errors, FormCalc code always shows an error message to the user, including the «whole code that failed» (even if that occupies the whole screen) and, finally, the description of the error!!This, imho, is an absurd, and can only be understood as some market-like feature.If it is a matter of “protecting” the final user…then perhaps JavaScript and its try/catch/finally constructs should be discontinued.Is there *any* way to prevent FormCalc error messages from displaying?