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
|
* pointer arithmetic
|
||||||
* casts
|
* casts
|
||||||
* char access/char array access/char * access
|
* char access/char array access/char * access
|
||||||
* "delete" for interactive mode to remove old functions
|
|
||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
* #define with arguments
|
* #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 */
|
/* declare a variable or function */
|
||||||
void ParseDeclaration(struct ParseState *Parser, enum LexToken Token)
|
int ParseDeclaration(struct ParseState *Parser, enum LexToken Token)
|
||||||
{
|
{
|
||||||
char *Identifier;
|
char *Identifier;
|
||||||
struct ValueType *BasicType;
|
struct ValueType *BasicType;
|
||||||
|
@ -117,7 +117,10 @@ void ParseDeclaration(struct ParseState *Parser, enum LexToken Token)
|
||||||
{
|
{
|
||||||
/* handle function definitions */
|
/* handle function definitions */
|
||||||
if (LexGetToken(Parser, NULL, FALSE) == TokenOpenBracket)
|
if (LexGetToken(Parser, NULL, FALSE) == TokenOpenBracket)
|
||||||
|
{
|
||||||
ParseFunctionDefinition(Parser, Typ, Identifier, FALSE);
|
ParseFunctionDefinition(Parser, Typ, Identifier, FALSE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Token == TokenVoidType && Identifier != StrEmpty)
|
if (Token == TokenVoidType && Identifier != StrEmpty)
|
||||||
|
@ -143,6 +146,8 @@ void ParseDeclaration(struct ParseState *Parser, enum LexToken Token)
|
||||||
LexGetToken(Parser, NULL, TRUE);
|
LexGetToken(Parser, NULL, TRUE);
|
||||||
|
|
||||||
} while (Token == TokenComma);
|
} while (Token == TokenComma);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parse a #define macro definition and store it for later */
|
/* parse a #define macro definition and store it for later */
|
||||||
|
@ -364,7 +369,7 @@ int ParseStatement(struct ParseState *Parser)
|
||||||
case TokenUnionType:
|
case TokenUnionType:
|
||||||
case TokenEnumType:
|
case TokenEnumType:
|
||||||
*Parser = PreState;
|
*Parser = PreState;
|
||||||
ParseDeclaration(Parser, Token);
|
CheckTrailingSemicolon = ParseDeclaration(Parser, Token);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TokenHashDefine:
|
case TokenHashDefine:
|
||||||
|
|
Loading…
Reference in a new issue