summaryrefslogtreecommitdiff
path: root/modules/WorkspaceCreator.pm
diff options
context:
space:
mode:
authorJames H. Hill <hilljh82@gmail.com>2010-06-28 16:27:43 +0000
committerJames H. Hill <hilljh82@gmail.com>2010-06-28 16:27:43 +0000
commit63bb237c8b5c5949b93c9301c390c68ea4bffe03 (patch)
tree01314f93dea3e4aafaabf0cf2abafc5bb9518481 /modules/WorkspaceCreator.pm
parent6db03c25bc32882d5b3bbaa588f180d4774029ea (diff)
downloadMPC-63bb237c8b5c5949b93c9301c390c68ea4bffe03.tar.gz
Mon Jun 28 16:26:00 UTC 2010 James H. Hill <hillj at cs dot iupui dot edu>
Diffstat (limited to 'modules/WorkspaceCreator.pm')
-rw-r--r--modules/WorkspaceCreator.pm53
1 files changed, 21 insertions, 32 deletions
diff --git a/modules/WorkspaceCreator.pm b/modules/WorkspaceCreator.pm
index ac29ff51..0158f01e 100644
--- a/modules/WorkspaceCreator.pm
+++ b/modules/WorkspaceCreator.pm
@@ -379,8 +379,10 @@ 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
@@ -405,6 +407,15 @@ 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
@@ -443,12 +454,14 @@ 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, $_);
@@ -504,37 +517,13 @@ sub parse_exclude {
}
}
else {
- 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);
- }
- }
- }
+ ## 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);
}
return $status, $errorString;