The programming language built-in to CSE HTML Validator gives users a unique and powerful ability to customize the validation results by letting you create your own validation rules. With this language, customized programs can be written to check tags, attributes, attribute values, and more. These custom programs can generate custom validator messages based on the results of the checks.
Programs can be assigned to tags, attributes, and more, so that when a tag or attribute is encountered during validation, the assigned program for that tag or attribute is run to perform the checks.
•Function and procedure names are case insensitive.
•Integer expressions are computed from left to right, without regard to any operator precedence. You may need to group parts of expressions in parenthesis so the expression is evaluated as desired.
Program comments begin with "/*" and end with "*/". For example: /* This is a comment */
Comments can also begin with "//" and end at the end of the line. (New v10.9913)
•are not case sensitive
•must be alphanumeric
•must begin with an alphabetic character
•setting variables in integer and string expressions is possible
•To access a variable, use $name. The return value is a string if name is accessed in a string expression, or an integer if name is accessed in an integer expression. #name can also be used in an integer expression.
•To increment an integer variable by one in an expression, use $name++, to decrement by one, use $name--. To increment an integer variable by one using a statement, use $name++;, to decrement by one, use $name--;. Note that using # instead of $ is also valid.
$name=string exp value;
Creates a variable called $name (if it doesn't already exist), and sets its value to value. The return value is value and is a string.
#name=int exp value;
Creates a variable called $name (if it doesn't already exist), and sets its value to value. The return value is value and is an integer.
•int - an integer such as -7, 0, 89, or the keywords true (equal to 1) or false (equal to 0) or a valid Integer Keywords
•int exp - an expression that evaluates to an integer such as -7, 0, 89, 5+3, 56-34, 3*2, 6*(7-3), etc.; variable names and functions returning an int can be used
•!int1 : returns 1 if int1 is 0, else returns 0
•int1+int2 : returns the sum of int1 and int2 (int1+int2)
•int1-int2 : returns int1-int2
•int1*int2 : returns int1*int2
•int1/int2 : returns int1/int2; generates an error if int2 is 0
•int1&int2 : returns the bitwise AND of int1 and int2
•int1|int2 : returns the bitwise OR of int1 and int2
•int1==int2 : returns 1 if int1 and int2 are equal, else returns 0; note the double equals signs
•int1&&int2 : returns 1 if int1 and int2 are both nonzero, else returns 0
•int1||int2 : returns 1 if either or both int1 and int2 are nonzero, else returns 0
•int1>=int2 : returns 1 if int1 is greater than or equal to int2, else returns 0
•int1<=int2 : returns 1 if int1 is less than or equal to int2, else returns 0
•int1>int2 : returns 1 if int1 is greater than int2, else returns 0
•int1<int2 : returns 1 if int1 is less than int2, else returns 0
•int1<>int2 : returns 1 if int1 does not equal int2, else returns 0
•int1!=int2 : returns 1 if int1 does not equal int2, else returns 0
•float exp - similar to an int expression but with floating point numbers instead of integers; should not be of much use for tag name programs
•string exp : an expression that evaluates to a string
•constant strings can be enclosed in double quotes (") or single quotes ('), such as "This is a string" or 'This is also a string'
•to include a double quote in a double quoted string, escape it with a backslash (\"), similarly, to include a single quote in a single quoted string, escape it with a backslash (\') (New v10.9913)
•string1+string2 : concatenates string1 and string2, returns string1string2
•can be or include one or more of any valid String Keywords
do { statement; ... } while (int exp);
Executes a statement or statement block while the integer expression is true (nonzero). The statement or statement block is executed at least once.
if int exp { statement; ... } [else { statement; ... }]
Executes a statement or statement block, depending on the value of the integer expression. Executes the statement or statement block immediately following if if the integer expression is nonzero, else executes the statement or statement block following else if the integer expression is 0. The else part is optional. Parenthesis around the int exp is optional.
for (statement1; int exp; statement2) { statement3; ... }
Executes statement1 if it exists, then evaluates the required integer expression. If the integer expression is nonzero, then statement3 is executed, otherwise control returns to the statement immediately following the block that contains statement3. If the statement3 block is executed, statement2 is executed immediately afterwards if it exists. The integer expression is then reevaluated and the loop continues until the integer expression evaluates to zero. statement1 and statement2 are both optional and may be single statements or statement blocks. statement3 may be a single statement or a statement block.
For example, this loop continues while the integer expression is nonzero: execute statement1, evaluate integer expression, execute statement3 block, execute statement2, evaluate integer expression, execute statement3 block, execute statement2, evaluate integer expression, ...
while (int exp) { statement; ... }
Continues executing a statement or statement block while the integer expression is true (nonzero).
NOTE: A lot of looping can significantly affect validation performance.
To define your own function, add a function to the functions program type in the following format:
function functionname() { statement; ... }
To call a function, use @functionname(); or functionname();. The preceding '@' character is optional in v10.9914 and later.
In versions prior to v10.9914, the keyword function must begin at the first character of a line.