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>> {
55
55
pub enum LexicalError {
56
56
StringError ,
57
57
NestingError ,
58
+ UnrecognizedToken { tok : char } ,
58
59
}
59
60
60
61
#[ derive( Clone , Debug , Default , PartialEq ) ]
@@ -687,7 +688,9 @@ where
687
688
688
689
match self . chr0 {
689
690
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
+ }
691
694
Some ( '#' ) => {
692
695
self . lex_comment ( ) ;
693
696
continue ;
@@ -1033,7 +1036,7 @@ where
1033
1036
None => return None ,
1034
1037
_ => {
1035
1038
let c = self . next_char ( ) ;
1036
- panic ! ( "Not impl {:?}" , c )
1039
+ return Some ( Err ( LexicalError :: UnrecognizedToken { tok : c . unwrap ( ) } ) ) ;
1037
1040
} // Ignore all the rest..
1038
1041
}
1039
1042
}
You can’t perform that action at this time.
0 commit comments