YANG parser BUGFIX processing keywords (checking their end)
diff --git a/src/parser_yang.c b/src/parser_yang.c
index 3d3421d..9cc2bac 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -952,12 +952,9 @@
/* make sure we have the whole keyword */
switch (**data) {
case '\n':
- ++ctx->line;
- /* fallthrough */
- case ' ':
case '\t':
- /* mandatory "sep" */
- MOVE_INPUT(ctx, data, 1);
+ case ' ':
+ /* mandatory "sep" is just checked, not eaten so nothing in the context is updated */
break;
case ':':
/* keyword is not actually a keyword, but prefix of an extension.
diff --git a/tests/src/test_parser_yang.c b/tests/src/test_parser_yang.c
index 15dcd8c..b279b16 100644
--- a/tests/src/test_parser_yang.c
+++ b/tests/src/test_parser_yang.c
@@ -399,6 +399,11 @@
assert_int_equal(6, len);
assert_string_equal("output\n\t{", word);
assert_string_equal("\n\t{", str);
+ assert_int_equal(LY_SUCCESS, get_keyword(&ctx, &str, &kw, &word, &len));
+ assert_int_equal(YANG_LEFT_BRACE, kw);
+ assert_int_equal(1, len);
+ assert_string_equal("{", word);
+ assert_string_equal("", str);
str = "/input { "; /* invalid slash */
assert_int_equal(LY_EVALID, get_keyword(&ctx, &str, &kw, &word, &len));