Fixed off-by-one error in LexGetToken()
git-svn-id: http://picoc.googlecode.com/svn/trunk@59 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
11fd7f0f16
commit
d95e7debf8
11
lex.c
11
lex.c
|
@ -302,6 +302,7 @@ void *LexTokenise(struct LexState *Lexer)
|
|||
do
|
||||
{ /* store the token at the end of the stack area */
|
||||
Token = LexScanGetToken(Lexer, &GotValue);
|
||||
printf("Token: %02x\n", Token);
|
||||
*(char *)TokenSpace = Token;
|
||||
TokenSpace++;
|
||||
MemUsed++;
|
||||
|
@ -327,6 +328,13 @@ void *LexTokenise(struct LexState *Lexer)
|
|||
|
||||
HeapMem = HeapAlloc(MemUsed);
|
||||
memcpy(HeapMem, HeapStackGetFreeSpace(&MemAvailable), MemUsed);
|
||||
{
|
||||
int Count;
|
||||
for (Count = 0; Count < MemUsed; Count++)
|
||||
printf("%02x ", *(unsigned char *)(HeapMem+Count));
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
return HeapMem;
|
||||
}
|
||||
|
||||
|
@ -377,7 +385,7 @@ enum LexToken LexGetToken(struct ParseState *Parser, struct Value **Value, int I
|
|||
default: break;
|
||||
}
|
||||
|
||||
memcpy(LexValue.Val, Parser->Pos, ValueSize);
|
||||
memcpy(LexValue.Val, Parser->Pos+1, ValueSize);
|
||||
LexValue.ValOnHeap = FALSE;
|
||||
LexValue.ValOnStack = FALSE;
|
||||
*Value = &LexValue;
|
||||
|
@ -392,6 +400,7 @@ enum LexToken LexGetToken(struct ParseState *Parser, struct Value **Value, int I
|
|||
Parser->Pos++;
|
||||
}
|
||||
|
||||
printf("Got token=%02x inc=%d\n", Token, IncPos);
|
||||
return Token;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue