| 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 # | 
|    11 # This library is distributed in the hope that it will be useful, |    11 # This library is distributed in the hope that it will be useful, | 
|    12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |    12 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|    13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU |    13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
|    14 # Library General Public License for more details. |    14 # Library General Public License for more details. | 
|    15 # |    15 # | 
|    16 # You should have received a copy of the GNU Library General Public License |    16 # You should have received a copy of the GNU Library General Public License | 
|    17 # along with this library; see the file COPYING.LIB.  If not, write to |    17 # along with this library; see the file COPYING.LIB.  If not, write to | 
|    18 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |    18 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 
|    19 # Boston, MA 02110-1301, USA. |    19 # Boston, MA 02110-1301, USA. | 
|    20 # |    20 # | 
|    21  |    21  | 
|    22 package deprecated_idl_parser; |    22 package idl_parser; | 
|    23  |    23  | 
|    24 use strict; |    24 use strict; | 
|    25  |    25  | 
|    26 use preprocessor; |    26 use preprocessor; | 
|    27 use Class::Struct; |    27 use Class::Struct; | 
|    28  |    28  | 
|    29 use constant StringToken => 0; |    29 use constant StringToken => 0; | 
|    30 use constant IntegerToken => 1; |    30 use constant IntegerToken => 1; | 
|    31 use constant FloatToken => 2; |    31 use constant FloatToken => 2; | 
|    32 use constant IdentifierToken => 3; |    32 use constant IdentifierToken => 3; | 
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   145 } |   145 } | 
|   146  |   146  | 
|   147 sub assertTokenValue |   147 sub assertTokenValue | 
|   148 { |   148 { | 
|   149     my $self = shift; |   149     my $self = shift; | 
|   150     my $token = shift; |   150     my $token = shift; | 
|   151     my $value = shift; |   151     my $value = shift; | 
|   152     my $line = shift; |   152     my $line = shift; | 
|   153     my $msg = "Next token should be " . $value . ", but " . $token->value() . " 
      at " . $self->{Line}; |   153     my $msg = "Next token should be " . $value . ", but " . $token->value() . " 
      at " . $self->{Line}; | 
|   154     if (defined ($line)) { |   154     if (defined ($line)) { | 
|   155         $msg .= " deprecated_idl_parser.pm:" . $line; |   155         $msg .= " idl_parser.pm:" . $line; | 
|   156     } |   156     } | 
|   157     die $msg unless $token->value() eq $value; |   157     die $msg unless $token->value() eq $value; | 
|   158 } |   158 } | 
|   159  |   159  | 
|   160 sub assertTokenType |   160 sub assertTokenType | 
|   161 { |   161 { | 
|   162     my $self = shift; |   162     my $self = shift; | 
|   163     my $token = shift; |   163     my $token = shift; | 
|   164     my $type = shift; |   164     my $type = shift; | 
|   165     die "Next token's type should be " . $type . ", but " . $token->type() . " a
      t " . $self->{Line} unless $token->type() eq $type; |   165     die "Next token's type should be " . $type . ", but " . $token->type() . " a
      t " . $self->{Line} unless $token->type() eq $type; | 
|   166 } |   166 } | 
|   167  |   167  | 
|   168 sub assertUnexpectedToken |   168 sub assertUnexpectedToken | 
|   169 { |   169 { | 
|   170     my $self = shift; |   170     my $self = shift; | 
|   171     my $token = shift; |   171     my $token = shift; | 
|   172     my $line = shift; |   172     my $line = shift; | 
|   173     my $msg = "Unexpected token " . $token . " at " . $self->{Line}; |   173     my $msg = "Unexpected token " . $token . " at " . $self->{Line}; | 
|   174     if (defined ($line)) { |   174     if (defined ($line)) { | 
|   175         $msg .= " deprecated_idl_parser.pm:" . $line; |   175         $msg .= " idl_parser.pm:" . $line; | 
|   176     } |   176     } | 
|   177     die $msg; |   177     die $msg; | 
|   178 } |   178 } | 
|   179  |   179  | 
|   180 sub assertNoExtendedAttributesInTypedef |   180 sub assertNoExtendedAttributesInTypedef | 
|   181 { |   181 { | 
|   182     my $self = shift; |   182     my $self = shift; | 
|   183     my $name = shift; |   183     my $name = shift; | 
|   184     my $line = shift; |   184     my $line = shift; | 
|   185     my $typedef = $typedefs{$name}; |   185     my $typedef = $typedefs{$name}; | 
|   186     my $msg = "Unexpected extendedAttributeList in typedef \"$name\" at " . $sel
      f->{Line}; |   186     my $msg = "Unexpected extendedAttributeList in typedef \"$name\" at " . $sel
      f->{Line}; | 
|   187     if (defined ($line)) { |   187     if (defined ($line)) { | 
|   188         $msg .= " deprecated_idl_parser.pm:" . $line; |   188         $msg .= " idl_parser.pm:" . $line; | 
|   189     } |   189     } | 
|   190     die $msg if %{$typedef->extendedAttributes}; |   190     die $msg if %{$typedef->extendedAttributes}; | 
|   191 } |   191 } | 
|   192  |   192  | 
|   193 sub Parse |   193 sub Parse | 
|   194 { |   194 { | 
|   195     my $self = shift; |   195     my $self = shift; | 
|   196     my $fileName = shift; |   196     my $fileName = shift; | 
|   197     my $preprocessor = shift; |   197     my $preprocessor = shift; | 
|   198     my $defines = ""; |   198     my $defines = ""; | 
| (...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2240             $customConstructor->overloadedIndex($index++); |  2240             $customConstructor->overloadedIndex($index++); | 
|  2241             push(@{$interface->customConstructors}, $customConstructor); |  2241             push(@{$interface->customConstructors}, $customConstructor); | 
|  2242         } |  2242         } | 
|  2243         delete $extendedAttributeList->{"CustomConstructors"}; |  2243         delete $extendedAttributeList->{"CustomConstructors"}; | 
|  2244         $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING"; |  2244         $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING"; | 
|  2245     } |  2245     } | 
|  2246     $interface->extendedAttributes($extendedAttributeList); |  2246     $interface->extendedAttributes($extendedAttributeList); | 
|  2247 } |  2247 } | 
|  2248  |  2248  | 
|  2249 1; |  2249 1; | 
| OLD | NEW |