Macros implemented

git-svn-id: http://picoc.googlecode.com/svn/trunk@245 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2009-04-15 06:57:02 +00:00
parent 883db65e15
commit 7cb2079af4

View file

@ -1214,13 +1214,14 @@ int ExpressionParse(struct ParseState *Parser, struct Value **Result)
VariableGet(Parser, LexValue->Val->Identifier, &VariableValue); VariableGet(Parser, LexValue->Val->Identifier, &VariableValue);
if (VariableValue->Typ->Base == TypeMacro) if (VariableValue->Typ->Base == TypeMacro)
{ {
ProgramFail(Parser, "XXX macros unimplemented"); /* evaluate a macro as a kind of simple subroutine */
#if 0
struct ParseState MacroParser = VariableValue->Val->Parser; struct ParseState MacroParser = VariableValue->Val->Parser;
struct Value *MacroResult;
if (!ExpressionParse(&MacroParser, Result) || LexGetToken(&MacroParser, NULL, FALSE) != TokenEndOfFunction) if (!ExpressionParse(&MacroParser, &MacroResult) || LexGetToken(&MacroParser, NULL, FALSE) != TokenEndOfFunction)
ProgramFail(&MacroParser, "expression expected"); ProgramFail(&MacroParser, "expression expected");
#endif
ExpressionStackPushValueNode(Parser, &StackTop, MacroResult);
} }
else if (VariableValue->Typ == TypeVoid) else if (VariableValue->Typ == TypeVoid)
ProgramFail(Parser, "a void value isn't much use here"); ProgramFail(Parser, "a void value isn't much use here");