Mercurial > projects > dil
comparison trunk/src/Parser.d @ 152:fe2e36eb4b45
- Added method parseIdentifierListExpression() and class IdentifierListExpression.
author | aziz |
---|---|
date | Thu, 12 Jul 2007 21:23:00 +0000 |
parents | 2e959f67000b |
children | 66790fc2c0a2 |
comparison
equal
deleted
inserted
replaced
151:2e959f67000b | 152:fe2e36eb4b45 |
---|---|
908 // TODO: only one parameter of type void* allowed. | 908 // TODO: only one parameter of type void* allowed. |
909 require(T.LBrace); | 909 require(T.LBrace); |
910 auto decls = parseDeclarationDefinitions(); | 910 auto decls = parseDeclarationDefinitions(); |
911 require(T.RBrace); | 911 require(T.RBrace); |
912 return new DeleteDeclaration(parameters, decls); | 912 return new DeleteDeclaration(parameters, decls); |
913 } | |
914 | |
915 // IdentifierListExpression: | |
916 // .IdentifierList | |
917 // IdentifierList | |
918 // Typeof | |
919 // Typeof . IdentifierList | |
920 // IdentifierList: | |
921 // Identifier | |
922 // Identifier . IdentifierList | |
923 // TemplateInstance | |
924 // TemplateInstance . IdentifierList | |
925 // TemplateInstance: | |
926 // Identifier !( TemplateArgumentList ) | |
927 IdentifierListExpression parseIdentifierListExpression() | |
928 { | |
929 Expression[] identList; | |
930 if (token.type == T.Dot) | |
931 { | |
932 nT(); | |
933 identList ~= new IdentifierExpression("."); | |
934 } | |
935 else if (token.type == T.Typeof) | |
936 { | |
937 requireNext(T.LParen); | |
938 auto type = new TypeofType(parseExpression()); | |
939 require(T.RParen); | |
940 identList ~= new TypeofExpression(type); | |
941 if (token.type != T.Dot) | |
942 return new IdentifierListExpression(identList); | |
943 nT(); | |
944 } | |
945 | |
946 while (1) | |
947 { | |
948 string ident = requireIdentifier(); | |
949 Token next; | |
950 lx.peek(next); | |
951 if (token.type == T.Not && next.type == T.LParen) // Identifier !( TemplateArguments ) | |
952 { | |
953 nT(); // Skip !. | |
954 identList ~= new TemplateInstanceExpression(ident, parseTemplateArguments()); | |
955 } | |
956 else // Identifier | |
957 identList ~= new IdentifierExpression(ident); | |
958 | |
959 if (token.type != T.Dot) | |
960 break; | |
961 nT(); | |
962 } | |
963 | |
964 return new IdentifierListExpression(identList); | |
913 } | 965 } |
914 | 966 |
915 /* | 967 /* |
916 TemplateMixin: | 968 TemplateMixin: |
917 mixin ( AssignExpression ) ; | 969 mixin ( AssignExpression ) ; |