[system] / trunk / pg / macros / Parser.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/Parser.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 3588 Revision 4983
29# 29#
30# Parse a formula and evaluate it 30# Parse a formula and evaluate it
31# 31#
32sub Compute { 32sub Compute {
33 my $string = shift; 33 my $string = shift;
34 my $formula = Formula($string)->eval(@_); 34 my $formula = Formula($string);
35 $formula = $formula->eval(@_) if scalar(@_) || $formula->isConstant;
35 $formula->{correct_ans} = $string; 36 $formula->{correct_ans} = $string;
36 return $formula; 37 return $formula;
37} 38}
38 39
39# 40#
40# Deal with contexts 41# Deal with contexts
41# 42#
42sub Context {Parser::Context->current(\%context,@_)} 43sub Context {Parser::Context->current(\%context,@_)}
43%context = (); # locally defined contexts, including 'current' context 44%context = (); # locally defined contexts, including 'current' context
44Context(); # Initialize context (for persistent mod_perl) 45Context(); # Initialize context (for persistent mod_perl)
45 46
46########################################################################### 47###########################################################################
47# 48#
48# stubs for trigonometric functions 49# stubs for trigonometric functions
49# 50#

Legend:
Removed from v.3588  
changed lines
  Added in v.4983

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9