Fix compile error with string literals in ternary operator
The ':' symbol was not recognized as a separator in stringize mode so you always got a weird compile error with a code like this: (condition) ? "yes : "no" error 001: expected token: "-string end-", but found "-identifier-" See 2) here: http://forum.sa-mp.com/showthread.php?t=355877 Test code: native print(const s[]); main() { new a = 5; print((a == 5) ? "is five" : !"is not five"); print((a != 5) ? !"is not five" : "is five"); }
This commit is contained in:
parent
4831cb76a3
commit
0c8f23453e
@ -1745,7 +1745,8 @@ static const unsigned char *unpackedstring(const unsigned char *lptr,int *flags)
|
|||||||
lptr--;
|
lptr--;
|
||||||
instring=1;
|
instring=1;
|
||||||
*flags |= STRINGIZE;
|
*flags |= STRINGIZE;
|
||||||
} else if (*lptr==')' || *lptr==',' || *lptr=='}' || *lptr==';' || *lptr=='\r' || *lptr=='\n') {
|
} else if (*lptr==')' || *lptr==',' || *lptr=='}' || *lptr==';' |
|
||||||
|
*lptr==':' || *lptr=='\r' || *lptr=='\n') {
|
||||||
break;
|
break;
|
||||||
} else if (*lptr!=' ' && *lptr!='\t') {
|
} else if (*lptr!=' ' && *lptr!='\t') {
|
||||||
error(1,"-string end-","-identifier-");
|
error(1,"-string end-","-identifier-");
|
||||||
@ -1767,7 +1768,8 @@ static const unsigned char *unpackedstring(const unsigned char *lptr,int *flags)
|
|||||||
lptr=stringize+1;
|
lptr=stringize+1;
|
||||||
*flags &= ~STRINGIZE;
|
*flags &= ~STRINGIZE;
|
||||||
continue;
|
continue;
|
||||||
} else if (*stringize==',' || *stringize==')' || *stringize=='}' || *stringize==';') { /* end */
|
} else if (*stringize==',' || *stringize==')' || *stringize=='}' ||
|
||||||
|
*stringize==';' || *stringize==':') { /* end */
|
||||||
lptr=stringize;
|
lptr=stringize;
|
||||||
break;
|
break;
|
||||||
} else if (*stringize=='\0') {
|
} else if (*stringize=='\0') {
|
||||||
@ -1786,7 +1788,8 @@ static const unsigned char *unpackedstring(const unsigned char *lptr,int *flags)
|
|||||||
} /* while */
|
} /* while */
|
||||||
litadd(0);
|
litadd(0);
|
||||||
|
|
||||||
if (*lptr==',' || *lptr==')' || *lptr=='}' || *lptr==';' || *lptr=='\n' || *lptr=='\r')
|
if (*lptr==',' || *lptr==')' || *lptr=='}' || *lptr==';' ||
|
||||||
|
*lptr==':' || *lptr=='\n' || *lptr=='\r')
|
||||||
lptr=stringize; /* backtrack to end of last string for closing " */
|
lptr=stringize; /* backtrack to end of last string for closing " */
|
||||||
return lptr;
|
return lptr;
|
||||||
}
|
}
|
||||||
@ -1816,7 +1819,8 @@ static const unsigned char *packedstring(const unsigned char *lptr,int *flags)
|
|||||||
lptr--;
|
lptr--;
|
||||||
instring=1;
|
instring=1;
|
||||||
*flags |= STRINGIZE;
|
*flags |= STRINGIZE;
|
||||||
} else if (*lptr==')' || *lptr==',' || *lptr=='}' || *lptr==';' || *lptr=='\r' || *lptr=='\n') {
|
} else if (*lptr==')' || *lptr==',' || *lptr=='}' || *lptr==';' ||
|
||||||
|
*lptr==':' || *lptr=='\r' || *lptr=='\n') {
|
||||||
break;
|
break;
|
||||||
} else if (*lptr!=' ' && *lptr!='\t') {
|
} else if (*lptr!=' ' && *lptr!='\t') {
|
||||||
error(1,"-string end-","-identifier-");
|
error(1,"-string end-","-identifier-");
|
||||||
@ -1838,7 +1842,8 @@ static const unsigned char *packedstring(const unsigned char *lptr,int *flags)
|
|||||||
lptr=stringize+1;
|
lptr=stringize+1;
|
||||||
*flags &= ~STRINGIZE;
|
*flags &= ~STRINGIZE;
|
||||||
continue;
|
continue;
|
||||||
} else if (*stringize==',' || *stringize==')' || *stringize=='}' || *stringize==';') { /* end */
|
} else if (*stringize==',' || *stringize==')' || *stringize=='}' |
|
||||||
|
*stringize==';' || *stringize==':') { /* end */
|
||||||
lptr=stringize;
|
lptr=stringize;
|
||||||
break;
|
break;
|
||||||
} else if (*stringize=='\0') {
|
} else if (*stringize=='\0') {
|
||||||
@ -1869,7 +1874,8 @@ static const unsigned char *packedstring(const unsigned char *lptr,int *flags)
|
|||||||
else
|
else
|
||||||
litadd(0); /* add full cell of zeros */
|
litadd(0); /* add full cell of zeros */
|
||||||
|
|
||||||
if (*lptr==',' || *lptr==')' || *lptr=='}' || *lptr==';' || *lptr=='\n' || *lptr=='\r')
|
if (*lptr==',' || *lptr==')' || *lptr=='}' || *lptr==';' ||
|
||||||
|
*lptr==':' || *lptr=='\n' || *lptr=='\r')
|
||||||
lptr=stringize; /* backtrack to end of last string for closing " */
|
lptr=stringize; /* backtrack to end of last string for closing " */
|
||||||
return lptr;
|
return lptr;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user