aboutsummaryrefslogtreecommitdiff
path: root/src/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse.c')
-rw-r--r--src/parse.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/parse.c b/src/parse.c
index fe9a989..8e83374 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -97,6 +97,17 @@ static void AddToken(const char *start, const char *end, Line *line, int quoted)
}
+static int IsClosure(const char *p, const char *sep)
+{
+ while(*p && isspace(*p))
+ {
+ p++;
+ }
+
+ return !*p || strchr(sep, *p);
+}
+
+
/* ---------------------------------------- INTERFACES
*/
@@ -210,9 +221,25 @@ int ParseLine(Line *line, const char *source)
{
if (quote)
{
+ /* When we find a closing quote check if the following
+ character is a seperator or end-of-line. If not
+ this wasn't really a quoted string.
+ */
if (*p == quote)
{
- state = CONSUME_WS;
+ if (IsClosure(p + 1, sep_chars[stage]))
+ {
+ state = CONSUME_WS;
+ }
+ else
+ {
+ /* Wasn't a real closue, so add the quote as
+ a character onto the string.
+ */
+ quote = 0;
+ open_quote = 0;
+ start--;
+ }
}
}
else if (strchr(sep_chars[stage], *p) || *p == ';')