~kosova/+junk/tuxfamily-twiki

« back to all changes in this revision

Viewing changes to foswiki/lib/Foswiki/If/Parser.pm

  • Committer: James Michael DuPont
  • Date: 2009-07-18 19:58:49 UTC
  • Revision ID: jamesmikedupont@gmail.com-20090718195849-vgbmaht2ys791uo2
added foswiki

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# See bottom of file for copyright and license details
 
2
 
 
3
=begin TML
 
4
 
 
5
---+ package Foswiki::If::Parser
 
6
 
 
7
Support for the conditions in %IF{} statements.
 
8
 
 
9
=cut
 
10
 
 
11
package Foswiki::If::Parser;
 
12
use base 'Foswiki::Query::Parser';
 
13
 
 
14
use strict;
 
15
use Assert;
 
16
use Foswiki::If::Node;
 
17
 
 
18
sub new {
 
19
    my ($class) = @_;
 
20
 
 
21
    my $this = $class->SUPER::new(
 
22
        {
 
23
            nodeClass => 'Foswiki::If::Node',
 
24
            words     => qr/([A-Z][A-Z0-9_:]+|({[A-Z0-9_]+})+)/i
 
25
        }
 
26
    );
 
27
    die "{Operators}{If} is undefined; re-run configure"
 
28
      unless defined( $Foswiki::cfg{Operators}{If} );
 
29
    foreach my $op ( @{ $Foswiki::cfg{Operators}{If} } ) {
 
30
        eval "require $op";
 
31
        ASSERT( !$@ ) if DEBUG;
 
32
        $this->addOperator( $op->new() );
 
33
    }
 
34
 
 
35
    return $this;
 
36
}
 
37
 
 
38
1;
 
39
 
 
40
__DATA__
 
41
 
 
42
Module of Foswiki - The Free and Open Source Wiki, http://foswiki.org/, http://Foswiki.org/
 
43
 
 
44
# Copyright (C) 2008-2009 Foswiki Contributors. All Rights Reserved.
 
45
# Foswiki Contributors are listed in the AUTHORS file in the root
 
46
# of this distribution. NOTE: Please extend that file, not this notice.
 
47
#
 
48
# Additional copyrights apply to some or all of the code in this
 
49
# file as follows:
 
50
#
 
51
# Copyright (C) 2005-2007 TWiki Contributors. All Rights Reserved.
 
52
# TWiki Contributors are listed in the AUTHORS file in the root
 
53
# of this distribution. NOTE: Please extend that file, not this notice.
 
54
#
 
55
This program is free software; you can redistribute it and/or
 
56
modify it under the terms of the GNU General Public License
 
57
as published by the Free Software Foundation; either version 2
 
58
of the License, or (at your option) any later version. For
 
59
more details read LICENSE in the root of this distribution.
 
60
 
 
61
This program is distributed in the hope that it will be useful,
 
62
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
63
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
64
 
 
65
As per the GPL, removal of this notice is prohibited.
 
66
 
 
67
Author: Crawford Currie http://c-dot.co.uk