Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 # | 1 # | 
| 2 # KDOM IDL parser | 2 # KDOM IDL parser | 
| 3 # | 3 # | 
| 4 # Copyright (C) 2005 Nikolas Zimmermann <wildfox@kde.org> | 4 # Copyright (C) 2005 Nikolas Zimmermann <wildfox@kde.org> | 
| 5 # | 5 # | 
| 6 # This file is part of the KDE project | 6 # This file is part of the KDE project | 
| 7 # | 7 # | 
| 8 # This library is free software; you can redistribute it and/or | 8 # This library is free software; you can redistribute it and/or | 
| 9 # modify it under the terms of the GNU Library General Public | 9 # modify it under the terms of the GNU Library General Public | 
| 10 # License as published by the Free Software Foundation; either | 10 # License as published by the Free Software Foundation; either | 
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 | 34 | 
| 35 # Helper variables | 35 # Helper variables | 
| 36 my @temporaryContent = ""; | 36 my @temporaryContent = ""; | 
| 37 | 37 | 
| 38 my $parseMode = MODE_UNDEF; | 38 my $parseMode = MODE_UNDEF; | 
| 39 my $preservedParseMode = MODE_UNDEF; | 39 my $preservedParseMode = MODE_UNDEF; | 
| 40 | 40 | 
| 41 my $beQuiet; # Should not display anything on STDOUT? | 41 my $beQuiet; # Should not display anything on STDOUT? | 
| 42 my $document = 0; # Will hold the resulting 'idlDocument' | 42 my $document = 0; # Will hold the resulting 'idlDocument' | 
| 43 | 43 | 
| 44 my $directive = ""; | |
| 45 | |
| 44 # Default Constructor | 46 # Default Constructor | 
| 45 sub new | 47 sub new | 
| 46 { | 48 { | 
| 47 my $object = shift; | 49 my $object = shift; | 
| 48 my $reference = { }; | 50 my $reference = { }; | 
| 49 | 51 | 
| 50 $document = 0; | 52 $document = 0; | 
| 51 $beQuiet = shift; | 53 $beQuiet = shift; | 
| 52 | 54 | 
| 53 bless($reference, $object); | 55 bless($reference, $object); | 
| 54 return $reference; | 56 return $reference; | 
| 55 } | 57 } | 
| 56 | 58 | 
| 59 | |
| 60 sub ParseInheritance | |
| 
 
Mads Ager (chromium)
2008/09/23 06:45:09
Add a one line comment stating what the return val
 
 | |
| 61 { | |
| 62 my $object = shift; | |
| 63 my $fileName = shift; | |
| 64 my $defines = shift; | |
| 65 my $preprocessor = shift; | |
| 66 | |
| 67 $directive = "inheritance"; | |
| 68 return $object->ParseImpl($fileName, $defines, $preprocessor); | |
| 69 } | |
| 70 | |
| 57 # Returns the parsed 'idlDocument' | 71 # Returns the parsed 'idlDocument' | 
| 58 sub Parse | 72 sub Parse | 
| 59 { | 73 { | 
| 60 my $object = shift; | 74 my $object = shift; | 
| 61 my $fileName = shift; | 75 my $fileName = shift; | 
| 62 my $defines = shift; | 76 my $defines = shift; | 
| 63 my $preprocessor = shift; | 77 my $preprocessor = shift; | 
| 64 | 78 | 
| 79 $directive = ""; | |
| 80 return $object->ParseImpl($fileName, $defines, $preprocessor); | |
| 81 } | |
| 82 | |
| 83 sub ParseImpl | |
| 84 { | |
| 85 my $object = shift; | |
| 86 my $fileName = shift; | |
| 87 my $defines = shift; | |
| 88 my $preprocessor = shift; | |
| 89 | |
| 65 if (!$preprocessor) { | 90 if (!$preprocessor) { | 
| 66 $preprocessor = "/usr/bin/gcc -E -P -x c++"; | 91 $preprocessor = "/usr/bin/gcc -E -P -x c++"; | 
| 67 } | 92 } | 
| 68 | 93 | 
| 69 if (!$defines) { | 94 if (!$defines) { | 
| 70 $defines = ""; | 95 $defines = ""; | 
| 71 } | 96 } | 
| 72 | 97 | 
| 73 print " | *** Starting to parse $fileName...\n |\n" unless $beQuiet; | 98 print " | *** Starting to parse $fileName...\n |\n" unless $beQuiet; | 
| 74 | 99 | 
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 # Inheritance detection | 256 # Inheritance detection | 
| 232 my @interfaceParents = split(/,/, $interfaceBase); | 257 my @interfaceParents = split(/,/, $interfaceBase); | 
| 233 foreach(@interfaceParents) { | 258 foreach(@interfaceParents) { | 
| 234 my $line = $_; | 259 my $line = $_; | 
| 235 $line =~ s/\s*//g; | 260 $line =~ s/\s*//g; | 
| 236 | 261 | 
| 237 my $arrayRef = $dataNode->parents; | 262 my $arrayRef = $dataNode->parents; | 
| 238 push(@$arrayRef, $line); | 263 push(@$arrayRef, $line); | 
| 239 } | 264 } | 
| 240 | 265 | 
| 266 return if ($directive eq "inheritance"); | |
| 267 | |
| 241 $interfaceData =~ s/[\n\r]/ /g; | 268 $interfaceData =~ s/[\n\r]/ /g; | 
| 242 my @interfaceMethods = split(/;/, $interfaceData); | 269 my @interfaceMethods = split(/;/, $interfaceData); | 
| 243 | 270 | 
| 244 foreach my $line (@interfaceMethods) { | 271 foreach my $line (@interfaceMethods) { | 
| 245 if ($line =~ /[ \t]attribute[ \t]/) { | 272 if ($line =~ /[ \t]attribute[ \t]/) { | 
| 246 $line =~ /$IDLStructure::interfaceAttributeSelector/; | 273 $line =~ /$IDLStructure::interfaceAttributeSelector/; | 
| 247 | 274 | 
| 248 my $attributeType = (defined($1) ? $1 : die("Parsing error!\nSou rce:\n$line\n)")); | 275 my $attributeType = (defined($1) ? $1 : die("Parsing error!\nSou rce:\n$line\n)")); | 
| 249 my $attributeExtendedAttributes = (defined($2) ? $2 : " "); chop ($attributeExtendedAttributes); | 276 my $attributeExtendedAttributes = (defined($2) ? $2 : " "); chop ($attributeExtendedAttributes); | 
| 250 | 277 | 
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 | 432 | 
| 406 # FIXME: Check if alias is already in aliases | 433 # FIXME: Check if alias is already in aliases | 
| 407 my $aliases = $document->aliases; | 434 my $aliases = $document->aliases; | 
| 408 $aliases->{$interfaceName} = $wrapperName; | 435 $aliases->{$interfaceName} = $wrapperName; | 
| 409 } | 436 } | 
| 410 | 437 | 
| 411 @temporaryContent = ""; | 438 @temporaryContent = ""; | 
| 412 } | 439 } | 
| 413 | 440 | 
| 414 1; | 441 1; | 
| OLD | NEW |