File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " ungrammar"
33description = " A DSL for describing concrete syntax trees"
4- version = " 1.14.0 "
4+ version = " 1.14.1 "
55license = " MIT OR Apache-2.0"
66repository = " https://github.com/matklad/ungrammar"
77authors = [" Aleksey Kladov <aleksey.kladov@gmail.com>" ]
Original file line number Diff line number Diff line change @@ -109,6 +109,14 @@ fn node(p: &mut Parser) -> Result<()> {
109109}
110110
111111fn rule ( p : & mut Parser ) -> Result < Rule > {
112+ if let Some ( lexer:: Token { kind : TokenKind :: Pipe , loc } ) = p. peek ( ) {
113+ bail ! (
114+ * loc,
115+ "The first element in a sequence of productions or alternatives \
116+ must not have a leading pipe (`|`)"
117+ ) ;
118+ }
119+
112120 let lhs = seq_rule ( p) ?;
113121 let mut alt = vec ! [ lhs] ;
114122 while let Some ( token) = p. peek ( ) {
You can’t perform that action at this time.
0 commit comments