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 library is free software; you can redistribute it and/or | 6 # This library is free software; you can redistribute it and/or |
7 # modify it under the terms of the GNU Library General Public | 7 # modify it under the terms of the GNU Library General Public |
8 # License as published by the Free Software Foundation; either | 8 # License as published by the Free Software Foundation; either |
9 # version 2 of the License, or (at your option) any later version. | 9 # version 2 of the License, or (at your option) any later version. |
10 # | 10 # |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 isStatic => '$', | 68 isStatic => '$', |
69 signature => '$', # Attribute signature | 69 signature => '$', # Attribute signature |
70 getterExceptions => '@', # Possibly raised exceptions. | 70 getterExceptions => '@', # Possibly raised exceptions. |
71 setterExceptions => '@', # Possibly raised exceptions. | 71 setterExceptions => '@', # Possibly raised exceptions. |
72 }); | 72 }); |
73 | 73 |
74 # Used to represent a map of 'variable name' <-> 'variable type' | 74 # Used to represent a map of 'variable name' <-> 'variable type' |
75 struct( domSignature => { | 75 struct( domSignature => { |
76 name => '$', # Variable name | 76 name => '$', # Variable name |
77 type => '$', # Variable type | 77 type => '$', # Variable type |
| 78 specials => '@', # Specials |
78 extendedAttributes => '$', # Extended attributes | 79 extendedAttributes => '$', # Extended attributes |
79 isOptional => '$', # Is variable optional (optional T) | 80 isOptional => '$', # Is variable optional (optional T) |
80 isNullable => '$', # Is variable type Nullable (T?) | 81 isNullable => '$', # Is variable type Nullable (T?) |
81 isVariadic => '$' # Is variable variadic (long... numbers) | 82 isVariadic => '$' # Is variable variadic (long... numbers) |
82 }); | 83 }); |
83 | 84 |
84 # Used to represent string constants | 85 # Used to represent string constants |
85 struct( domConstant => { | 86 struct( domConstant => { |
86 name => '$', # DOM Constant identifier | 87 name => '$', # DOM Constant identifier |
87 type => '$', # Type of data | 88 type => '$', # Type of data |
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 $self->assertUnexpectedToken($next->value(), __LINE__); | 1199 $self->assertUnexpectedToken($next->value(), __LINE__); |
1199 } | 1200 } |
1200 | 1201 |
1201 sub parseSpecialOperation | 1202 sub parseSpecialOperation |
1202 { | 1203 { |
1203 my $self = shift; | 1204 my $self = shift; |
1204 my $extendedAttributeList = shift; | 1205 my $extendedAttributeList = shift; |
1205 | 1206 |
1206 my $next = $self->nextToken(); | 1207 my $next = $self->nextToken(); |
1207 if ($next->value() =~ /$nextSpecials_1/) { | 1208 if ($next->value() =~ /$nextSpecials_1/) { |
1208 $self->parseSpecial(); | 1209 my @specials = (); |
1209 $self->parseSpecials(); | 1210 push(@specials, @{$self->parseSpecials()}); |
1210 my $returnType = $self->parseReturnType(); | 1211 my $returnType = $self->parseReturnType(); |
1211 my $interface = $self->parseOperationRest($extendedAttributeList); | 1212 my $interface = $self->parseOperationRest($extendedAttributeList); |
1212 if (defined ($interface)) { | 1213 if (defined ($interface)) { |
1213 $interface->signature->type($returnType); | 1214 $interface->signature->type($returnType); |
| 1215 $interface->signature->specials(\@specials); |
1214 } | 1216 } |
1215 return $interface; | 1217 return $interface; |
1216 } | 1218 } |
1217 $self->assertUnexpectedToken($next->value(), __LINE__); | 1219 $self->assertUnexpectedToken($next->value(), __LINE__); |
1218 } | 1220 } |
1219 | 1221 |
1220 sub parseSpecials | 1222 sub parseSpecials |
1221 { | 1223 { |
1222 my $self = shift; | 1224 my $self = shift; |
| 1225 my @specials = (); |
1223 | 1226 |
1224 while (1) { | 1227 while (1) { |
1225 my $next = $self->nextToken(); | 1228 my $next = $self->nextToken(); |
1226 if ($next->value() =~ /$nextSpecials_1/) { | 1229 if ($next->value() =~ /$nextSpecials_1/) { |
1227 $self->parseSpecial(); | 1230 push(@specials, $self->parseSpecial()); |
1228 } else { | 1231 } else { |
1229 last; | 1232 last; |
1230 } | 1233 } |
1231 } | 1234 } |
1232 return []; | 1235 return \@specials; |
1233 } | 1236 } |
1234 | 1237 |
1235 sub parseSpecial | 1238 sub parseSpecial |
1236 { | 1239 { |
1237 my $self = shift; | 1240 my $self = shift; |
1238 my $next = $self->nextToken(); | 1241 my $next = $self->nextToken(); |
1239 if ($next->value() eq "getter") { | 1242 if ($next->value() eq "getter") { |
1240 $self->assertTokenValue($self->getToken(), "getter", __LINE__); | 1243 $self->assertTokenValue($self->getToken(), "getter", __LINE__); |
1241 return "getter"; | 1244 return "getter"; |
1242 } | 1245 } |
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2209 $customConstructor->{overloadedIndex} = $index++; | 2212 $customConstructor->{overloadedIndex} = $index++; |
2210 push(@{$interface->customConstructors}, $customConstructor); | 2213 push(@{$interface->customConstructors}, $customConstructor); |
2211 } | 2214 } |
2212 delete $extendedAttributeList->{"CustomConstructors"}; | 2215 delete $extendedAttributeList->{"CustomConstructors"}; |
2213 $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING"; | 2216 $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING"; |
2214 } | 2217 } |
2215 $interface->extendedAttributes($extendedAttributeList); | 2218 $interface->extendedAttributes($extendedAttributeList); |
2216 } | 2219 } |
2217 | 2220 |
2218 1; | 2221 1; |
OLD | NEW |