From: dpvc v. a. <we...@ma...> - 2005-08-30 00:40:36
|
Log Message: ----------- Added a parserCustomization.pl file that is loaded whenever the Parser.pl file is. This can be used on a course-by-course basis to customize features of the Parser. Some examples are listed in the file. You need to be VERY careful when doing this, as this will affect ALL problems that use the Parser. Your changes may cause some .pg files to fail if they rely on the default behavior that you are changing. If you wish to override settings in one of the predefined contexts (like "Vector"), then define $context{Vector} as a copy of $Parser::Context::Default::context{Vector}, as in the commented out examples. Then Context("Vector") will use your copy rather than the original. If you were to change the version in Parser::Context::Default, that would change the parser for ALL courses, not just yours. Modified Files: -------------- pg/macros: Parser.pl Added Files: ----------- pg/macros: parserCustomization.pl Revision Data ------------- Index: Parser.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/Parser.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -Lmacros/Parser.pl -Lmacros/Parser.pl -u -r1.5 -r1.6 --- macros/Parser.pl +++ macros/Parser.pl @@ -157,6 +157,8 @@ sub _Parser_init {}; # don't let loadMacros load it again +loadMacros("parserCustomization.pl"); + ########################################################################### 1; --- /dev/null +++ macros/parserCustomization.pl @@ -0,0 +1,30 @@ +sub _parserCustomization_init {} + +# +# Copy this file to your course templates directory and put any +# customization for the Parser that you want for your course +# here. For example, you can make vectors display using +# ijk notation (and force students to use it for entering +# vectors) by uncommenting: +# +# $context{Vector} = $Parser::Context::Default::context{Vector}->copy; +# $context{Vector}->flags->set(ijk=>1); +# $context{Vector}->parens->remove('<'); +# +# To allow vectors to be entered with parens (and displayed with +# parens) rather than angle-brakets, uncomment +# +# $context{Vector} = $Parser::Context::Default::context{Vector}->copy; +# $context{Vector}->{cmpDefaults}{Vector} = {promotePoints => 1}; +# $context{Vector}->lists->set(Vector=>{open=>'(', close=>')'}); +# +# (This actually just turns points into vectors in the answer checker +# for vectors, and displays vectors using parens rather than angle +# brakets. The student is really still entering what the Parser +# thinks is a point, but since points get promoted automatically +# in the Value package, that should work. But if a problem checks +# if a student's value is actually a Vector, that will not be true.) +# + + +1; |