diff options
author | James H. Hill <hilljh82@gmail.com> | 2010-06-28 18:01:41 +0000 |
---|---|---|
committer | James H. Hill <hilljh82@gmail.com> | 2010-06-28 18:01:41 +0000 |
commit | e0a671d84f8f017fb06b23fe584f97007ae5aaf4 (patch) | |
tree | ea1f497bf1864ef971fdec7ffbf12fbfde726d21 | |
parent | 63bb237c8b5c5949b93c9301c390c68ea4bffe03 (diff) | |
download | MPC-e0a671d84f8f017fb06b23fe584f97007ae5aaf4.tar.gz |
Mon Jun 28 18:01:08 UTC 2010 James H. Hill <hillj at cs dot iupui dot edu>
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | modules/WorkspaceCreator.pm | 53 |
2 files changed, 39 insertions, 22 deletions
@@ -1,10 +1,16 @@ +Mon Jun 28 18:01:08 UTC 2010 James H. Hill <hillj at cs dot iupui dot edu> + + * modules/WorkspaceCreator.pm: + + Reverted change below. + Mon Jun 28 16:26:00 UTC 2010 James H. Hill <hillj at cs dot iupui dot edu> * modules/WorkspaceCreator.pm: Bug fix where the negated types in excludes () were not handled correctly. - + Mon Jun 28 05:55:54 UTC 2010 James H. Hill <hillj at cs dot iupui dot edu> * templates/wix.mpd: diff --git a/modules/WorkspaceCreator.pm b/modules/WorkspaceCreator.pm index 0158f01e..ac29ff51 100644 --- a/modules/WorkspaceCreator.pm +++ b/modules/WorkspaceCreator.pm @@ -379,10 +379,8 @@ sub parse_scope { sub process_types { my($self, $typestr) = @_; my $wcprops = $self->get_properties(); - my $negated = (index($typestr, '!') >= 0); my %types; my %props; - @types{split(/\s*,\s*/, $typestr)} = (); ## If there is a property in the typestr, i.e., prop:, then @@ -407,15 +405,6 @@ sub process_types { } } - ## If there is at least one negated type or property in this exclude - ## section, then we need to include our project type in the list. This - ## is because we are now part of the 'excludes' by default becuase of - ## the negated bahvior. If we should not be apart of this list, then - ## our type will appear as a negated type as well. - if ($negated) { - $types{$self->{wctype}} = 1; - } - ## Now, process the properties and determine if this project ## type should be excluded. This will be the case if the property ## is valid and there exists a match between the listed properties @@ -454,14 +443,12 @@ sub parse_exclude { my($self, $fh, $typestr, $flags) = @_; my $status = 0; my $errorString = 'Unable to process exclude'; + my $negated = (index($typestr, '!') >= 0); my $types = $self->process_types($typestr); my $count = 1; my @exclude; if (exists $$types{$self->{wctype}}) { - ## Since we found our project type in the excludes listing, we need - ## to remove this scope from the workspace. - while(<$fh>) { my $line = $self->preprocess_line($fh, $_); @@ -517,13 +504,37 @@ sub parse_exclude { } } else { - ## Since the project type was not found in the excludes listing, - ## we can parse this scope and add it to the current workspace. - ($status, $errorString) = $self->SUPER::parse_scope($fh, - 'exclude', - $typestr, - \%validNames, - $flags); + if ($negated) { + ($status, $errorString) = $self->SUPER::parse_scope($fh, + 'exclude', + $typestr, + \%validNames, + $flags); + } + else { + ## If this exclude block didn't match the current type and the + ## exclude wasn't negated, we need to eat the exclude block so that + ## these lines don't get included into the workspace. + while(<$fh>) { + my $line = $self->preprocess_line($fh, $_); + + if ($line =~ /^(\w+)\s*(\([^\)]+\))?\s*{$/) { + ++$count; + } + elsif ($line =~ /^}(.*)$/) { + --$count; + if (defined $1 && $1 ne '') { + $status = 0; + $errorString = "Trailing characters found: '$1'"; + } + else { + $status = 1; + $errorString = undef; + } + last if ($count == 0); + } + } + } } return $status, $errorString; |