stub out some entry points for the expr parsing code.

llvm-svn: 38858
This commit is contained in:
Chris Lattner 2006-08-10 19:06:03 +00:00
parent ee2cdfdd2d
commit c5e0d4a6ae
4 changed files with 30 additions and 15 deletions

View File

@ -42,11 +42,9 @@ void Parser::ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
// Parse declarator '=' initializer.
if (Tok.getKind() == tok::equal) {
ConsumeToken();
// FIXME: THIS IS WRONG: should ParseInitializer!!
ParseExpression();
ParseInitializer();
}
// TODO: install declarator.
// If we don't have a comma, it is either the end of the list (a ';') or an

View File

@ -16,6 +16,14 @@
using namespace llvm;
using namespace clang;
// C99 6.7.8
void Parser::ParseInitializer() {
// FIXME: STUB.
ParseAssignmentExpression();
}
Parser::ExprTy Parser::ParseExpression() {
if (Tok.getKind() == tok::numeric_constant) {
ConsumeToken();
@ -26,11 +34,17 @@ Parser::ExprTy Parser::ParseExpression() {
return 0;
}
///primary-expression:
/// identifier
/// constant
/// string-literal
/// '(' expression ')'
// Expr that doesn't include commas.
void Parser::ParseAssignmentExpression() {
ParseExpression();
}
/// primary-expression:
/// identifier
/// constant
/// string-literal
/// '(' expression ')'
/// ParseParenExpression - C99 c.5.1p5
/// primary-expression:

View File

@ -220,7 +220,7 @@ void Parser::ParseCaseStatement() {
assert(Tok.getKind() == tok::kw_case && "Not a case stmt!");
ConsumeToken(); // eat the 'case'.
ParseExpression();
ParseAssignmentExpression(); // Expr without commas.
if (Tok.getKind() == tok::colon) {
ConsumeToken();

View File

@ -156,6 +156,14 @@ private:
void ParseDeclarationOrFunctionDefinition();
void ParseFunctionDefinition(Declarator &D);
//===--------------------------------------------------------------------===//
// C99 6.5: Expressions.
//ExprTy ParseExpression(); // Above.
void ParseAssignmentExpression(); // Expr that doesn't include commas.
void ParseParenExpression();
void ParseInitializer(); // C99 6.7.8
//===--------------------------------------------------------------------===//
// C99 6.8: Statements and Blocks.
void ParseStatement() { ParseStatementOrDeclaration(true); }
@ -174,17 +182,12 @@ private:
//===--------------------------------------------------------------------===//
// C99 6.7: Declarations.
void ParseDeclaration(unsigned Context);
void ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D);
void ParseDeclarationSpecifiers(DeclSpec &DS);
bool isDeclarationSpecifier() const;
//===--------------------------------------------------------------------===//
// C99 6.5: Expressions.
//ExprTy ParseExpression(); // Above.
void ParseParenExpression();
/// ParseDeclarator - Parse and verify a newly-initialized declarator.
void ParseDeclarator(Declarator &D);
void ParseDeclaratorInternal(Declarator &D);