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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 struct( callbackFunction => { | 44 struct( callbackFunction => { |
45 name => '$', | 45 name => '$', |
46 type => '$', | 46 type => '$', |
47 parameters => '@', | 47 parameters => '@', |
48 }); | 48 }); |
49 | 49 |
50 # Used to represent 'interface' blocks | 50 # Used to represent 'interface' blocks |
51 struct( domInterface => { | 51 struct( domInterface => { |
52 name => '$', # Class identifier | 52 name => '$', # Class identifier |
53 parents => '@', # List of strings | 53 parent => '$', # Parent class identifier |
54 constants => '@', # List of 'domConstant' | 54 constants => '@', # List of 'domConstant' |
55 functions => '@', # List of 'domFunction' | 55 functions => '@', # List of 'domFunction' |
56 attributes => '@', # List of 'domAttribute' | 56 attributes => '@', # List of 'domAttribute' |
57 extendedAttributes => '$', # Extended attributes | 57 extendedAttributes => '$', # Extended attributes |
58 constructors => '@', # Constructors, list of 'domFunction' | 58 constructors => '@', # Constructors, list of 'domFunction' |
59 customConstructors => '@', # Custom constructors, list of 'domFunction' | 59 customConstructors => '@', # Custom constructors, list of 'domFunction' |
60 isException => '$', # Used for exception interfaces | 60 isException => '$', # Used for exception interfaces |
61 isCallback => '$', # Used for callback interfaces | 61 isCallback => '$', # Used for callback interfaces |
62 isPartial => '$', # Used for partial interfaces | 62 isPartial => '$', # Used for partial interfaces |
63 }); | 63 }); |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 my $self = shift; | 508 my $self = shift; |
509 my $extendedAttributeList = shift; | 509 my $extendedAttributeList = shift; |
510 | 510 |
511 my $next = $self->nextToken(); | 511 my $next = $self->nextToken(); |
512 if ($next->value() eq "interface") { | 512 if ($next->value() eq "interface") { |
513 my $interface = domInterface->new(); | 513 my $interface = domInterface->new(); |
514 $self->assertTokenValue($self->getToken(), "interface", __LINE__); | 514 $self->assertTokenValue($self->getToken(), "interface", __LINE__); |
515 my $interfaceNameToken = $self->getToken(); | 515 my $interfaceNameToken = $self->getToken(); |
516 $self->assertTokenType($interfaceNameToken, IdentifierToken); | 516 $self->assertTokenType($interfaceNameToken, IdentifierToken); |
517 $interface->name($interfaceNameToken->value()); | 517 $interface->name($interfaceNameToken->value()); |
518 push(@{$interface->parents}, @{$self->parseInheritance()}); | 518 $interface->parent($self->parseInheritance()); |
519 $self->assertTokenValue($self->getToken(), "{", __LINE__); | 519 $self->assertTokenValue($self->getToken(), "{", __LINE__); |
520 my $interfaceMembers = $self->parseInterfaceMembers(); | 520 my $interfaceMembers = $self->parseInterfaceMembers(); |
521 $self->assertTokenValue($self->getToken(), "}", __LINE__); | 521 $self->assertTokenValue($self->getToken(), "}", __LINE__); |
522 $self->assertTokenValue($self->getToken(), ";", __LINE__); | 522 $self->assertTokenValue($self->getToken(), ";", __LINE__); |
523 applyMemberList($interface, $interfaceMembers); | 523 applyMemberList($interface, $interfaceMembers); |
524 applyExtendedAttributeList($interface, $extendedAttributeList); | 524 applyExtendedAttributeList($interface, $extendedAttributeList); |
525 return $interface; | 525 return $interface; |
526 } | 526 } |
527 $self->assertUnexpectedToken($next->value(), __LINE__); | 527 $self->assertUnexpectedToken($next->value(), __LINE__); |
528 } | 528 } |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 my $extendedAttributeList = shift; | 706 my $extendedAttributeList = shift; |
707 | 707 |
708 my $next = $self->nextToken(); | 708 my $next = $self->nextToken(); |
709 if ($next->value() eq "exception") { | 709 if ($next->value() eq "exception") { |
710 my $interface = domInterface->new(); | 710 my $interface = domInterface->new(); |
711 $self->assertTokenValue($self->getToken(), "exception", __LINE__); | 711 $self->assertTokenValue($self->getToken(), "exception", __LINE__); |
712 my $exceptionNameToken = $self->getToken(); | 712 my $exceptionNameToken = $self->getToken(); |
713 $self->assertTokenType($exceptionNameToken, IdentifierToken); | 713 $self->assertTokenType($exceptionNameToken, IdentifierToken); |
714 $interface->name($exceptionNameToken->value()); | 714 $interface->name($exceptionNameToken->value()); |
715 $interface->isException(1); | 715 $interface->isException(1); |
716 push(@{$interface->parents}, @{$self->parseInheritance()}); | 716 $interface->parent($self->parseInheritance()); |
717 $self->assertTokenValue($self->getToken(), "{", __LINE__); | 717 $self->assertTokenValue($self->getToken(), "{", __LINE__); |
718 my $exceptionMembers = $self->parseExceptionMembers(); | 718 my $exceptionMembers = $self->parseExceptionMembers(); |
719 $self->assertTokenValue($self->getToken(), "}", __LINE__); | 719 $self->assertTokenValue($self->getToken(), "}", __LINE__); |
720 $self->assertTokenValue($self->getToken(), ";", __LINE__); | 720 $self->assertTokenValue($self->getToken(), ";", __LINE__); |
721 applyMemberList($interface, $exceptionMembers); | 721 applyMemberList($interface, $exceptionMembers); |
722 applyExtendedAttributeList($interface, $extendedAttributeList); | 722 applyExtendedAttributeList($interface, $extendedAttributeList); |
723 return $interface; | 723 return $interface; |
724 } | 724 } |
725 $self->assertUnexpectedToken($next->value(), __LINE__); | 725 $self->assertUnexpectedToken($next->value(), __LINE__); |
726 } | 726 } |
(...skipping 15 matching lines...) Expand all Loading... |
742 } else { | 742 } else { |
743 last; | 743 last; |
744 } | 744 } |
745 } | 745 } |
746 return \@members; | 746 return \@members; |
747 } | 747 } |
748 | 748 |
749 sub parseInheritance | 749 sub parseInheritance |
750 { | 750 { |
751 my $self = shift; | 751 my $self = shift; |
752 my @parent = (); | 752 my $parent; |
753 | 753 |
754 my $next = $self->nextToken(); | 754 my $next = $self->nextToken(); |
755 if ($next->value() eq ":") { | 755 if ($next->value() eq ":") { |
756 $self->assertTokenValue($self->getToken(), ":", __LINE__); | 756 $self->assertTokenValue($self->getToken(), ":", __LINE__); |
757 my $scopedName = $self->parseScopedName(); | 757 $parent = $self->parseScopedName(); |
758 push(@parent, $scopedName); | |
759 # Multiple inheritance? | |
760 push(@parent, @{$self->parseIdentifiers()}); | |
761 } | 758 } |
762 return \@parent; | 759 return $parent; |
763 } | 760 } |
764 | 761 |
765 sub parseEnum | 762 sub parseEnum |
766 { | 763 { |
767 my $self = shift; | 764 my $self = shift; |
768 my $extendedAttributeList = shift; # ignored: Extended attributes are not ap
plicable to enumerations | 765 my $extendedAttributeList = shift; # ignored: Extended attributes are not ap
plicable to enumerations |
769 | 766 |
770 my $next = $self->nextToken(); | 767 my $next = $self->nextToken(); |
771 if ($next->value() eq "enum") { | 768 if ($next->value() eq "enum") { |
772 my $enum = domEnum->new(); | 769 my $enum = domEnum->new(); |
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2233 $customConstructor->overloadedIndex($index++); | 2230 $customConstructor->overloadedIndex($index++); |
2234 push(@{$interface->customConstructors}, $customConstructor); | 2231 push(@{$interface->customConstructors}, $customConstructor); |
2235 } | 2232 } |
2236 delete $extendedAttributeList->{"CustomConstructors"}; | 2233 delete $extendedAttributeList->{"CustomConstructors"}; |
2237 $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING"; | 2234 $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING"; |
2238 } | 2235 } |
2239 $interface->extendedAttributes($extendedAttributeList); | 2236 $interface->extendedAttributes($extendedAttributeList); |
2240 } | 2237 } |
2241 | 2238 |
2242 1; | 2239 1; |
OLD | NEW |