diff --git a/src/files.c b/src/files.c index 71eeac68..d75a60db 100644 --- a/src/files.c +++ b/src/files.c @@ -140,7 +140,7 @@ static int ReadLineFromFile(void) } l = DBufLen(&buf); if (l && (DBufValue(&buf)[l-1] == '\\')) { - DBufValue(&buf)[l-1] = 0; + DBufValue(&buf)[l-1] = '\n'; if (DBufPuts(&LineBuffer, DBufValue(&buf)) != OK) { DBufFree(&buf); DBufFree(&LineBuffer); diff --git a/src/main.c b/src/main.c index 163b0c19..cc59a905 100644 --- a/src/main.c +++ b/src/main.c @@ -345,6 +345,7 @@ int ParseChar(ParsePtr p, int *err, int peek) return *(p->pos++); } } + p->expr_happened = 1; p->pos++; r = EvalExpr(&(p->pos), &val); if (r) { @@ -563,6 +564,7 @@ void CreateParser(char const *s, ParsePtr p) p->etext = NULL; p->allownested = 1; p->tokenPushed = NULL; + p->expr_happened = 0; DBufInit(&p->pushedToken); } diff --git a/src/types.h b/src/types.h index 5428f387..fbd002fa 100644 --- a/src/types.h +++ b/src/types.h @@ -71,7 +71,7 @@ typedef struct { /* The parse pointer */ typedef struct { - char isnested; /* Is it a nested expression? */ + char isnested; /* Is it a nested expression? */ char allownested; char const *text; /* Start of text */ char const *pos; /* Current position */ @@ -79,6 +79,7 @@ typedef struct { char const *epos; /* Position in substituted text */ DynamicBuffer pushedToken; /* Pushed-back token */ char const *tokenPushed; /* NULL if no pushed-back token */ + char expr_happened; /* Did we encounter an [expression] ? */ } Parser; typedef Parser *ParsePtr; /* Pointer to parser structure */