File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11pub use super :: token:: Tok ;
22use std:: collections:: HashMap ;
3- use std:: iter:: FromIterator ;
43use std:: str:: CharIndices ;
54use std:: str:: FromStr ;
65
@@ -22,11 +21,6 @@ pub enum LexicalError {
2221
2322pub type Spanned < Tok > = Result < ( usize , Tok , usize ) , LexicalError > ;
2423
25- pub fn lex_source ( source : & String ) -> Vec < Tok > {
26- let lexer = Lexer :: new ( source) ;
27- Vec :: from_iter ( lexer. map ( |x| x. unwrap ( ) . 1 ) )
28- }
29-
3024impl < ' input > Lexer < ' input > {
3125 pub fn new ( input : & ' input str ) -> Self {
3226 let mut lxr = Lexer {
@@ -676,13 +670,18 @@ impl<'input> Iterator for Lexer<'input> {
676670
677671#[ cfg( test) ]
678672mod tests {
679- use super :: Tok ;
680- use super :: lex_source ;
673+ use super :: { Lexer , Tok } ;
674+ use std :: iter :: FromIterator ;
681675
682676 const WINDOWS_EOL : & str = "\r \n " ;
683677 const MAC_EOL : & str = "\r " ;
684678 const UNIX_EOL : & str = "\n " ;
685679
680+ pub fn lex_source ( source : & String ) -> Vec < Tok > {
681+ let lexer = Lexer :: new ( source) ;
682+ Vec :: from_iter ( lexer. map ( |x| x. unwrap ( ) . 1 ) )
683+ }
684+
686685 macro_rules! test_line_comment {
687686 ( $( $name: ident: $eol: expr, ) * ) => {
688687 $(
You can’t perform that action at this time.
0 commit comments