diff options
author | Aleksey Kladov <[email protected]> | 2018-01-11 20:01:12 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-01-11 20:01:12 +0000 |
commit | 9a8e9bc4c6339051ef260f7794603481b6ff0bf2 (patch) | |
tree | b9d23b06feda7249873ca40c88419e1b5c5d9bd6 /src/parser/event_parser/grammar/mod.rs | |
parent | 89699c4803a0d12155adf653742f463872667610 (diff) |
G: item outer attributes
Diffstat (limited to 'src/parser/event_parser/grammar/mod.rs')
-rw-r--r-- | src/parser/event_parser/grammar/mod.rs | 10 |
1 files changed, 9 insertions, 1 deletions
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<F: FnOnce(&mut Parser)>(p: &mut Parser, node_kind: SyntaxKind, rest: F) | |||
41 | } | 41 | } |
42 | 42 | ||
43 | fn many<F: Fn(&mut Parser) -> bool>(p: &mut Parser, f: F) { | 43 | fn many<F: Fn(&mut Parser) -> bool>(p: &mut Parser, f: F) { |
44 | while f(p) { } | 44 | loop { |
45 | let pos = p.pos(); | ||
46 | if !f(p) { | ||
47 | return | ||
48 | } | ||
49 | if pos == p.pos() { | ||
50 | panic!("Infinite loop in parser") | ||
51 | } | ||
52 | } | ||
45 | } | 53 | } |
46 | 54 | ||
47 | fn comma_list<F: Fn(&mut Parser) -> bool>(p: &mut Parser, end: SyntaxKind, f: F) { | 55 | fn comma_list<F: Fn(&mut Parser) -> bool>(p: &mut Parser, end: SyntaxKind, f: F) { |