Updated hello.c to current syntax.
Fixed a bug in string constant handling. git-svn-id: http://picoc.googlecode.com/svn/trunk@11 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
a41ac67b50
commit
ead3f08671
7
lex.c
7
lex.c
|
@ -90,17 +90,18 @@ enum LexToken LexGetStringConstant(struct LexState *Lexer)
|
|||
{
|
||||
int Escape = FALSE;
|
||||
|
||||
Lexer->Pos++;
|
||||
Lexer->Value.String.Str = Lexer->Pos;
|
||||
while (Lexer->Pos != Lexer->End && !Escape && *Lexer->Pos != '"')
|
||||
while (Lexer->Pos != Lexer->End && (*Lexer->Pos != '"' || Escape))
|
||||
{
|
||||
if (Escape)
|
||||
Escape = FALSE;
|
||||
else if (*Lexer->Pos == '\\')
|
||||
Escape = TRUE;
|
||||
|
||||
Lexer->Pos++;
|
||||
}
|
||||
Lexer->Value.String.Len = Lexer->Pos - Lexer->Value.String.Str;
|
||||
if (*Lexer->Pos != '"')
|
||||
if (*Lexer->Pos == '"')
|
||||
Lexer->Pos++;
|
||||
|
||||
return TokenStringConstant;
|
||||
|
|
Loading…
Reference in a new issue