From 9a8e9bc4c6339051ef260f7794603481b6ff0bf2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 11 Jan 2018 23:01:12 +0300 Subject: G: item outer attributes --- src/parser/event_parser/grammar/mod.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/parser/event_parser/grammar/mod.rs') diff --git a/src/parser/event_parser/grammar/mod.rs b/src/parser/event_parser/grammar/mod.rs index 60458ce70..76f62b714 100644 --- a/src/parser/event_parser/grammar/mod.rs +++ b/src/parser/event_parser/grammar/mod.rs @@ -41,7 +41,15 @@ fn node(p: &mut Parser, node_kind: SyntaxKind, rest: F) } fn many bool>(p: &mut Parser, f: F) { - while f(p) { } + loop { + let pos = p.pos(); + if !f(p) { + return + } + if pos == p.pos() { + panic!("Infinite loop in parser") + } + } } fn comma_list bool>(p: &mut Parser, end: SyntaxKind, f: F) { -- cgit v1.2.3