Fix with parsing literal strings ending with character '\\'
From Pawn rev32: https://code.google.com/p/pawnscript/source/detail?r=32 E.g.: #define EGG "Gaben^^" (control character + something) This fixes also compilation under linux.
This commit is contained in:
parent
de2796508f
commit
2ffd4cb9fa
|
@ -2055,7 +2055,7 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym)
|
||||||
|| (*lptr==sc_ctrlchar && *(lptr+1)=='!' && *(lptr+2)=='\"')) /* packed raw string */
|
|| (*lptr==sc_ctrlchar && *(lptr+1)=='!' && *(lptr+2)=='\"')) /* packed raw string */
|
||||||
{
|
{
|
||||||
int stringflags,segmentflags;
|
int stringflags,segmentflags;
|
||||||
unsigned char *cat;
|
char *cat;
|
||||||
if (sLiteralQueueDisabled) {
|
if (sLiteralQueueDisabled) {
|
||||||
_lextok=tPENDING_STRING;
|
_lextok=tPENDING_STRING;
|
||||||
return _lextok;
|
return _lextok;
|
||||||
|
@ -2083,9 +2083,12 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym)
|
||||||
error(238); /* mixing packed/unpacked/raw strings in concatenation */
|
error(238); /* mixing packed/unpacked/raw strings in concatenation */
|
||||||
cat=strchr(_lexstr,'\0');
|
cat=strchr(_lexstr,'\0');
|
||||||
assert(cat!=NULL);
|
assert(cat!=NULL);
|
||||||
while ((*lptr!='\"' || *(lptr-1)==sc_ctrlchar) && *lptr!='\0' && (cat-_lexstr)<sLINEMAX) {
|
while (*lptr!='"' && *lptr!='\0' && (cat-_lexstr)<sLINEMAX) {
|
||||||
if (*lptr!='\a') /* ignore '\a' (which was inserted at a line concatenation) */
|
if (*lptr!='\a') { /* ignore '\a' (which was inserted at a line concatenation) */
|
||||||
*cat++=*lptr;
|
*cat++=*lptr;
|
||||||
|
if (*lptr==sc_ctrlchar && *(lptr+1)!='\0')
|
||||||
|
*cat++=*++lptr; /* skip escape character plus the escaped character */
|
||||||
|
} /* if */
|
||||||
lptr++;
|
lptr++;
|
||||||
} /* while */
|
} /* while */
|
||||||
*cat='\0'; /* terminate string */
|
*cat='\0'; /* terminate string */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user