Fixed a problem with function definition parsing which was causing
prompt2 to be displayed in error. git-svn-id: http://picoc.googlecode.com/svn/trunk@207 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
ce80c66e8f
commit
eff849ad28
1
TODO
1
TODO
|
@ -9,7 +9,6 @@ Implement:
|
|||
* pointer arithmetic
|
||||
* casts
|
||||
* char access/char array access/char * access
|
||||
* "delete" for interactive mode to remove old functions
|
||||
|
||||
Improvements:
|
||||
* #define with arguments
|
||||
|
|
9
parse.c
9
parse.c
|
@ -99,7 +99,7 @@ struct Value *ParseFunctionDefinition(struct ParseState *Parser, struct ValueTyp
|
|||
}
|
||||
|
||||
/* declare a variable or function */
|
||||
void ParseDeclaration(struct ParseState *Parser, enum LexToken Token)
|
||||
int ParseDeclaration(struct ParseState *Parser, enum LexToken Token)
|
||||
{
|
||||
char *Identifier;
|
||||
struct ValueType *BasicType;
|
||||
|
@ -117,7 +117,10 @@ void ParseDeclaration(struct ParseState *Parser, enum LexToken Token)
|
|||
{
|
||||
/* handle function definitions */
|
||||
if (LexGetToken(Parser, NULL, FALSE) == TokenOpenBracket)
|
||||
{
|
||||
ParseFunctionDefinition(Parser, Typ, Identifier, FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Token == TokenVoidType && Identifier != StrEmpty)
|
||||
|
@ -143,6 +146,8 @@ void ParseDeclaration(struct ParseState *Parser, enum LexToken Token)
|
|||
LexGetToken(Parser, NULL, TRUE);
|
||||
|
||||
} while (Token == TokenComma);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* parse a #define macro definition and store it for later */
|
||||
|
@ -364,7 +369,7 @@ int ParseStatement(struct ParseState *Parser)
|
|||
case TokenUnionType:
|
||||
case TokenEnumType:
|
||||
*Parser = PreState;
|
||||
ParseDeclaration(Parser, Token);
|
||||
CheckTrailingSemicolon = ParseDeclaration(Parser, Token);
|
||||
break;
|
||||
|
||||
case TokenHashDefine:
|
||||
|
|
Loading…
Reference in a new issue