mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
Preserve "\n" in continued lines.
Set a flag if parser encounters [expr].
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user