Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: Source/bindings/scripts/IDLParser.pm

Issue 14044026: Ready for latest WebIDL for named property getters. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: removed debug code Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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->parseSpecial());
haraken 2013/04/26 11:47:15 I think this isn't needed.
1211 push(@$specials, @{$self->parseSpecials()});
1210 my $returnType = $self->parseReturnType(); 1212 my $returnType = $self->parseReturnType();
1211 my $interface = $self->parseOperationRest($extendedAttributeList); 1213 my $interface = $self->parseOperationRest($extendedAttributeList);
1212 if (defined ($interface)) { 1214 if (defined ($interface)) {
1213 $interface->signature->type($returnType); 1215 $interface->signature->type($returnType);
1216 $interface->signature->specials($specials);
haraken 2013/04/26 11:47:15 You can also write: my @specials = (); push(@spec
kojih 2013/04/26 12:03:24 I like that style, but it's OK :)
haraken 2013/04/26 12:09:52 Other parts of IDLParser.pm uses 'my @foo=...' sty
1214 } 1217 }
1215 return $interface; 1218 return $interface;
1216 } 1219 }
1217 $self->assertUnexpectedToken($next->value(), __LINE__); 1220 $self->assertUnexpectedToken($next->value(), __LINE__);
1218 } 1221 }
1219 1222
1220 sub parseSpecials 1223 sub parseSpecials
1221 { 1224 {
1222 my $self = shift; 1225 my $self = shift;
1226 my $specials = [];
1223 1227
1224 while (1) { 1228 while (1) {
1225 my $next = $self->nextToken(); 1229 my $next = $self->nextToken();
1226 if ($next->value() =~ /$nextSpecials_1/) { 1230 if ($next->value() =~ /$nextSpecials_1/) {
1227 $self->parseSpecial(); 1231 push(@$specials, $self->parseSpecial());
1228 } else { 1232 } else {
1229 last; 1233 last;
1230 } 1234 }
1231 } 1235 }
1232 return []; 1236 return $specials;
haraken 2013/04/26 11:47:15 Ditto. You can write: my @specials = (); push(@sp
1233 } 1237 }
1234 1238
1235 sub parseSpecial 1239 sub parseSpecial
1236 { 1240 {
1237 my $self = shift; 1241 my $self = shift;
1238 my $next = $self->nextToken(); 1242 my $next = $self->nextToken();
1239 if ($next->value() eq "getter") { 1243 if ($next->value() eq "getter") {
1240 $self->assertTokenValue($self->getToken(), "getter", __LINE__); 1244 $self->assertTokenValue($self->getToken(), "getter", __LINE__);
1241 return "getter"; 1245 return "getter";
1242 } 1246 }
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 $customConstructor->{overloadedIndex} = $index++; 2213 $customConstructor->{overloadedIndex} = $index++;
2210 push(@{$interface->customConstructors}, $customConstructor); 2214 push(@{$interface->customConstructors}, $customConstructor);
2211 } 2215 }
2212 delete $extendedAttributeList->{"CustomConstructors"}; 2216 delete $extendedAttributeList->{"CustomConstructors"};
2213 $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING"; 2217 $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING";
2214 } 2218 }
2215 $interface->extendedAttributes($extendedAttributeList); 2219 $interface->extendedAttributes($extendedAttributeList);
2216 } 2220 }
2217 2221
2218 1; 2222 1;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698