11use  std:: { char,  iter:: Peekable ,  str:: CharIndices } ; 
22
3- use  derive_more:: with_trait:: Display ; 
3+ use  derive_more:: with_trait:: { Display ,   Error } ; 
44
55use  crate :: parser:: { SourcePosition ,  Spanning } ; 
66
@@ -63,21 +63,21 @@ pub enum Token<'a> {
6363} 
6464
6565/// Error when tokenizing the input source 
66- #[ derive( Clone ,  Debug ,  Display ,  Eq ,  PartialEq ) ]  
66+ #[ derive( Clone ,  Debug ,  Display ,  Eq ,  Error ,   PartialEq ) ]  
6767pub  enum  LexerError  { 
6868    /// An unknown character was found 
6969/// 
7070/// Unknown characters are characters that do not occur anywhere in the 
7171/// GraphQL language, such as `?` or `%`. 
7272#[ display( "Unknown character \" {_0}\" " ) ]  
73-     UnknownCharacter ( char ) , 
73+     UnknownCharacter ( # [ error ( not ( source ) ) ]   char ) , 
7474
7575    /// An unexpected character was found 
7676/// 
7777/// Unexpected characters are characters that _do_ exist in the GraphQL 
7878/// language, but is not expected at the current position in the document. 
7979#[ display( "Unexpected character \" {_0}\" " ) ]  
80-     UnexpectedCharacter ( char ) , 
80+     UnexpectedCharacter ( # [ error ( not ( source ) ) ]   char ) , 
8181
8282    /// An unterminated string literal was found 
8383/// 
@@ -92,14 +92,14 @@ pub enum LexerError {
9292/// This occurs when an invalid source character is found in a string 
9393/// literal, such as ASCII control characters. 
9494#[ display( "Unknown character \" {_0}\"  in string literal" ) ]  
95-     UnknownCharacterInString ( char ) , 
95+     UnknownCharacterInString ( # [ error ( not ( source ) ) ]   char ) , 
9696
9797    /// An unknown escape sequence in a string literal was found 
9898/// 
9999/// Only a limited set of escape sequences are supported, this is emitted 
100100/// when e.g. `"\l"` is parsed. 
101101#[ display( "Unknown escape sequence \" {_0}\"  in string" ) ]  
102-     UnknownEscapeSequence ( String ) , 
102+     UnknownEscapeSequence ( # [ error ( not ( source ) ) ]   String ) , 
103103
104104    /// The input source was unexpectedly terminated 
105105/// 
@@ -516,5 +516,3 @@ fn is_name_cont(c: char) -> bool {
516516fn  is_number_start ( c :  char )  -> bool  { 
517517    c == '-'  || c. is_ascii_digit ( ) 
518518} 
519- 
520- impl  std:: error:: Error  for  LexerError  { } 
0 commit comments