Syntax errors
UNICOM Intelligence Professional can detect some syntax errors when parsing the script before executing it. Examples of these errors are misspelling a keyword or the name of a variable.
The following code includes two syntax errors: a spelling error on line 3 (the final “n” has been omitted from the name of the Position variable), and the “Then” keyword has been omitted from the If statement on line 5.
Dim Position
Positio = Find("ABDCDEFGHIJKLM", "H")
If Position > 5
Position = Position + 3
End If
If you run this code, UNICOM Intelligence Professional detects and underlines the errors during the initial parsing stage, and stops before executing the code, displaying a message describing the problem below the error. If the error is due to a specific word, that word is underlined; otherwise the entire line is underlined.
When you press Esc to close the error message, the underlining remains, so you can identify the exact position of the errors.
You cannot edit the script while you are in debugging mode; first, you must stop the debugging session. Press Ctrl+F5 or choose Stop from the Debug menu. If there has been an error, debugging stops automatically, putting you in edit mode.
Some syntax errors cannot be detected until the code is actually executed. An example of this type of error is spelling a function name incorrectly. For example, suppose, you correct the above example and then misspell the Find function as “Fnd”.
Dim Position
Position = Fnd("ABDCDEFGHIJKLM", "H")
If Position > 5 Then
Position = Position + 3
End If
When you try to run the code, UNICOM Intelligence Professional finds that there is no function called “Fnd”, so it underlines it and displays an execute error message similar to the parser error message you saw before. However, the text of the message indicates that it is an execute error.
See also