Implemented the "address of" operator - working towards pointers
git-svn-id: http://picoc.googlecode.com/svn/trunk@71 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
7c9b3c1c8a
commit
2b1983b668
11
parse.c
11
parse.c
|
@ -131,9 +131,18 @@ int ParseValue(struct ParseState *Parser, struct Value **Result, int ResultOnHea
|
|||
break;
|
||||
|
||||
case TokenAsterisk:
|
||||
case TokenAmpersand:
|
||||
ProgramFail(Parser, "not implemented");
|
||||
|
||||
case TokenAmpersand:
|
||||
if (!ParseValue(Parser, Result, ResultOnHeap, &LocalLValue, RunIt) || LocalLValue == NULL)
|
||||
ProgramFail(Parser, "can't get the address of this");
|
||||
|
||||
VariableStackPop(Parser, *Result);
|
||||
*Result = VariableAllocValueFromType(Parser, Typ, TypeGetMatching(Parser, *Result, TypePointer, 0, StrEmpty));
|
||||
(*Result)->Val->Pointer.Segment = LocalLValue;
|
||||
(*Result)->Val->Pointer.Offset = 0;
|
||||
break;
|
||||
|
||||
case TokenIdentifier:
|
||||
if (LexGetToken(Parser, NULL, FALSE) == TokenOpenBracket)
|
||||
ParseFunctionCall(Parser, Result, ResultOnHeap, LexValue->Val->String, RunIt);
|
||||
|
|
Loading…
Reference in a new issue