Log in to ask questions, share your expertise, or stay connected to content you value. Don’t have a login? Learn how to become a member.
Use the slax-doctor Script to Check for Syntax Errors The slax-doctor script checks SLAX scripts for common syntax and programming errors. One common problem with writing large SLAX scripts is the difficulty in isolating the location of the inevitable syntax errors. Unterminated comments or strings and other syntax problems tend to cause cascading errors, which do not point clearly to the line where the problem occurred. This script helps to locate these types of errors. It is not perfect but it can detect the following problems: Unterminated comments Unterminated strings Lines that lack proper termination Mixed up parenthesis and curly braces Missing brackets Missing parenthesis Unknown parameters included in template calls Missing default-less parameters in template calls Trying to treat template parameters like function arguments Trying to treat function arguments like template parameters Missing call statements when redirecting template results to variables Missing namespaces for <func:function> function names Script Caveats: Comment delimiters within quotes will cause false errors Comment delimiters within comments will cause false errors Brackets, parenthesis, and braces within quotes will cause false errors Equal signs within quotes passed as function arguments will cause false errors More than one single-line comment within a line will cause false errors Location paths with /* will cause false errors Parameter checking only works within parenthesis, not using the with statement Code lines that are split across multiple file lines could cause false errors To use the script, install it on a JUNOS device which also has the script that you want to check
Check SLAX Scripts for Common Syntax Errors You can use the slax-doctor script to check SLAX scripts for common syntax and programming errors. One common problem with writing large SLAX scripts is the difficulty in isolating the location of the inevitable syntax errors. Unterminated comments or strings and other syntax problems tend to cause cascading errors, which do not point clearly to the line where the problem occurred. The slax-doctor script helps locate these types of errors. It is not perfect but it can detect the following problems: Unterminated comments Unterminated strings Lines that lack proper termination Mixed up parenthesis and curly braces Missing brackets Missing parenthesis Unknown parameters included in template calls Missing default-less parameters in template calls Trying to treat template parameters like function arguments Trying to treat function arguments like template parameters Missing call statements when redirecting template results to variables Missing namespaces for <func:function> function names Caveats When Using the slax-doctor Script Comment delimiters within quotes will cause false errors Comment delimiters within comments will cause false errors Brackets, parenthesis, and braces within quotes will cause false errors Equal signs within quotes passed as function arguments will cause false errors More than one single-line comment within a line will cause false errors Location paths with /* will cause false errors Parameter checking only works within parenthesis, not using the with statement Code lines that are split across multiple file lines could cause false errors To use the script, install it on a JUNOS device which contains the script that you want to check