Add string escaping
This commit is contained in:
parent
e8ca2af9bc
commit
00afc5158f
@ -17,6 +17,7 @@ tSyntaxElement* parse(FILE* file) {
|
|||||||
bool incomment = false;
|
bool incomment = false;
|
||||||
bool instring = false;
|
bool instring = false;
|
||||||
bool intoken = false;
|
bool intoken = false;
|
||||||
|
bool inescape = false;
|
||||||
|
|
||||||
tExtstring* exttoken = NULL;
|
tExtstring* exttoken = NULL;
|
||||||
tExtstring* extstring = NULL;
|
tExtstring* extstring = NULL;
|
||||||
@ -34,7 +35,7 @@ tSyntaxElement* parse(FILE* file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (instring) {
|
if (instring) {
|
||||||
if (symbol == '"') {
|
if (symbol == '"' && !inescape) {
|
||||||
|
|
||||||
if (extstring == NULL) {
|
if (extstring == NULL) {
|
||||||
extstring = malloc(sizeof(tExtstring));
|
extstring = malloc(sizeof(tExtstring));
|
||||||
@ -52,6 +53,10 @@ tSyntaxElement* parse(FILE* file) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
inescape = false;
|
||||||
|
if (symbol == '\\')
|
||||||
|
inescape = true;
|
||||||
|
|
||||||
if (extstring == NULL) {
|
if (extstring == NULL) {
|
||||||
|
|
||||||
extstring = malloc(sizeof(tExtstring));
|
extstring = malloc(sizeof(tExtstring));
|
||||||
|
Loading…
Reference in New Issue
Block a user