PSL Compiler Warnings

The PSL compiler offers a number of compiler checks for common PSL coding errors. These warnings can be ignored because they do not prevent successful compilation and execution of the PSL program. Currently, these warnings are only available through the Check Syntax menu entry in the PSL editor on the PATROL console.

line_number Assignment in if statement

The assignment operator "=" appeared in an if statement condition.

Explanation: The usual assignment operator within an if statement condition is the test equal operator "==". Using "=" instead of "==" may be a useful coding technique or may indicate an error.

User Response: Verify that the if statement condition operator is the desired one.

line_number Statement has no effect

The PSL statement is a NULL effect statement without assignment, increment, or side-effect function calls.

Explanation: The statement may produce an effect during execution but does not transmit that effect to any other part of the PSL program. This is the reason the statement is considered a NULL effect statement. An example with operators is x+2; that should probably be x+=2; . Another example of errors with function calls is trim(); that should probably be var=trim(); because the returned value is unused.

User Response: Examine the statement and modify it to give it an effect within the program.

line_number Variable used but not set

A local PSL variable has been used without ever having been initialized to a value.

Explanation: Flags within the PslDebug variable allow PSL to flag all local variables where the first appearance in a program is not as the recipient of an assignment statement. When a variable is created, its value defaults to the NULL string. This message is warning you that the variable in question has not been previously defined within the PSL program.

User Response: Ensure that the variable and its NULL string value are desired within the statement.

line_number Variable set but not used

A variable was defined but not otherwise used in the PSL program.

Explanation: A variable was created when it was assigned a value other than the default NULL string value, but the variable was never used within the PSL program. A message that a variable was used but not set often indicates that a typographical error occurred and that PSL created two variables, one with the correct name and the other with the misspelled one.

User Response: Check to see why the variable was never used within the program. If it is not needed, remove it. If it is a typographical error, correct it.

line_number Undefined backslash escape in string constant

An undefined escape sequence appeared in a PSL character string.

Explanation: The correct PSL escape sequences are \A through \Z, \t, \n, \r, and \b. PSL ignores and discards any other escape sequences that it detects in a character string. For example, PSL changes the string "A\zB" to the string "AB" because \z is not a valid escape character.

User Response: Verify the presence of the escape character in the character string and either modify it to be a valid PSL escape character or remove it.

line_number Float constant starts with '.'

A floating point number begins with a decimal point.

Explanation: Floating point numbers within PSL must begin with either a minus sign or a digit for PSL to correctly interpret them as numbers in numeric calculations. PSL will interpret a number that begins with a decimal point as a character string and will treat it as a character string in numeric operations.

User Response: Prefix each floating point number with 0 or a minus sign to ensure it is properly interpreted by PSL.

Where to go from here

Diagnosing PSL Program Errors

Was this page helpful? Yes No Submitting... Thank you

Comments