Tag Name Programming Language
Quick jump to function:
- Integer: checkString | checkStringEx | checkVersion | getAttIndex | getNumAttributes | getStringStartIndex | getValueInt | hasAttStartTag | hasEqual | isCatActive | isDefined | isFlagSet | isInRange | isValueInArray | matchCase | matchNoCase | random | strcmp | stricmp | strncmp | strnicmp | strlen
- Float: getValueFloat
- String: convertString | convertStringEx | getAttName | getAttValue | getAttValueEx | getMidString | getTagName | getValueString | isInRangeEx | pluralize | toLower | toString | toStringF | toUpper
- Location: getAttLocation | getAttValueLocation | getLocation
- Procedures (no return value): activateCategory | activateCategories | checkAttributes | checkStyle | runLinkCheckProgramForTags | setClosed | setValidated | setValueString | setValueStringEx | unDefine
- Function/Procedures: addValue | checkRange | checkRangeEx | checkTagAttributes | checkTagContents | checkTagUsed | Message | MessageEx | playSound | requireAllAttributes | requireMutuallyExclusiveAttributes | requireOneAttribute | runProgram | setFlag | setFlagEx | setInt | setPriority | setValueInt | writeFile
General Information
- Function and procedure names are case insensitive.
- Integer expressions are computed from left to right, without regard to operator precedence.
- Comments can be included in the program by beginning them with "/*" and ending them with "*/". For example: /* This is a comment */
- Variable/Symbol Names
- 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.
Data Types
- int - an integer such as -7, 0, 89, etc.
- 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 equal 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'
- string1+string2 : concatenates string1 and string2, returns string1string2
Flow Control
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.
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).
Functions
To define your own function, add a function to the functions program type in the following format (note that the keyword function must begin at the first character of a line):
function functionname() { statement; ... }
To call a function, use @functionname();.
Special Functions
- onConfigLoad() - this function is called when a configuration is loaded; it can be used to specify the validation modes that the configuration supports
- onUnknownCSSPropertyMessage() - this function is called when a CSS property is unknown and a validator error message is about to be generated; this function can be used to ignore unknown CSS properties and/or to change or display additional messages when certain unknown CSS properties are used; the following variables are defined when this function is called and may be modified before the validator message is displayed: (New v7.9910)
- $oucpm_property - the name of the unknown CSS property
- $oucpm_msgtext - the default message text of the validator message that will be displayed
- $oucpm_msgcat - the default message category of the validator message that will be displayed
- $oucpm_msgflags - the default message category of the validator message that will be displayed; set to 0 to cancel the message
- $oucpm_msgid - the default message ID of the validator message that will be displayed; the default is -1 for no message ID
- $oucpm_msgtype - the default message category of the validator message that will be displayed; the default is $MSG_ERROR
- onUnknownElementMessage() - this function is called when an HTML/XHTML element is unknown and a validator error message is about to be generated; this function can be used to ignore unknown elements and/or to change or display additional messages when certain unknown elements are used; the following variables are defined when this function is called and may be modified before the validator message is displayed: (New v7.9910)
- $ouem_element - the name of the unknown element
- $ouem_msgtext - the default message text of the validator message that will be displayed
- $ouem_msgtextappend - an additional message that is appended to the end of $ouem_msgtext; the default is " Did you misspell it?"
- $ouem_msgtextprepend - an additional message that is appended to the front of $ouem_msgtext; the default is an empty string (New v8.0100)
- $ouem_msgcat - the default message category of the validator message that will be displayed; the default is "" for no category
- $ouem_msgflags - the default message category of the validator message that will be displayed; set to 0 to cancel the message
- $ouem_msgid - the default message ID of the validator message that will be displayed; the default is -1 for no message ID
- $ouem_msgtype - the default message category of the validator message that will be displayed; the default is $MSG_ERROR
» |