[system] / trunk / pg / lib / Parser.pm Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# Diff of /trunk/pg/lib/Parser.pm

Revision 2650 Revision 2657
130 \$string = \$self->{string}; 130 \$string = \$self->{string};
131 \$ref = [\$ref->[2],\$ref->[3]]; 131 \$ref = [\$ref->[2],\$ref->[3]];
132 } 132 }
133 \$context->setError(\$message,\$string,\$ref); 133 \$context->setError(\$message,\$string,\$ref);
134 die \$message . Value::getCaller(); 134 die \$message . Value::getCaller();
135# confess \$message;
136} 135}
137 136
138# 137#
139# Insert an implicit multiplication 138# Insert an implicit multiplication
140# 139#
141sub ImplicitMult { 140sub ImplicitMult {
142 my \$self = shift; 141 my \$self = shift;
143 my \$ref = \$self->{ref}; 142 my \$ref = \$self->{ref};
143 \$self->Error("Can't perform implied multiplication in this context",\$ref)
144 unless \$self->{context}{operators}{' '}{class};
144 \$self->Op(' '); 145 \$self->Op(' ');
145 \$self->{ref} = \$ref; 146 \$self->{ref} = \$ref;
146} 147}
147 148
148# 149#
652# If the result is undef, there was an error (message is in Context()->{error} object) 653# If the result is undef, there was an error (message is in Context()->{error} object)
653# 654#
654 655
655sub Formula { 656sub Formula {
656 my \$f = shift; 657 my \$f = shift;
657 eval {Value::Formula->new(\$f)}; 658 my \$v = eval {Value::Formula->new(\$f)};
659 \$\$Value::context->setError(\$@) unless defined(\$v) ||
660 \$\$Value::context->{error}{flag};
661 return \$v;
658} 662}
659 663
660# 664#
661# Evaluate a formula, with error trapping. 665# Evaluate a formula, with error trapping.
662# If the result is undef, there was an error (message is in Context()->{error} object) 666# If the result is undef, there was an error (message is in Context()->{error} object)
664# 668#
665sub Evaluate { 669sub Evaluate {
666 my \$f = shift; 670 my \$f = shift;
667 return unless defined(\$f); 671 return unless defined(\$f);
668 my \$v = eval {\$f->eval(@_)}; 672 my \$v = eval {\$f->eval(@_)};
669 \$v = Value::makeValue(\$v) if defined(\$v); 673 if (defined(\$v)) {\$v = Value::makeValue(\$v)}
674 else {\$f->setError(\$@) unless \$f->{context}{error}{flag}}
670 return \$v; 675 return \$v;
671} 676}
672 677
673 678
674################################################## 679##################################################

Legend:
 Removed from v.2650 changed lines Added in v.2657

 aubreyja at gmail dot com ViewVC Help Powered by ViewVC 1.0.9