lex: let closing BraceEqual have - after Hyphen seq
e.g. ---} -> -- + -} instead of --- + }
This commit is contained in:
		
					parent
					
						
							
								79e2eab107
							
						
					
				
			
			
				commit
				
					
						b2d39e3ded
					
				
			
		
					 1 changed files with 9 additions and 2 deletions
				
			
		
							
								
								
									
										11
									
								
								src/lex.rs
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								src/lex.rs
									
										
									
									
									
								
							| 
						 | 
					@ -133,8 +133,12 @@ impl<I: Iterator<Item = char> + Clone> Lexer<I> {
 | 
				
			||||||
        current
 | 
					        current
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    fn peek_char_n(&mut self, n: usize) -> char {
 | 
				
			||||||
 | 
					        self.chars.clone().nth(n).unwrap_or(EOF)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn peek_char(&mut self) -> char {
 | 
					    fn peek_char(&mut self) -> char {
 | 
				
			||||||
        self.chars.clone().next().unwrap_or(EOF)
 | 
					        self.peek_char_n(0)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn eat_char(&mut self) -> Option<char> {
 | 
					    fn eat_char(&mut self) -> Option<char> {
 | 
				
			||||||
| 
						 | 
					@ -219,7 +223,10 @@ impl<I: Iterator<Item = char> + Clone> Lexer<I> {
 | 
				
			||||||
                    self.eat_char();
 | 
					                    self.eat_char();
 | 
				
			||||||
                    Close(BraceHyphen)
 | 
					                    Close(BraceHyphen)
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    self.eat_seq(Hyphen)
 | 
					                    while self.peek_char() == '-' && self.peek_char_n(1) != '}' {
 | 
				
			||||||
 | 
					                        self.eat_char();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    Seq(Hyphen)
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue