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

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

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

Revision 5373 Revision 5392
1 1
2loadMacros("MathObjects.pl"); 2loadMacros("MathObjects.pl");
3
4sub _contextLimitedNumeric_init {}; # don't load it again
5 3
6=head3 Context("LimitedNumeric") 4=head3 Context("LimitedNumeric")
7 5
8 ########################################################## 6 ##########################################################
9 # 7 #
15 # one of the following commands: 13 # one of the following commands:
16 # 14 #
17 # Context("LimitedNumeric-list"); 15 # Context("LimitedNumeric-list");
18 # Context("LimiteNumeric"); 16 # Context("LimiteNumeric");
19 # 17 #
18 # (Now uses Parcer::Legacy::LimitedNumeric to implement
19 # these contexts.)
20 20
21=cut 21=cut
22 22
23package LimitedNumeric::UOP::minus; 23##################################################
24our @ISA = qw(Parser::UOP::minus);
25 24
26sub _check { 25sub _contextLimitedNumeric_init {
27 my $self = shift; 26
28 $self->SUPER::_check; 27 my $context = $main::context{"LimitedNumeric-List"} = Parser::Context->getCopy("LimitedNumeric");
29 my $uop = $self->{def}{string} || $self->{uop}; 28 $context->operators->redefine(',');
30 $self->Error("Can't use '%s' in this context",$uop) 29
31 unless $self->{op}->class eq 'Number'; 30 main::Context("LimitedNumeric"); ### FIXME: probably should require the author to set this explicitly
32} 31}
33 32
34package main;
35
36$context{LimitedNumeric} = Context("Numeric");
37$context{LimitedNumeric}->operators->set('u-' => {class => 'LimitedNumeric::UOP::minus'});
38$context{LimitedNumeric}->operators->undefine(
39 '+', '-', '*', '* ', ' *', ' ', '/', '/ ', ' /', '^', '**',
40 'U', '.', '><', 'u+', '!', '_',
41);
42$context{LimitedNumeric}->parens->undefine('|','{','(','[');
43Parser::Context::Functions::Disable('All');
44
45$context{'LimitedNumeric-List'} = $context{LimitedNumeric}->copy;
46
47$context{LimitedNumeric}->operators->undefine(',');
48
49Context("LimitedNumeric");
50
511; 331;

Legend:
Removed from v.5373  
changed lines
  Added in v.5392

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9