Parent Directory
|
Revision Log
Updates to allow string matches to be case-insensitive. This is now
the default, and can be overridden in the Context by setting the
string's "caseSensitive" attribute. e.g.:
Context()->strings->add("FooBar"=>{caseSensitive=>1});
would rewuire "FooBar" to be entered exactly as typed.
1 loadMacros("Parser.pl","contextString.pl"); 2 3 sub _contextTF_init {}; # don't load it again 4 5 ########################################################## 6 # 7 # Implements contexts for string-valued answers especially 8 # for matching problems (where you match against T and F). 9 # 10 # Context("TF"); 11 # 12 # You can add new strings to the context as needed (or remove old ones) 13 # via the Context()->strings->add() and Context()-strings->remove() 14 # methods. 15 # 16 # Use 17 # 18 # ANS(string_cmp("T","F")); 19 # 20 # when there are two answers, the first being "T" and the second being "F". 21 # 22 23 $context{TF} = Context("String")->copy; 24 $context{TF}->strings->are( 25 "T" => {value => 1}, 26 "F" => {value => 0}, 27 "True" => {alias => "T"}, 28 "False" => {alias => "F"}, 29 ); 30 31 Context("TF"); 32 33
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |