[cfe-dev] ParseTopLevelDecl not returning without extra token.

Nicholas "Indy" Ray arelius at gmail.com
Thu Oct 22 17:45:22 PDT 2009


So, I'm working on a C Interpreter using clang, in particular a patch
that allows reading the Lexer's source from a stream. Now in order to
determine when I have a complete statement so I can compile it
immediately I'm manually calling ParseTopLevelDecl and this works for
the most part, except that ParseDeclarationOrFunctionDefinition (among
other functions) requires an additional token after parsing the
complete deceleration before it returns, this is caused by the
ConsumeToken() call when the Tok is a Tok::semi among other places.

The result of this is that the user has to input an additional token
after the statement is complete, which partially defeats the whole
purpose of using the clang::Parser to determine whole and complete
statements. So, any advice on what could be done to allow clang to
return after a complete statement would be appreciated.

Nicholas "Indy" Ray



More information about the cfe-dev mailing list