Mercurial > projects > dil
changeset 415:b18b0cd8f8cd
Fixed parsing C function pointers in declarations.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Thu, 27 Sep 2007 10:46:00 +0200 |
parents | 9c69615a4876 |
children | a4783b904fba |
files | trunk/src/dil/Parser.d |
diffstat | 1 files changed, 20 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- 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.