filter: expression end_of_file { $return = $item[1] } | { $Persist::Filter::errors .= "ERROR: Could not parse filter.\n"; foreach (@{$thisparser->{errors}}) { $Persist::Filter::errors .= "ERROR Line $_->[1]: $_->[0]\n"; } $thisparser->{errors} = undef; } end_of_file: /^\Z/ expression: comparison logical_operator expression { $return = new Persist::Filter::Junction(@item{qw(comparison logical_operator expression)}) } | comparison | /not/i expression { $return = new Persist::Filter::Not(lc($item[1]), $item{expression}) } | comparison: first_operand comparison_operator second_operand { $return = new Persist::Filter::Comparison(@item{qw(first_operand comparison_operator second_operand)}) } | '(' expression ')' { $return = $item{expression} } | first_operand: operand second_operand: operand operand: identifier | literal | placeholder logical_operator: /and/i { $return = lc($item[1]) } | /or/i { $return = lc($item[1]) } comparison_operator: '=' | '<>' | /<=?/ | />=?/ | /(?:not\s+)?i?like/i { $item[1] =~ s/\s+/ /; $return = lc($item[1]) } identifier: table_name '.' column_name { $return = new Persist::Filter::Identifier("$item{table_name}.$item{column_name}") } | integer '.' column_name { $return = new Persist::Filter::Identifier("$item{table_name}.$item{column_name}") } | column_name { $return = new Persist::Filter::Identifier($item{column_name}) } | table_name: name column_name: name literal: string { $return = new Persist::Filter::String($item{string}) } | number { $return = new Persist::Filter::Number($item{number}) } placeholder: '?' { $return = new Persist::Filter::Placeholder('?') } name: /[a-z_][a-z0-9_]*/i string: "'" character(s) "'" { $return = "'".(join '', @{$item{'character(s)'}})."'" } | integer: /\d+/ number: /[+-]?[0-9]*\.[0-9]+(?:e[+-]?[0-9]+)?/i { $return = lc($item[1]) } | /[+-]?[0-9]+\.?(?:e[+-]?[0-9]+)?/i { $return = lc($item[1]) } character: "\\\\'" { $return = "\\\\'" } | /[^']/ #### perl -MPersist::Filter=parse_filter,parse_errors -MData::Dumper -e \ "(\$ast = parse_filter(q(namespace = 'http://hanenkamp.com/Contentlet/Blank'))) or die(parse_errors); print Dumper(\$ast)" #### $VAR1 = bless( [ bless( do{\(my $o = 'namespace')}, 'Persist::Filter::Identifier' ), '=', bless( do{\(my $o = '\'http://hanenkamp.com/Contentlet/Blank\'')}, 'Persist::Filter::String' ) ], 'Persist::Filter::Comparison' ); #### [Thu Oct 16 11:05:08 2003] [error] [client 127.0.0.1] Unable to create starter database 'Contentment/Starter/apache-test.pl': Canno t parse filter "namespace = 'http://hanenkamp.com/Contentlet/Blank'": ERROR: Could not parse filter. in /home/sterling/projects/contentment/Contentment/ApacheDirector/t/../../../blib/lib/Contentment/Manager.pm on line 935. Compilation failed in require at (eval 108) line 1.