File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ pub struct Lexer<T: Iterator<Item = char>> {
5555pub enum LexicalError {
5656 StringError ,
5757 NestingError ,
58+ UnrecognizedToken { tok : char } ,
5859}
5960
6061#[ derive( Clone , Debug , Default , PartialEq ) ]
@@ -687,7 +688,9 @@ where
687688
688689 match self . chr0 {
689690 Some ( '0' ..='9' ) => return Some ( self . lex_number ( ) ) ,
690- Some ( '_' ) | Some ( 'a' ..='z' ) | Some ( 'A' ..='Z' ) => return Some ( self . lex_identifier ( ) ) ,
691+ Some ( '_' ) | Some ( 'a' ..='z' ) | Some ( 'A' ..='Z' ) => {
692+ return Some ( self . lex_identifier ( ) )
693+ }
691694 Some ( '#' ) => {
692695 self . lex_comment ( ) ;
693696 continue ;
@@ -1033,7 +1036,7 @@ where
10331036 None => return None ,
10341037 _ => {
10351038 let c = self . next_char ( ) ;
1036- panic ! ( "Not impl {:?}" , c )
1039+ return Some ( Err ( LexicalError :: UnrecognizedToken { tok : c . unwrap ( ) } ) ) ;
10371040 } // Ignore all the rest..
10381041 }
10391042 }
You can’t perform that action at this time.
0 commit comments