From 9f9bb2ffaa86d29edb1aef52c147a492c46d83b0 Mon Sep 17 00:00:00 2001 From: "tg(x)" <*@tg-x.net> Date: Wed, 9 Nov 2011 19:45:27 +0100 Subject: [PATCH] allow only = and ? to be alone on a line --- src/parse.c | 4 +++- test/packets/err-00-oper-alone | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 test/packets/err-00-oper-alone diff --git a/src/parse.c b/src/parse.c index fef2429..9dca3c2 100644 --- a/src/parse.c +++ b/src/parse.c @@ -6,6 +6,7 @@ #endif #include "lib.h" +#include #include #define ADVANCE_CURSOR_OR_RETURN(ret) \ @@ -87,7 +88,8 @@ ParseRC psyc_parse_modifier (PsycParseState *state, char *oper, *oper = *(state->buffer.data + state->cursor); ADVANCE_CURSOR_OR_RETURN(PSYC_PARSE_INSUFFICIENT); - if (state->part == PSYC_PART_CONTENT && state->buffer.data[state->cursor] == '\n') + if (state->part == PSYC_PART_CONTENT && state->buffer.data[state->cursor] == '\n' && + (*oper == PSYC_OPERATOR_ASSIGN || *oper == PSYC_OPERATOR_QUERY)) return PARSE_SUCCESS; // only oper is present, used for state sync/reset ParseRC ret = psyc_parse_keyword(state, name); diff --git a/test/packets/err-00-oper-alone b/test/packets/err-00-oper-alone new file mode 100644 index 0000000..709e2b2 --- /dev/null +++ b/test/packets/err-00-oper-alone @@ -0,0 +1,7 @@ +:_source psyc://foo.example.com/ +:_target psyc://bar.example.com/ + +: +=_foo bar +=_baz qux +|