The following table describes the script tokens in Fast Lexical Analyzer (FLEX) notation. Visit the FLEX web site for details at http://www.gnu.org/software/flex/.
| Definition | Pattern |
|---|---|
| DIGIT | [0-9] |
| OCTALDIGIT | [0-7] |
| HEXDIGIT | [0-9A-Fa-f] |
| QUOTE | [\"\”\”] |
| STRING_CHAR | [^\\\"\”\”]|\\[abfnrtv\\\"\”\”]|\\[0-7]{3}|\\x[0-9a-fA-F]{3} |
| PASSED | [pP][aA][sS][sS][eE][dD] |
| FAILED | [fF][aA][iI][lL][eE][dD] |
| WARNING | [wW][aA][rR][nN][iI][nN][gG] |
| TRUE | [tT][rR][uU][eE] |
| FALSE | [fF][aA][lL][sS][eE] |
| SLEEP | [Ss][Ll][Ee][Ee][Pp] |
| AND | [aA][nN][dD] |
| OR | [oO][rR] |
| NOT | [nN][oO][tT] |
| ID | [a-zA-Z][a-zA-Z0-9_]* |
| DEFAULT | [Dd][Ee][Ff][Aa][Uu][Ll][Tt] |
| SCRIPTDIR | [Ss][Cc][Rr][Ii][Pp][Tt][Dd][Ii][Rr] |
| SCRIPTDIR1 | [Ss][Cc][Rr][Ii][Pp][Tt][Dd][Ii][Rr][Ee][Cc][Tt][Oo][Rr][Yy] |
| FUNCTION | [Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn] |
| ENDFUNCTION | [Ee][Nn][Dd][Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn] |
| IGNORERESULT | [Ii][Gg][Nn][Oo][Rr][Ee][Rr][Ee][Ss][Uu][Ll][Tt] |
| ENDIGNORERESULT | [Ee][Nn][Dd][Ii][Gg][Nn][Oo][Rr][Ee][Rr][Ee][Ss][Uu][Ll][Tt] |
| LOGFILE | [Ll][Oo][Gg][Ff][Ii][Ll][Ee] |
| MOVE | [Mm][Oo][Vv][Ee] |
| COPY | [Cc][Oo][Pp][Yy] |
| ARRAYINDEX | [\[][a-zA-Z0-9_]+[\]] |
| LOCAL | [Ll][Oo][Cc][Aa]Ll] |
| And | {AND} |
| And | "&&" |
| Or | {OR} |
| Or | "||" |
| Not | {NOT} |
| Not | "!" |
| Octal Integer | 0{OCTALDIGIT}+ |
| Octal Integer | &O{OCTALDIGIT}+ |
| Decimal Integer | [-|+]?{DIGIT}+ |
| Hex Integer | 0x{HEXDIGIT}+ |
| Hex Integer | &H{HEXDIGIT}+ |
| Floating Point Number | [-|+]?{DIGIT}+"."{DIGIT}*E{DIGIT}+ |
| Floating Point Number | [-|+]?{DIGIT}+"."{DIGIT}*e{DIGIT}+ |
| Floating Point Number | [-|+]?{DIGIT}+"."{DIGIT}* |
| Bool | {TRUE} |
| Bool | {FALSE} |
| Function | {FUNCTION} |
| EndFunction | {ENDFUNCTION} |
| IgnoreResult | {IGNORERESULT} |
| EndIgnoreResult | {ENDIGNORERESULT} |
| Local | {LOCAL} |
| MoveLogFile | {MOVE}{LOGFILE} |
| CopyLogFile | {COPY}{LOGFILE} |
| NewLine | "#"[^#\n]* |
| Assignment | "=" |
| LessThan | "<" |
| LessThanOrEqual | "<=" |
| Equal | "==" |
| GreaterThanOrEqual | ">=" |
| GreaterThan | ">" |
| NitEqual | "!=" |
| Decrement | "--" |
| Increment | "++" |
| Arithmetic | "+"|"-"|"*"|"/"|"%"|"^" |
| Result | "result" |
| Include | "include" |
| Sleep | {SLEEP} |
| If | "if" |
| Then | "then" |
| Else | "else" |
| Endif | "endif" |
| While | "while" |
| Do | "do" |
| EndWhile | "endwhile" |
| New | "new" |
| Delete | "delete" |
| Sprintf | "sprintf" |
| Assert | "assert" |
| Sscanf | "sscanf" |
| ArrayLength | "arraylength" |
| ScriptDirectory | {SCRIPTDIR1} |
| ScriptDirectory | {SCRIPTDIR} |
| String | {QUOTE}{STRING_CHAR}*{QUOTE} |
| TestResult | {PASSED} |
| TestResult | {WARNING} |
| Failed | {FAILED} |
| Default | {DEFAULT} |
| Identifier | {ID}{ARRAYINDEX}* |
| OpenBracket | "(" |
| CloseBracket | ")" |
| OpenSquareBracket | "[" |
| CloseSquareBracket | "]" |
| Comma | "," |
| Action | "." |
| Action | ":" |
| NewLine | \n |
| WhiteSpace | [ \t;]+ |
| Unknown | . |
| Rule | ;Expression |
|---|---|
| <Script> | { <Statement> } |
| <Statement> | <Function Statement> | <Function Call> | <Ignore Result Statement> | <If Statement> | <Action Statement> | <While Statement> | <New Statement> | <Delete Statement> | <Assignment Statement> | <Increment Statement> | <Decrement Statement> | <Sscanf Statement> | < Sleep Statement > | < Result Statement> | <MoveLogFile> | <CopyLogFile> | <Local Statement> |
| <Function Statement> | Function < Identifier> <Script> EndFunction |
| <Function Call> | < Identifier> <Parameters> |
| <Ignore Result Statement> | IgnoreResult <Script> EndIgnoreResult |
| <If Statament> | If <Conditional Statement> Then <script> [Else <script>] EndIf |
| <Action Statement> | <Variable> [FullStop | Colon] Identifier <parameters> |
| <While Statement> | While <Conditional Statement> Do <script> EndWhile |
| <New Statement> | <Variable> Assignment New Identifier <Parameters> |
| <Delete Statement> | Delete <Variable> |
| <Assignment Statement> | [Default]<Variable> Assignment ( <Array Length Statement> | <Action Statement> | <Parameter> | <Sprintf Statement> | <Sscanf Statement> | <Array> ) |
| <Increment Statement> | <Variable> Increment |
| <Decrement Statement> | <Variable> Decrement |
| <Parameters> | OpenBracket [<parameter> {,<parameter>}] CloseBracket |
| <parameter> | Integer | Hex | Octal | Double | Bool | String | OpenSquareBracket integer CloseSquareBracket |
| <Comparison Operator> | NotEqual | LessThan | LessThanOrEqual | Equal | GreaterThanOrEqual | GreaterThan |
| <Conditional Statement> | <Variable> [FullStop Identifier <Parameters> ]<Comparison Operator> TestResult |
| <Sprintf Statement> | String { < Parameter > } |
| <Sscanf Statement > | String String |
| <Sleep Statement> | Sleep OpenBracket [ <Variable> | Integer | Double ] CloseBracket |
| <Result Statement> | TestResult |
| <Array Length Statement> | ArrayLength OpenBracket <Variable> CloseBracket |
| <BuiltInVariable> | loadyear | loadmonth | loadshortmonth | loadlongmonth | loadday | loadhour | loadminute | loadsecond | runyear | runmonth | runshortmonth | runlongmonth | runday | runhour | runminute | runsecond | currentyear | currentmonth | currentshortmonth | currentlongmonth | currentday | currenthour | currentminute | currentsecond | year | month | shortmonth | longmonth | day | hour | minute | second | randomratio | randratio | rand_max | randommax | random | rand |
| <Variable> | Identifier {[ OpenSquareBracket (Integer | <Variable>) CloseSquareBracket ]}|<BuiltInVariable> |
| <Array> | ( <Variable> | Integer | Double | Bool | String | <TestResult> | OpenSquareBracket <Array> CloseSquareBracket ) [ , <array> ] |
| <ScriptDirectory> | ScriptDir |
| <MoveLogFile> | MoveLogFile OpenBracket <Variable> CloseBracket |
| <CopyLogFile> | CopyLogFile OpenBracket <Variable> CloseBracket |
| <Local Statement> | Local Identifier <Assignment Statement> |
An action can be called in two ways, the first with a full stop will log all passes and failure whereas using a colon will log only failures. This allows the script writer to reduce the size of the results file for actions that are not critical to the overall result.
The Sprintf statement allows you to format a string and assign it to a variable. The sprint statement has the format string sprintf(string format, ...). It can therefore be used via the assignment statement e.g.
Str = Sprintf(“Hello %s”,”World”)
In this example Str would equal “Hello World”
The Sscanf statements allow you to extract values from a string and has the format var = sscanf(string format,string text). Please note that although this is called sscanf the format for the function is not the same as in the C library due to the fact that the results are returned as an array rather than entered into supplied parameters. Also the input string comes after the format string. It is therefore used via the assignment statement e.g.
Var = Sscanf(“%s %s”,”Hello World”)
In this example Var would be an array where Var[0] = “Hello” and Var[1] = “World”
The Sleep statement allows you pause for a number of seconds or fraction of seconds if a double is used. Please note that the sleep statement only guarantees a minimum wait and that the actual wait can be longer.
The arraylength command returns the number of values in an array e.g.
Given Var from the sscanf statement arraylength(Var) would return 2.
If you add the keyword default before a variable assignment the assignment will only take place if the variable does not already exist either from the script or as a system variable. This allows you to have default values for variables that can be overridden if required e.g.
default loopcount = 10
If you wish to define a different loopcount then add a system variable called loopcount with the new value.
The built in variables provide date and time values for three points in time plus random numbers. Values preceded with Current or nothing are for current date/time, values preceded with load are the date/time at which the script was loaded and values preceded with run are the date/time when the script was started.
| year | The four digit integer value for the year such as 2010 |
| month | The integer value for the month (1 .. 12) |
| shortmonth | The three character value representing the month ("Jan" .. "Dec") |
| longmonth | The full month string ("January" .. "December") |
| day | The integer day (1 .. 31) |
| hour | The integer hour (0 .. 23) |
| minute | The integer minute (0 .. 60) |
| second | The integer second (0 .. 60) |
| randomratio or randratio | A random number between 0 and 1. Each time this is read the value will be different. |
| random or rand | An integer between 0 and randommax (0x7fffffff). Each time this is read the value will be different. |
| randommax or rand_max | 0x7fffffff - The max value of rand/random variable. |
The ScriptDirectory command provides the full path to the directory from which the script was loaded. This can be used to ensure your script is directory independent when requiring test files. To obtain the full path to a test file located in the same directory as the script use the sprintf statement e. g. :-
filename = sprintf("%smyfile.txt",scriptdir)
Move and Copy Log file allows you to add bespoke log files to the results directory. These can be defined at any point in the script but the actual move/copy takes place once the script is complete and the log file name is given the same name as the script results file followed by the actual filename. e.g.
movelogfile("C:\MyLogFile.txt")
This will move the file C:\MyLogFile.txt to the results directory at script completion if it exists. Should a failure occur the log file will indicate the problem. Please note you can include wild card chars in the file name as well as using a string variable. Use the copylogfile command to copy instead of move the file(s).
The local keyword can be added to a variable assignment/declaration in order to limit its scope to the current script nesting level.