Skip to content

Commit 19494ff

Browse files
grammar: handle misplaced special regex chars [*+?]
1 parent ee01d71 commit 19494ff

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

common/json-schema-to-grammar.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,8 @@ class SchemaConverter {
483483
seq.emplace_back("|", false);
484484
i++;
485485
} else if (c == '*' || c == '+' || c == '?') {
486-
seq.back() = std::make_pair(to_rule(seq.back()) + c, false);
486+
if (!seq.empty())
487+
seq.back() = std::make_pair(to_rule(seq.back()) + c, false);
487488
i++;
488489
} else if (c == '{') {
489490
std::string curly_brackets = std::string(1, c);

0 commit comments

Comments
 (0)