# expect/tcl code to test the das scanner # jhrg # # $Log: scanner.4.exp,v $ # Revision 1.3 2002/06/03 22:21:16 jimg # Merged with release-3-2-9 # # Revision 1.2.54.1 2001/11/01 00:43:52 jimg # Fixes to the scanners and parsers so that dataset variable names may # start with digits. I've expanded the set of characters that may appear # in a variable name and made it so that all except `#' may appear at # the start. Some characters are not allowed in variables that appear in # a DDS or CE while they are allowed in the DAS. This makes it possible # to define containers with names like `COARDS:long_name.' Putting a colon # in a variable name makes the CE parser much more complex. Since the set # of characters that people want seems pretty limited (compared to the # complete ASCII set) I think this is an OK approach. If we have to open # up the expr.lex scanner completely, then we can but not without adding # lots of action clauses to teh parser. Note that colon is just an example, # there's a host of characters that are used in CEs that are not allowed # in IDs. # # Revision 1.2 1997/05/05 20:29:11 jimg # *** empty log message *** # # Revision 1.1 1996/07/16 16:54:35 jimg # Added. # # global comp_output # contains output from das-test_start global verbose # this and srcdir are set by runtest.exp global srcdir set test_name scanner.4 set prompt "das-test:" set timeout 2 set pass 1 das-test_start s expect { "${prompt} " { } timeout { send_user "Timeout\n" set pass 0 } } if {$pass} { set thing "\"Attributes\"\r\n" send $thing expect { -re ".*WORD=${thing}${prompt} $" { } timeout { send_user "Timeout\n" set pass 0 } } } # Check that all the special characters pass through the scanner. *DON'T* # mess with the strings THING and THING2! In THING2 all the special chars are # prefixed by `\\' except `[' which is prefixed by `\\\'; the first two `\'s' # yeild a single `\', the third `\' escapes the `['. NB: the `[' in THING is # also escaped. The left bracket is special in Tcl even in a string if {$pass} { set thing "\"This is a long nasty string that has some special characters\ embedded:!@#$%^&*()_+|~-=`,./;'\[]{}:<>?\"\r\n" set thing2 "\"This is a long nasty string that has some special characters\ embedded:!@#\\$\\%\\^\\&\\*\\(\\)\\_\\+\\|\\~\\-\\=\\`\\,\\.\\/\\;\\'\\\[\\]\\{\\}\\:\\<\\>\\?\"\r\n" send $thing expect { -re ".*WORD=${thing2}${prompt} $" { } timeout { send_user "Timeout\n" set pass 0 } } } # Strange case where unquoted sequence of characters `falls through' the # scanner cases for WORD, Float and int and winds up a string. Maybe we should # not allow this to happen? 7/15/96 if {$pass} { set thing "a_0.9\r\n" send $thing expect { -re ".*WORD=${thing}${prompt} $" { } timeout { send_user "Timeout\n" set pass 0 } } } if {$pass} { pass $test_name } else { fail $test_name } das-test_exit