# HG changeset patch # User Aziz K?ksal # Date 1190882760 -7200 # Node ID b18b0cd8f8cdc147974903211c22190a8092300f # Parent 9c69615a4876113f32b5d89d6a64081afeff1278 Fixed parsing C function pointers in declarations. diff -r 9c69615a4876 -r b18b0cd8f8cd trunk/src/dil/Parser.d --- a/trunk/src/dil/Parser.d Thu Sep 27 10:28:08 2007 +0200 +++ b/trunk/src/dil/Parser.d Thu Sep 27 10:46:00 2007 +0200 @@ -389,32 +389,34 @@ ident = token; nT(); } - else if (token.type == T.LParen) - { - type = parseType(); - parseCFunctionPointerType(type, ident); - } else { type = parseType(); - ident = requireId(); - // Type FunctionName ( ParameterList ) FunctionBody if (token.type == T.LParen) { - // It's a function declaration - TemplateParameters tparams; - if (tokenAfterParenIs(T.LParen)) + parseCFunctionPointerType(type, ident); + } + else + { + ident = requireId(); + // Type FunctionName ( ParameterList ) FunctionBody + if (token.type == T.LParen) { - // ( TemplateParameterList ) ( ParameterList ) - tparams = parseTemplateParameterList(); + // It's a function declaration + TemplateParameters tparams; + if (tokenAfterParenIs(T.LParen)) + { + // ( TemplateParameterList ) ( ParameterList ) + tparams = parseTemplateParameterList(); + } + + auto params = parseParameterList(); + // ReturnType FunctionName ( ParameterList ) + auto funcBody = parseFunctionBody(); + return new FunctionDeclaration(type, ident, tparams, params, funcBody); } - - auto params = parseParameterList(); - // ReturnType FunctionName ( ParameterList ) - auto funcBody = parseFunctionBody(); - return new FunctionDeclaration(type, ident, tparams, params, funcBody); + type = parseDeclaratorSuffix(type); } - type = parseDeclaratorSuffix(type); } // It's a variable declaration.